summaryrefslogtreecommitdiff
path: root/includes/database/pgsql/query.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/database/pgsql/query.inc')
-rw-r--r--includes/database/pgsql/query.inc26
1 files changed, 13 insertions, 13 deletions
diff --git a/includes/database/pgsql/query.inc b/includes/database/pgsql/query.inc
index 4f3a08da6..dc9054a99 100644
--- a/includes/database/pgsql/query.inc
+++ b/includes/database/pgsql/query.inc
@@ -13,9 +13,9 @@ class InsertQuery_pgsql extends InsertQuery {
parent::__construct($connection, $table, $options);
$this->queryOptions['return'] = Database::RETURN_NULL;
}
-
+
public function execute() {
-
+
// Confirm that the user did not try to specify an identical
// field and default field.
if (array_intersect($this->insertFields, $this->defaultFields)) {
@@ -53,13 +53,13 @@ class InsertQuery_pgsql extends InsertQuery {
// when requesting the last insert ID, so we pass that in via
// the options array.
$options = $this->queryOptions;
-
+
if ($schema['fields'][$schema['primary key'][0]]['type'] == 'serial') {
$options['sequence_name'] = $this->connection->makeSequenceName($this->table, $schema['primary key'][0]);
$options['return'] = Database::RETURN_INSERT_ID;
}
$last_insert_id = $this->connection->query($stmt, array(), $options);
-
+
// Re-initialize the values array so that we can re-use this query.
$this->insertValues = array();
@@ -67,7 +67,7 @@ class InsertQuery_pgsql extends InsertQuery {
}
public function __toString() {
-
+
// Default fields are always placed first for consistency.
$insert_fields = array_merge($this->defaultFields, $this->insertFields);
@@ -78,11 +78,11 @@ class InsertQuery_pgsql extends InsertQuery {
if (count($this->insertValues)) {
foreach ($this->insertValues as $insert_values) {
$placeholders = array();
-
+
// Default fields aren't really placeholders, but this is the most convenient
// way to handle them.
$placeholders = array_pad($placeholders, count($this->defaultFields), 'default');
-
+
$new_placeholder = $max_placeholder + count($insert_values);
for ($i = $max_placeholder; $i < $new_placeholder; ++$i) {
$placeholders[] = ':db_insert_placeholder_' . $i;
@@ -103,18 +103,18 @@ class InsertQuery_pgsql extends InsertQuery {
}
}
-class UpdateQuery_pgsql extends UpdateQuery {
+class UpdateQuery_pgsql extends UpdateQuery {
public function execute() {
$max_placeholder = 0;
$blobs = array();
$blob_count = 0;
-
+
$schema = drupal_get_schema($this->table);
-
+
// Because we filter $fields the same way here and in __toString(), the
// placeholders will all match up properly.
$stmt = $this->connection->prepareQuery((string)$this);
-
+
// Expressions take priority over literal fields, so we process those first
// and remove any literal fields that conflict.
$fields = $this->fields;
@@ -130,7 +130,7 @@ class UpdateQuery_pgsql extends UpdateQuery {
}
unset($fields[$field]);
}
-
+
foreach ($fields as $field => &$value) {
$placeholder = ':db_update_placeholder_' . ($max_placeholder++);
@@ -160,7 +160,7 @@ class UpdateQuery_pgsql extends UpdateQuery {
$options = $this->queryOptions;
$options['already_prepared'] = TRUE;
$this->connection->query($stmt, $options);
-
+
//$stmt->execute(NULL, $this->queryOptions);
return $stmt->rowCount();
}