(bug 38406) Properly quote table names in DatabaseBase::tableName()
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 18 Jul 2012 08:18:49 +0000 (10:18 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 18 Jul 2012 12:54:47 +0000 (14:54 +0200)
commita6c47b6098539440958a49f8992ee2d5595d37ac
tree32f87dd7836eccc6abc962c96915f96b89c46e49
parent897b1cb2f644c9dd3d9b3b447e9c19f8a12a7e0c
(bug 38406) Properly quote table names in DatabaseBase::tableName()

Currently the logic is the following:
$database = ( $format == 'quoted' || $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) );
This means that $database will *not* be quoted if $format is set to 'quoted',
which is the opposite of what we want here. Instead I just copied the code
used to quote $table just below and replace the variable.

This causes SQL syntax errors when the shared table name contain hyphens
since it is not quoted.

No RELEASE-NOTES entry since this should be backported to 1.19 once merged.

Patchset #2: added some tests
Patchset #3: fix tests for SQLite

Change-Id: Idda844cb470454a9a22001a31b6692de49892ca2
includes/db/Database.php
tests/phpunit/includes/db/DatabaseTest.php