Commit cd6a08d8 authored by webchick's avatar webchick

#772554 by Crell: Remove delay() method from insert queries.

parent f62d41af
......@@ -44,18 +44,16 @@ public function execute() {
public function __toString() {
$delay = $this->queryOptions['delay'] ? 'DELAYED' : '';
// Default fields are always placed first for consistency.
$insert_fields = array_merge($this->defaultFields, $this->insertFields);
// If we're selecting from a SelectQuery, finish building the query and
// pass it back, as any remaining options are irrelevant.
if (!empty($this->fromQuery)) {
return "INSERT $delay INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') ' . $this->fromQuery;
return "INSERT INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') ' . $this->fromQuery;
}
$query = "INSERT $delay INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';
$query = "INSERT INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';
$max_placeholder = 0;
$values = array();
......
......@@ -414,33 +414,6 @@ public function useDefaults(array $fields) {
return $this;
}
/**
* Flag this query as being delay-safe or not.
*
* If this method is never called, it is assumed that the query must be
* executed immediately. If delay is set to TRUE, then the query will be
* flagged to run "delayed" or "low priority" on databases that support such
* capabilities. In that case, the database will return immediately and the
* query will be run at some point in the future. That makes it useful for
* logging-style queries.
*
* If the database does not support delayed INSERT queries, this method
* has no effect.
*
* Note that for a delayed query there is no serial ID returned, as it won't
* be created until later when the query runs. It should therefore not be
* used if the value of the ID is known.
*
* @param $delay
* If TRUE, this query is delay-safe and will run delayed on supported databases.
* @return InsertQuery
* The called object.
*/
public function delay($delay = TRUE) {
$this->delay = $delay;
return $this;
}
public function from(SelectQueryInterface $query) {
$this->fromQuery = $query;
return $this;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment