diff options
Diffstat (limited to 'includes/database')
-rw-r--r-- | includes/database/database.inc | 9 | ||||
-rw-r--r-- | includes/database/mysql/database.inc | 6 | ||||
-rw-r--r-- | includes/database/pgsql/database.inc | 6 |
3 files changed, 8 insertions, 13 deletions
diff --git a/includes/database/database.inc b/includes/database/database.inc index 2a4fab9c3..f7edbd6f0 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -640,7 +640,7 @@ abstract class DatabaseConnection extends PDO { * A database query result resource, or FALSE if the query was not executed * correctly. */ - abstract function queryTemporary($query, Array $args, $tablename, $options = array()); + abstract function queryTemporary($query, Array $args, $tablename, Array $options = array()); /** * Returns the type of database driver. @@ -1410,10 +1410,9 @@ function db_query_range($query, $args, $from = 0, $count = 0, $options = array() * placeholders, this is an associative array in any order. If the query uses * unnamed placeholders (?), this is an indexed array and the order must match * the order of placeholders in the query string. - * @param $from - * The first record from the result set to return. - * @param $limit - * The number of records to return from the result set. + * @param $tablename + * The name of the temporary table to select into. This name will not be + * prefixed as there is no risk of collision. * @param $options * An array of options to control how the query operates. */ diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc index 7cf4f204c..d68951890 100644 --- a/includes/database/mysql/database.inc +++ b/includes/database/mysql/database.inc @@ -46,10 +46,8 @@ class DatabaseConnection_mysql extends DatabaseConnection { return $this->query($query . ' LIMIT ' . $from . ', ' . $count, $args, $options); } - public function queryTemporary($query, Array $args, $tablename, $options = array()) { - $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' Engine=HEAP SELECT', $this->prefixTables($query)); - - return $this->query($query, $args, $options); + public function queryTemporary($query, Array $args, $tablename, Array $options = array()) { + return $this->query(preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' Engine=MEMORY SELECT', $query), $args, $options); } public function driver() { diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc index 793e97c74..c66956e3e 100644 --- a/includes/database/pgsql/database.inc +++ b/includes/database/pgsql/database.inc @@ -82,10 +82,8 @@ class DatabaseConnection_pgsql extends DatabaseConnection { return $this->query($query . ' LIMIT ' . $count . ' OFFSET ' . $from, $args, $options); } - public function queryTemporary($query, Array $args, $tablename, $options = array()) { - $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' Engine=HEAP SELECT', $this->prefixTables($query)); - - return $this->query($query, $args, $options); + public function queryTemporary($query, Array $args, $tablename, Array $options = array()) { + return $this->query(preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' AS SELECT', $query), $args, $options); } public function driver() { |