r47825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47824‎ | r47825 | r47826 >
Date:09:10, 26 February 2009
Author:ialex
Status:ok
Tags:
Comment:
* Fixed $fname in functions definitions to have "DatabasePostgres::..." rather than "Database::..."
* Some whitespaces tweaks
Modified paths:
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -689,7 +689,7 @@
690690 * Takes same arguments as Database::select()
691691 */
692692
693 - function estimateRowCount( $table, $vars='*', $conds='', $fname = 'Database::estimateRowCount', $options = array() ) {
 693+ function estimateRowCount( $table, $vars='*', $conds='', $fname = 'DatabasePostgres::estimateRowCount', $options = array() ) {
694694 $options['EXPLAIN'] = true;
695695 $res = $this->select( $table, $vars, $conds, $fname, $options );
696696 $rows = -1;
@@ -709,7 +709,7 @@
710710 * Returns information about an index
711711 * If errors are explicitly ignored, returns NULL on failure
712712 */
713 - function indexInfo( $table, $index, $fname = 'Database::indexExists' ) {
 713+ function indexInfo( $table, $index, $fname = 'DatabasePostgres::indexInfo' ) {
714714 $sql = "SELECT indexname FROM pg_indexes WHERE tablename='$table'";
715715 $res = $this->query( $sql, $fname );
716716 if ( !$res ) {
@@ -723,7 +723,7 @@
724724 return false;
725725 }
726726
727 - function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) {
 727+ function indexUnique ($table, $index, $fname = 'DatabasePostgres::indexUnique' ) {
728728 $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'".
729729 " AND indexdef LIKE 'CREATE UNIQUE%(" .
730730 $this->strencode( $this->indexName( $index ) ) .
@@ -925,7 +925,7 @@
926926 # It may be more efficient to leave off unique indexes which are unlikely to collide.
927927 # However if you do this, you run the risk of encountering errors which wouldn't have
928928 # occurred in MySQL
929 - function replace( $table, $uniqueIndexes, $rows, $fname = 'Database::replace' ) {
 929+ function replace( $table, $uniqueIndexes, $rows, $fname = 'DatabasePostgres::replace' ) {
930930 $table = $this->tableName( $table );
931931
932932 if (count($rows)==0) {
@@ -975,7 +975,7 @@
976976 }
977977
978978 # DELETE where the condition is a join
979 - function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = "Database::deleteJoin" ) {
 979+ function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = 'DatabasePostgres::deleteJoin' ) {
980980 if ( !$conds ) {
981981 throw new DBUnexpectedError($this, 'Database::deleteJoin() called with empty $conds' );
982982 }
@@ -1092,12 +1092,12 @@
10931093 */
10941094 function relationExists( $table, $types, $schema = false ) {
10951095 global $wgDBmwschema;
1096 - if (!is_array($types))
1097 - $types = array($types);
1098 - if (! $schema )
 1096+ if ( !is_array( $types ) )
 1097+ $types = array( $types );
 1098+ if ( !$schema )
10991099 $schema = $wgDBmwschema;
1100 - $etable = $this->addQuotes($table);
1101 - $eschema = $this->addQuotes($schema);
 1100+ $etable = $this->addQuotes( $table );
 1101+ $eschema = $this->addQuotes( $schema );
11021102 $SQL = "SELECT 1 FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n "
11031103 . "WHERE c.relnamespace = n.oid AND c.relname = $etable AND n.nspname = $eschema "
11041104 . "AND c.relkind IN ('" . implode("','", $types) . "')";
@@ -1112,15 +1112,15 @@
11131113 * For backward compatibility, this function checks both tables and
11141114 * views.
11151115 */
1116 - function tableExists ($table, $schema = false) {
1117 - return $this->relationExists($table, array('r', 'v'), $schema);
 1116+ function tableExists( $table, $schema = false ) {
 1117+ return $this->relationExists( $table, array( 'r', 'v' ), $schema );
11181118 }
11191119
1120 - function sequenceExists ($sequence, $schema = false) {
1121 - return $this->relationExists($sequence, 'S', $schema);
 1120+ function sequenceExists( $sequence, $schema = false ) {
 1121+ return $this->relationExists( $sequence, 'S', $schema );
11221122 }
11231123
1124 - function triggerExists($table, $trigger) {
 1124+ function triggerExists( $table, $trigger ) {
11251125 global $wgDBmwschema;
11261126
11271127 $q = <<<END
@@ -1136,20 +1136,20 @@
11371137 if (!$res)
11381138 return NULL;
11391139 $rows = $res->numRows();
1140 - $this->freeResult($res);
 1140+ $this->freeResult( $res );
11411141 return $rows;
11421142 }
11431143
1144 - function ruleExists($table, $rule) {
 1144+ function ruleExists( $table, $rule ) {
11451145 global $wgDBmwschema;
11461146 $exists = $this->selectField("pg_rules", "rulename",
11471147 array( "rulename" => $rule,
11481148 "tablename" => $table,
1149 - "schemaname" => $wgDBmwschema));
 1149+ "schemaname" => $wgDBmwschema ) );
11501150 return $exists === $rule;
11511151 }
11521152
1153 - function constraintExists($table, $constraint) {
 1153+ function constraintExists( $table, $constraint ) {
11541154 global $wgDBmwschema;
11551155 $SQL = sprintf("SELECT 1 FROM information_schema.table_constraints ".
11561156 "WHERE constraint_schema = %s AND table_name = %s AND constraint_name = %s",
@@ -1228,7 +1228,7 @@
12291229 }
12301230
12311231 /* Not even sure why this is used in the main codebase... */
1232 - function limitResultForUpdate($sql, $num) {
 1232+ function limitResultForUpdate( $sql, $num ) {
12331233 return $sql;
12341234 }
12351235

Status & tagging log