Merge "Store boolean values as integers with SQLite"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 18 Sep 2013 00:07:57 +0000 (00:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 18 Sep 2013 00:07:57 +0000 (00:07 +0000)
includes/db/DatabaseSqlite.php

index 6692fa4..a8270bf 100644 (file)
@@ -709,6 +709,8 @@ class DatabaseSqlite extends DatabaseBase {
        function addQuotes( $s ) {
                if ( $s instanceof Blob ) {
                        return "x'" . bin2hex( $s->fetch() ) . "'";
+               } elseif ( is_bool( $s ) ) {
+                       return (int)$s;
                } elseif ( strpos( $s, "\0" ) !== false ) {
                        // SQLite doesn't support \0 in strings, so use the hex representation as a workaround.
                        // This is a known limitation of SQLite's mprintf function which PDO should work around,