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.
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)."'";
}