Database: Behave correctly when inserting booleans
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 21 Sep 2016 18:03:29 +0000 (14:03 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 21 Sep 2016 18:03:29 +0000 (14:03 -0400)
commitf536c780eb9d279485bb22e89be2465ad9997e3b
treee178b4a8936713f181ca2c0438f9474c0c26521f
parent17914cc990c375340b688900b7782f1d7d5339fc
Database: Behave correctly when inserting booleans

Pretty much everything seems to assume that PHP booleans should be
converted to 0/1: MySQL does this implicitly thanks to the lack of
strict mode by default, while PostgreSQL and Sqlite (and Mssql) do it
explicitly.

The addition of MySQL strict mode for unit tests in Ib2873913 exposed
the assumption in the case of MySQL by making some extension unit tests
fail. So let's make casting bool to int the default behavior of
Database::addQuotes().

This also cleans up the phpdoc for Database::addQuotes() to properly
reflect all the supported types that can be passed to it.

Change-Id: I13d0e402fa676bc27c345e8ac12f363ebc627f6a
includes/db/DatabaseMssql.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabasePostgres.php
includes/libs/rdbms/database/DatabaseSqlite.php
includes/libs/rdbms/database/IDatabase.php