Force inserted bools to be ints, per Tim's suggestion on bug 15148.
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 21 Aug 2008 13:10:19 +0000 (13:10 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 21 Aug 2008 13:10:19 +0000 (13:10 +0000)
This should be fine for now as Postgres uses SMALLINTs for BOOLs, to
match MySQLs BOOL/TINYINT aliasing and subsequent MW coding assumptions.
It's possible this will cause bad effects if inserted values are called
in a boolean context when they are going into a non-SMALLINT column, but we can handle
those as they come up.

includes/db/DatabasePostgres.php

index bf948c9..70a635b 100644 (file)
@@ -1271,6 +1271,8 @@ END;
        function addQuotes( $s ) {
                if ( is_null( $s ) ) {
                        return 'NULL';
+               } else if ( is_bool( $s ) ) {
+                       return intval( $s );
                } else if ($s instanceof Blob) {
                        return "'".$s->fetch($s)."'";
                }