r96370 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96369‎ | r96370 | r96371 >
Date:20:51, 6 September 2011
Author:demon
Status:ok
Tags:
Comment:
Followup r96369: update child classes and a few callers
Modified paths:
  • /trunk/phase3/includes/db/CloneDatabase.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)
  • /trunk/phase3/includes/search/SearchOracle.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/search/SearchOracle.php
@@ -257,9 +257,9 @@
258258 // ALTER SESSION SET CURRENT_SCHEMA = ...
259259 // was used.
260260 $dbw->query( "CALL ctx_ddl.sync_index(" .
261 - $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_text_idx', false ) ) . ")" );
 261+ $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_text_idx', 'raw' ) ) . ")" );
262262 $dbw->query( "CALL ctx_ddl.sync_index(" .
263 - $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_title_idx', false ) ) . ")" );
 263+ $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_title_idx', 'raw' ) ) . ")" );
264264 }
265265
266266 /**
Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -654,7 +654,7 @@
655655 return $retval;
656656 }
657657
658 - function tableName( $name, $quoted = true ) {
 658+ function tableName( $name, $format = 'quoted' ) {
659659 /*
660660 Replace reserved words with better ones
661661 Using uppercase because that's the only way Oracle can handle
@@ -669,7 +669,7 @@
670670 break;
671671 }
672672
673 - return parent::tableName( strtoupper( $name ), $quoted );
 673+ return parent::tableName( strtoupper( $name ), $format );
674674 }
675675
676676 function tableNameInternal( $name ) {
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -39,7 +39,7 @@
4040 AND attname=%s;
4141 SQL;
4242
43 - $table = $db->tableName( $table, false );
 43+ $table = $db->tableName( $table, 'raw' );
4444 $res = $db->query(
4545 sprintf( $q,
4646 $db->addQuotes( $wgDBmwschema ),
@@ -622,7 +622,7 @@
623623 return $res;
624624 }
625625
626 - function tableName( $name, $quoted = true ) {
 626+ function tableName( $name, $format = 'quoted' ) {
627627 # Replace reserved words with better ones
628628 switch( $name ) {
629629 case 'user':
@@ -630,7 +630,7 @@
631631 case 'text':
632632 return 'pagecontent';
633633 default:
634 - return parent::tableName( $name, $quoted );
 634+ return parent::tableName( $name, $format );
635635 }
636636 }
637637
@@ -737,7 +737,7 @@
738738 if ( !$schema ) {
739739 $schema = $wgDBmwschema;
740740 }
741 - $table = $this->tableName( $table, false );
 741+ $table = $this->tableName( $table, 'raw' );
742742 $etable = $this->addQuotes( $table );
743743 $eschema = $this->addQuotes( $schema );
744744 $SQL = "SELECT 1 FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n "
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -748,7 +748,7 @@
749749 * @param $name Boolean
750750 * @return String
751751 */
752 - public function tableName( $name, $quoted = true ) {
 752+ public function tableName( $name, $format = 'quoted' ) {
753753 // we want maximum compatibility with MySQL schema
754754 return $name;
755755 }
Index: trunk/phase3/includes/db/CloneDatabase.php
@@ -93,10 +93,10 @@
9494 # fix back and forth so tableName() works right.
9595
9696 self::changePrefix( $this->oldTablePrefix );
97 - $oldTableName = $this->db->tableName( $tbl, false );
 97+ $oldTableName = $this->db->tableName( $tbl, 'raw' );
9898
9999 self::changePrefix( $this->newTablePrefix );
100 - $newTableName = $this->db->tableName( $tbl, false );
 100+ $newTableName = $this->db->tableName( $tbl, 'raw' );
101101
102102 if( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres' ) ) ) {
103103 $this->db->dropTable( $tbl, __METHOD__ );
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -319,15 +319,15 @@
320320 * Use MySQL's naming (accounts for prefix etc) but remove surrounding backticks
321321 *
322322 * @param $name
323 - * @param bool $quoted
 323+ * @param $format String
324324 * @return string
325325 */
326 - function tableName( $name, $quoted = true ) {
 326+ function tableName( $name, $format = 'quoted' ) {
327327 // table names starting with sqlite_ are reserved
328328 if ( strpos( $name, 'sqlite_' ) === 0 ) {
329329 return $name;
330330 }
331 - return str_replace( '"', '', parent::tableName( $name, $quoted ) );
 331+ return str_replace( '"', '', parent::tableName( $name, $format ) );
332332 }
333333
334334 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96369Fixme on r85888: boolean params are evil, use a nice simple string instead :)demon20:44, 6 September 2011

Status & tagging log