r40532 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40531‎ | r40532 | r40533 >
Date:13:56, 6 September 2008
Author:tstarling
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -289,15 +289,22 @@
290290 }
291291
292292 function encodeBlob($b) {
293 - return $this->strencode($b);
 293+ return new Blob( $b );
294294 }
295295
296296 function decodeBlob($b) {
 297+ if ($b instanceof Blob) {
 298+ $b = $b->fetch();
 299+ }
297300 return $b;
298301 }
299302
300303 function addQuotes($s) {
301 - return $this->mConn->quote($s);
 304+ if ( $s instanceof Blob ) {
 305+ return "x'" . bin2hex( $s->fetch() ) . "'";
 306+ } else {
 307+ return $this->mConn->quote($s);
 308+ }
302309 }
303310
304311 function quote_ident($s) { return $s; }