diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-05-15 07:04:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-05-15 07:04:21 +0000 |
commit | 416f87f170cd6d2fe23db676939283cf174ff68c (patch) | |
tree | 8b908b76ac86cabc785ca890c08a2acff241a31a /includes/database/pgsql | |
parent | 520d8e6e9202f53bad53d4bdaf56ac1d78aba2f6 (diff) | |
download | brdo-416f87f170cd6d2fe23db676939283cf174ff68c.tar.gz brdo-416f87f170cd6d2fe23db676939283cf174ff68c.tar.bz2 |
- Patch #785782 by cafuego: support comments in built queries.
Diffstat (limited to 'includes/database/pgsql')
-rw-r--r-- | includes/database/pgsql/query.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/database/pgsql/query.inc b/includes/database/pgsql/query.inc index 0420f4aad..cb1b94ba2 100644 --- a/includes/database/pgsql/query.inc +++ b/includes/database/pgsql/query.inc @@ -71,6 +71,8 @@ class InsertQuery_pgsql extends InsertQuery { } public function __toString() { + // Create a comments string to prepend to the query. + $comments = (!empty($this->comments)) ? '/* ' . implode('; ', $this->comments) . ' */ ' : ''; // Default fields are always placed first for consistency. $insert_fields = array_merge($this->defaultFields, $this->insertFields); @@ -78,10 +80,10 @@ class InsertQuery_pgsql extends InsertQuery { // 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 INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') ' . $this->fromQuery; + return $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') ' . $this->fromQuery; } - $query = "INSERT INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES '; + $query = $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES '; $max_placeholder = 0; $values = array(); |