Merge "DatabaseMssql: Don't duplicate body of makeList()"
[lhc/web/wiklou.git] / includes / db / DatabaseSqlite.php
index 9a03a33..9257ffe 100644 (file)
@@ -787,6 +787,10 @@ class DatabaseSqlite extends DatabaseBase {
                        // https://bugs.php.net/bug.php?id=63419
                        // There was already a similar report for SQLite3::escapeString, bug #62361:
                        // https://bugs.php.net/bug.php?id=62361
+                       // There is an additional bug regarding sorting this data after insert
+                       // on older versions of sqlite shipped with ubuntu 12.04
+                       // https://bugzilla.wikimedia.org/show_bug.cgi?id=72367
+                       wfDebugLog( __CLASS__, __FUNCTION__ . ': Quoting value containing null byte. For consistency all binary data should have been first processed with self::encodeBlob()' );
                        return "x'" . bin2hex( $s ) . "'";
                } else {
                        return $this->mConn->quote( $s );
@@ -873,6 +877,9 @@ class DatabaseSqlite extends DatabaseBase {
                } elseif ( preg_match( '/^\s*DROP INDEX/i', $s ) ) {
                        // DROP INDEX is database-wide, not table-specific, so no ON <table> clause.
                        $s = preg_replace( '/\sON\s+[^\s]*/i', '', $s );
+               } elseif ( preg_match( '/^\s*INSERT IGNORE\b/i', $s ) ) {
+                       // INSERT IGNORE --> INSERT OR IGNORE
+                       $s = preg_replace( '/^\s*INSERT IGNORE\b/i', 'INSERT OR IGNORE', $s );
                }
 
                return $s;