Index: trunk/phase3/includes/db/DatabaseMysql.php |
— | — | @@ -322,6 +322,13 @@ |
323 | 323 | return $sQuoted; |
324 | 324 | } |
325 | 325 | |
| 326 | + /** |
| 327 | + * MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes". |
| 328 | + */ |
| 329 | + public function addIdentifierQuotes( $s ) { |
| 330 | + return "`" . $this->strencode( $s ) . "`"; |
| 331 | + } |
| 332 | + |
326 | 333 | function ping() { |
327 | 334 | $ping = mysql_ping( $this->mConn ); |
328 | 335 | if ( $ping ) { |
Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -1125,10 +1125,6 @@ |
1126 | 1126 | return "'" . $this->strencode( $s ) . "'"; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | | - function addIdentifierQuotes( $s ) { |
1130 | | - return '"' . str_replace( '"', '""', $s ) . '"'; |
1131 | | - } |
1132 | | - |
1133 | 1129 | function selectRow( $table, $vars, $conds, $fname = 'DatabaseOracle::selectRow', $options = array(), $join_conds = array() ) { |
1134 | 1130 | global $wgContLang; |
1135 | 1131 | |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -1300,10 +1300,6 @@ |
1301 | 1301 | return "'" . pg_escape_string( $this->mConn, $s ) . "'"; |
1302 | 1302 | } |
1303 | 1303 | |
1304 | | - function addIdentifierQuotes( $s ) { |
1305 | | - return '"' . str_replace( '"', '""', $s ) . '"'; |
1306 | | - } |
1307 | | - |
1308 | 1304 | /** |
1309 | 1305 | * Postgres specific version of replaceVars. |
1310 | 1306 | * Calls the parent version in Database.php |
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php |
— | — | @@ -647,10 +647,6 @@ |
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
651 | | - public function addIdentifierQuotes( $s ) { |
652 | | - return '"' . str_replace( '"', '""', $s ) . '"'; |
653 | | - } |
654 | | - |
655 | 651 | /** |
656 | 652 | * Verifies that a DB2 column/field type is numeric |
657 | 653 | * |
Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -1695,12 +1695,13 @@ |
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | /** |
1699 | | - * Quotes a string using `backticks` for things like database, table, and field |
1700 | | - * names, other databases which use something other than backticks can replace |
1701 | | - * this with something else |
| 1699 | + * Quotes an identifier using `backticks` or "double quotes" depending on the database type. |
| 1700 | + * MySQL uses `backticks` while basically everything else uses double quotes. |
| 1701 | + * Since MySQL is the odd one out here the double quotes are our generic |
| 1702 | + * and we implement backticks in DatabaseMysql. |
1702 | 1703 | */ |
1703 | 1704 | public function addIdentifierQuotes( $s ) { |
1704 | | - return "`" . $this->strencode( $s ) . "`"; |
| 1705 | + return '"' . str_replace( '"', '""', $s ) . '"'; |
1705 | 1706 | } |
1706 | 1707 | |
1707 | 1708 | /** |
Index: trunk/phase3/includes/db/DatabaseMssql.php |
— | — | @@ -997,10 +997,6 @@ |
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | |
1001 | | - function addIdentifierQuotes( $s ) { |
1002 | | - return "'" . str_replace( "'", "''", $s ) . "'"; |
1003 | | - } |
1004 | | - |
1005 | 1001 | function selectDB( $db ) { |
1006 | 1002 | return ( $this->query( "SET DATABASE $db" ) !== false ); |
1007 | 1003 | } |
Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -530,10 +530,6 @@ |
531 | 531 | } |
532 | 532 | } |
533 | 533 | |
534 | | - function addIdentifierQuotes( $s ) { |
535 | | - return '"' . str_replace( '"', '""', $s ) . '"'; |
536 | | - } |
537 | | - |
538 | 534 | function buildLike() { |
539 | 535 | $params = func_get_args(); |
540 | 536 | if ( count( $params ) > 0 && is_array( $params[0] ) ) { |