From: Greg Sabino Mullane Date: Thu, 21 Aug 2008 13:10:19 +0000 (+0000) Subject: Force inserted bools to be ints, per Tim's suggestion on bug 15148. X-Git-Tag: 1.31.0-rc.0~45744 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=609ad548356c595e8a2f8fbf70ea8ae7a0965e18;p=lhc%2Fweb%2Fwiklou.git Force inserted bools to be ints, per Tim's suggestion on bug 15148. 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. --- diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index bf948c9d46..70a635bdf7 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -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)."'"; }