From f09028107ca18a8f897ff517d2ed04688e1c567d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 20 Apr 2009 20:02:31 +0000 Subject: - Patch #413732 by brianV: database code clean-up. --- includes/database/pgsql/database.inc | 2 +- includes/database/pgsql/install.inc | 6 ++++++ includes/database/pgsql/query.inc | 10 ++++++++-- includes/database/pgsql/schema.inc | 10 ++++++---- 4 files changed, 21 insertions(+), 7 deletions(-) (limited to 'includes/database/pgsql') diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc index c9dd63a06..881ea3d97 100644 --- a/includes/database/pgsql/database.inc +++ b/includes/database/pgsql/database.inc @@ -72,7 +72,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection { else { $query_string = $query; } - throw new PDOException($query_string . " - \n" . print_r($args,1) . $e->getMessage()); + throw new PDOException($query_string . " - \n" . print_r($args, 1) . $e->getMessage()); } return NULL; } diff --git a/includes/database/pgsql/install.inc b/includes/database/pgsql/install.inc index 921e21402..b301cb672 100644 --- a/includes/database/pgsql/install.inc +++ b/includes/database/pgsql/install.inc @@ -1,6 +1,12 @@ bindParam(':db_insert_placeholder_'. $max_placeholder++, $insert_values[$idx]); + $stmt->bindParam(':db_insert_placeholder_' . $max_placeholder++, $insert_values[$idx]); } } } @@ -101,7 +107,7 @@ class InsertQuery_pgsql extends InsertQuery { else { // If there are no values, then this is a default-only query. We still need to handle that. $placeholders = array_fill(0, count($this->defaultFields), 'default'); - $values[] = '(' . implode(', ', $placeholders) .')'; + $values[] = '(' . implode(', ', $placeholders) . ')'; } $query .= implode(', ', $values); diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc index c4dda4c03..08b04b938 100644 --- a/includes/database/pgsql/schema.inc +++ b/includes/database/pgsql/schema.inc @@ -19,7 +19,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema { * This is collected by DatabaseConnection_pgsql->queryTableInformation(), * by introspecting the database. * - * @see DatabaseConnection_pgsql->queryTableInformation(). + * @see DatabaseConnection_pgsql->queryTableInformation() * @var array */ protected $tableInformation = array(); @@ -46,7 +46,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema { if (!isset($this->tableInformation[$key])) { // Split the key into schema and table for querying. - list($schema,$table_name) = explode('.', $key); + list($schema, $table_name) = explode('.', $key); $table_information = (object) array( 'blob_fields' => array(), 'sequences' => array(), @@ -56,7 +56,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema { if ($column->data_type == 'bytea') { $table_information->blob_fields[$column->column_name] = TRUE; } - else if (preg_match("/nextval\('([^']+)'/", $column->column_default, $matches)) { + elseif (preg_match("/nextval\('([^']+)'/", $column->column_default, $matches)) { // We must know of any sequences in the table structure to help us // return the last insert id. If there is more than 1 sequences the // first one (index 0 of the sequences array) will be used. @@ -311,8 +311,10 @@ class DatabaseSchema_pgsql extends DatabaseSchema { * table along with adding the field. The format is the same as a * table specification but without the 'fields' element. If you are * adding a type 'serial' field, you MUST specify at least one key - * or index including it in this array. @see db_change_field for more + * or index including it in this array. See db_change_field() for more * explanation why. + * + * @see db_change_field() */ public function addField(&$ret, $table, $field, $spec, $new_keys = array()) { $fixnull = FALSE; -- cgit v1.2.3