summaryrefslogtreecommitdiffstatshomepage
path: root/includes/database/sqlite
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-04-20 20:02:31 +0000
committerDries Buytaert <dries@buytaert.net>2009-04-20 20:02:31 +0000
commitf09028107ca18a8f897ff517d2ed04688e1c567d (patch)
tree1f6cff867077daac6dbdd9a78967679cadef1b8c /includes/database/sqlite
parent10931908b5885741be806ff15586770691801e51 (diff)
downloaddrupal-f09028107ca18a8f897ff517d2ed04688e1c567d.tar.gz
drupal-f09028107ca18a8f897ff517d2ed04688e1c567d.zip
- Patch #413732 by brianV: database code clean-up.
Diffstat (limited to 'includes/database/sqlite')
-rw-r--r--includes/database/sqlite/database.inc6
-rw-r--r--includes/database/sqlite/query.inc13
-rw-r--r--includes/database/sqlite/schema.inc5
3 files changed, 16 insertions, 8 deletions
diff --git a/includes/database/sqlite/database.inc b/includes/database/sqlite/database.inc
index e872f5c3c87..abfe42c1648 100644
--- a/includes/database/sqlite/database.inc
+++ b/includes/database/sqlite/database.inc
@@ -25,7 +25,7 @@ class DatabaseConnection_sqlite extends DatabaseConnection {
// This driver defaults to transaction support, except if explicitly passed FALSE.
$this->transactionSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] !== FALSE;
- parent::__construct('sqlite:'. $connection_options['database'], '', '', array(
+ parent::__construct('sqlite:' . $connection_options['database'], '', '', array(
// Force column names to lower case.
PDO::ATTR_CASE => PDO::CASE_LOWER,
));
@@ -162,8 +162,10 @@ class DatabaseConnection_sqlite extends DatabaseConnection {
/**
* Specific SQLite implementation of DatabaseConnection.
*
- * @see DatabaseConnection_sqlite::PDOPrepare for reasons why we must prefetch
+ * See DatabaseConnection_sqlite::PDOPrepare() for reasons why we must prefetch
* the data instead of using PDOStatement.
+ *
+ * @see DatabaseConnection_sqlite::PDOPrepare()
*/
class DatabaseStatement_sqlite extends DatabaseStatementPrefetch implements Iterator, DatabaseStatementInterface {
diff --git a/includes/database/sqlite/query.inc b/includes/database/sqlite/query.inc
index aff32802fc5..ab6e2da500d 100644
--- a/includes/database/sqlite/query.inc
+++ b/includes/database/sqlite/query.inc
@@ -1,5 +1,10 @@
<?php
-// $Id $
+// $Id$
+
+/**
+ * @file
+ * Query code for SQLite embedded database engine.
+ */
/**
* @ingroup database
@@ -27,14 +32,14 @@ class InsertQuery_sqlite extends InsertQuery {
return parent::execute();
}
else {
- return $this->connection->query('INSERT INTO {'. $this->table .'} DEFAULT VALUES', array(), $this->queryOptions);
+ return $this->connection->query('INSERT INTO {' . $this->table . '} DEFAULT VALUES', array(), $this->queryOptions);
}
}
public function __toString() {
// Produce as many generic placeholders as necessary.
$placeholders = array_fill(0, count($this->insertFields), '?');
- return 'INSERT INTO {'. $this->table .'} ('. implode(', ', $this->insertFields) .') VALUES ('. implode(', ', $placeholders) .')';
+ return 'INSERT INTO {' . $this->table . '} (' . implode(', ', $this->insertFields) . ') VALUES (' . implode(', ', $placeholders) . ')';
}
}
@@ -87,7 +92,7 @@ class UpdateQuery_sqlite extends UpdateQuery {
// The IS NULL operator is badly managed by DatabaseCondition.
$condition->where($field . ' IS NULL');
}
- else if (is_null($data)) {
+ elseif (is_null($data)) {
// The field will be set to NULL.
// The IS NULL operator is badly managed by DatabaseCondition.
$condition->where($field . ' IS NOT NULL');
diff --git a/includes/database/sqlite/schema.inc b/includes/database/sqlite/schema.inc
index 3014aeb7d2b..137592bbfbc 100644
--- a/includes/database/sqlite/schema.inc
+++ b/includes/database/sqlite/schema.inc
@@ -66,7 +66,7 @@ class DatabaseSchema_sqlite extends DatabaseSchema {
// Add the SQL statement for each field.
foreach ($schema['fields'] as $name => $field) {
if ($field['type'] == 'serial') {
- if (isset($schema['primary key']) && ($key = array_search($name, $schema['primary key'])) !== false) {
+ if (isset($schema['primary key']) && ($key = array_search($name, $schema['primary key'])) !== FALSE) {
unset($schema['primary key'][$key]);
}
}
@@ -294,7 +294,8 @@ class DatabaseSchema_sqlite extends DatabaseSchema {
* @param $table
* Name of the table.
* @return
- * An array representing the schema, @see drupal_get_schema.
+ * An array representing the schema, from drupal_get_schema().
+ * @see drupal_get_schema()
*/
protected function introspectSchema($table) {
$mapped_fields = array_flip($this->getFieldTypeMap());