From f5c8dd247430503554bf3cfcf02ca30ed5a274c1 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 6 Sep 2008 13:56:59 +0000 Subject: [PATCH] Implemented blob support for SQLite. Allows null characters to be inserted into the database. Avoids total breakage of the objectcache table. For trunk and 1.13. --- includes/db/DatabaseSqlite.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index c6f9bc0f21..4ba0f1f1dc 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -289,15 +289,22 @@ class DatabaseSqlite extends Database { } function encodeBlob($b) { - return $this->strencode($b); + return new Blob( $b ); } function decodeBlob($b) { + if ($b instanceof Blob) { + $b = $b->fetch(); + } return $b; } function addQuotes($s) { - return $this->mConn->quote($s); + if ( $s instanceof Blob ) { + return "x'" . bin2hex( $s->fetch() ) . "'"; + } else { + return $this->mConn->quote($s); + } } function quote_ident($s) { return $s; } -- 2.20.1