summaryrefslogtreecommitdiff
path: root/includes/database/sqlite
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-05-17 03:31:36 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-05-17 03:31:36 +0000
commit8ba2805c91b7997c860fba160352c9ef05821f32 (patch)
tree68c31e173aab2459bb1bb1f80c55202685aee220 /includes/database/sqlite
parente9c3a69612d4e1efcf94ec990083b279c346239a (diff)
downloadbrdo-8ba2805c91b7997c860fba160352c9ef05821f32.tar.gz
brdo-8ba2805c91b7997c860fba160352c9ef05821f32.tar.bz2
#464878 by chx: Fix SQLite abstraction layer to accept arrays of placeholder values without leading :, for compatibility with PDO.
Diffstat (limited to 'includes/database/sqlite')
-rw-r--r--includes/database/sqlite/database.inc11
1 files changed, 10 insertions, 1 deletions
diff --git a/includes/database/sqlite/database.inc b/includes/database/sqlite/database.inc
index abfe42c16..f4ee1704c 100644
--- a/includes/database/sqlite/database.inc
+++ b/includes/database/sqlite/database.inc
@@ -202,11 +202,20 @@ class DatabaseStatement_sqlite extends DatabaseStatementPrefetch implements Iter
// Else, this is using named placeholders.
foreach ($args as $placeholder => $value) {
if (is_numeric($value)) {
+ // We will remove this placeholder from the query and PDO throws an
+ // exception if the number of placeholders in the query and the
+ // arguments does not match.
+ unset($args[$placeholder]);
+ // PDO allows placeholders to not be prefixed by a colon. See
+ // http://marc.info/?l=php-internals&m=111234321827149&w=2 for
+ // more.
+ if ($placeholder[0] != ':') {
+ $placeholder = ":$placeholder";
+ }
// When replacing the placeholders, make sure we search for the
// exact placeholder. For example, if searching for
// ':db_placeholder_1', do not replace ':db_placeholder_11'.
$query = preg_replace('/' . preg_quote($placeholder) . '\b/', $value, $query);
- unset($args[$placeholder]);
}
}
}