Implemented blob support for SQLite. Allows null characters to be inserted into the...
[lhc/web/wiklou.git] / includes / db / DatabaseSqlite.php
index c6f9bc0..4ba0f1f 100644 (file)
@@ -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; }