r85907 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85906‎ | r85907 | r85908 >
Date:18:59, 12 April 2011
Author:platonides
Status:resolved (Comments)
Tags:
Comment:
Follow up r85888: Add the parameter to DatabasePostgres.php and DatabaseOracle.php
Follow up r85884: The parent tableName() should work now for DatabaseMssql.php
Modified paths:
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -632,8 +632,7 @@
633633 return $retval;
634634 }
635635
636 - function tableName( $name ) {
637 - global $wgSharedDB, $wgSharedPrefix, $wgSharedTables;
 636+ function tableName( $name, $quoted ) {
638637 /*
639638 Replace reserved words with better ones
640639 Using uppercase because that's the only way Oracle can handle
@@ -648,7 +647,7 @@
649648 break;
650649 }
651650
652 - return parent::tableName( strtoupper( $name ) );
 651+ return parent::tableName( strtoupper( $name ), $quoted );
653652 }
654653
655654 /**
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -611,7 +611,7 @@
612612 return $res;
613613 }
614614
615 - function tableName( $name ) {
 615+ function tableName( $name, $quoted = true ) {
616616 # Replace reserved words with better ones
617617 switch( $name ) {
618618 case 'user':
@@ -619,7 +619,7 @@
620620 case 'text':
621621 return 'pagecontent';
622622 default:
623 - return $name;
 623+ return parent::tableName( $name, $quoted );
624624 }
625625 }
626626
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -510,35 +510,6 @@
511511 }
512512
513513 /**
514 - * Format a table name ready for use in constructing an SQL query
515 - *
516 - * This does two important things: it brackets table names which as necessary,
517 - * and it adds a table prefix if there is one.
518 - *
519 - * All functions of this object which require a table name call this function
520 - * themselves. Pass the canonical name to such functions. This is only needed
521 - * when calling query() directly.
522 - *
523 - * @param $name String: database table name
524 - */
525 - function tableName( $name ) {
526 - global $wgSharedDB;
527 - # Skip quoted literals
528 - if ( $name != '' && $name { 0 } != '[' ) {
529 - if ( $this->mTablePrefix !== '' && strpos( '.', $name ) === false ) {
530 - $name = "{$this->mTablePrefix}$name";
531 - }
532 - if ( isset( $wgSharedDB ) && "{$this->mTablePrefix}user" == $name ) {
533 - $name = "[$wgSharedDB].[$name]";
534 - } else {
535 - # Standard quoting
536 - if ( $name != '' ) $name = "[$name]";
537 - }
538 - }
539 - return $name;
540 - }
541 -
542 - /**
543514 * Return the next in a sequence, save the value for retrieval via insertId()
544515 */
545516 function nextSequenceValue( $seqName ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r87143Followup to r85907, correctly quote table names....overlordq22:27, 29 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85884Abstract tableName() by adding new function isQuotedIdentifier() to databases....platonides16:34, 12 April 2011
r85888Add parameter to tableName() to get the bare table name.platonides17:00, 12 April 2011

Comments

#Comment by OverlordQ (talk | contribs)   15:59, 19 April 2011

Breaks updates.

Warning: pg_query(): Query failed: ERROR:  relation "logging_log_id_seq" already exists in /var/www/site/w/includes/db/DatabasePostgres.php on line 250
A database error has occurred.  Did you forget to run maintenance/update.php after upgrading?  See: [http://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script http://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script]
Query: CREATE SEQUENCE logging_log_id_seq
Function:
Error: 1 ERROR:  relation "logging_log_id_seq" already exists

Status & tagging log