diff options
Diffstat (limited to 'includes/database/pgsql')
-rw-r--r-- | includes/database/pgsql/database.inc | 10 | ||||
-rw-r--r-- | includes/database/pgsql/install.inc | 1 | ||||
-rw-r--r-- | includes/database/pgsql/query.inc | 5 | ||||
-rw-r--r-- | includes/database/pgsql/schema.inc | 9 | ||||
-rw-r--r-- | includes/database/pgsql/select.inc | 1 |
5 files changed, 19 insertions, 7 deletions
diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc index d38b64afe..98b954ffd 100644 --- a/includes/database/pgsql/database.inc +++ b/includes/database/pgsql/database.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -35,6 +34,15 @@ class DatabaseConnection_pgsql extends DatabaseConnection { if (empty($connection_options['password'])) { $connection_options['password'] = NULL; } + // If the password contains a backslash it is treated as an escape character + // http://bugs.php.net/bug.php?id=53217 + // so backslashes in the password need to be doubled up. + // The bug was reported against pdo_pgsql 1.0.2, backslashes in passwords + // will break on this doubling up when the bug is fixed, so check the version + //elseif (phpversion('pdo_pgsql') < 'version_this_was_fixed_in') { + else { + $connection_options['password'] = str_replace('\\', '\\\\', $connection_options['password']); + } $this->connectionOptions = $connection_options; diff --git a/includes/database/pgsql/install.inc b/includes/database/pgsql/install.inc index 0d446af58..c77f4ea78 100644 --- a/includes/database/pgsql/install.inc +++ b/includes/database/pgsql/install.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/includes/database/pgsql/query.inc b/includes/database/pgsql/query.inc index c475a0011..f3783a9ca 100644 --- a/includes/database/pgsql/query.inc +++ b/includes/database/pgsql/query.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @ingroup database @@ -104,8 +103,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) . ' */ ' : ''; + // Create a sanitized comment string to prepend to the query. + $comments = $this->connection->makeComment($this->comments); // Default fields are always placed first for consistency. $insert_fields = array_merge($this->defaultFields, $this->insertFields); diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc index 30f12ef78..9ed8a2620 100644 --- a/includes/database/pgsql/schema.inc +++ b/includes/database/pgsql/schema.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -528,6 +527,9 @@ class DatabaseSchema_pgsql extends DatabaseSchema { $this->connection->query('ALTER TABLE {' . $table . '} DROP CONSTRAINT "' . $check . '"'); } + // Remove old default. + $this->fieldSetNoDefault($table, $field); + $this->connection->query('ALTER TABLE {' . $table . '} ALTER "' . $field . '" TYPE ' . $typecast . ' USING "' . $field . '"::' . $typecast); if (isset($spec['not null'])) { @@ -562,6 +564,11 @@ class DatabaseSchema_pgsql extends DatabaseSchema { $this->connection->query('ALTER TABLE {' . $table . '} ADD CHECK ("' . $field_new . '" >= 0)'); } + // Add default if necessary. + if (isset($spec['default'])) { + $this->fieldSetDefault($table, $field_new, $spec['default']); + } + // Change description if necessary. if (!empty($spec['description'])) { $this->connection->query('COMMENT ON COLUMN {' . $table . '}."' . $field_new . '" IS ' . $this->prepareComment($spec['description'])); diff --git a/includes/database/pgsql/select.inc b/includes/database/pgsql/select.inc index 98061c90a..d1d838281 100644 --- a/includes/database/pgsql/select.inc +++ b/includes/database/pgsql/select.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file |