Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -689,7 +689,7 @@ |
690 | 690 | * Takes same arguments as Database::select() |
691 | 691 | */ |
692 | 692 | |
693 | | - function estimateRowCount( $table, $vars='*', $conds='', $fname = 'Database::estimateRowCount', $options = array() ) { |
| 693 | + function estimateRowCount( $table, $vars='*', $conds='', $fname = 'DatabasePostgres::estimateRowCount', $options = array() ) { |
694 | 694 | $options['EXPLAIN'] = true; |
695 | 695 | $res = $this->select( $table, $vars, $conds, $fname, $options ); |
696 | 696 | $rows = -1; |
— | — | @@ -709,7 +709,7 @@ |
710 | 710 | * Returns information about an index |
711 | 711 | * If errors are explicitly ignored, returns NULL on failure |
712 | 712 | */ |
713 | | - function indexInfo( $table, $index, $fname = 'Database::indexExists' ) { |
| 713 | + function indexInfo( $table, $index, $fname = 'DatabasePostgres::indexInfo' ) { |
714 | 714 | $sql = "SELECT indexname FROM pg_indexes WHERE tablename='$table'"; |
715 | 715 | $res = $this->query( $sql, $fname ); |
716 | 716 | if ( !$res ) { |
— | — | @@ -723,7 +723,7 @@ |
724 | 724 | return false; |
725 | 725 | } |
726 | 726 | |
727 | | - function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) { |
| 727 | + function indexUnique ($table, $index, $fname = 'DatabasePostgres::indexUnique' ) { |
728 | 728 | $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'". |
729 | 729 | " AND indexdef LIKE 'CREATE UNIQUE%(" . |
730 | 730 | $this->strencode( $this->indexName( $index ) ) . |
— | — | @@ -925,7 +925,7 @@ |
926 | 926 | # It may be more efficient to leave off unique indexes which are unlikely to collide. |
927 | 927 | # However if you do this, you run the risk of encountering errors which wouldn't have |
928 | 928 | # occurred in MySQL |
929 | | - function replace( $table, $uniqueIndexes, $rows, $fname = 'Database::replace' ) { |
| 929 | + function replace( $table, $uniqueIndexes, $rows, $fname = 'DatabasePostgres::replace' ) { |
930 | 930 | $table = $this->tableName( $table ); |
931 | 931 | |
932 | 932 | if (count($rows)==0) { |
— | — | @@ -975,7 +975,7 @@ |
976 | 976 | } |
977 | 977 | |
978 | 978 | # 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' ) { |
980 | 980 | if ( !$conds ) { |
981 | 981 | throw new DBUnexpectedError($this, 'Database::deleteJoin() called with empty $conds' ); |
982 | 982 | } |
— | — | @@ -1092,12 +1092,12 @@ |
1093 | 1093 | */ |
1094 | 1094 | function relationExists( $table, $types, $schema = false ) { |
1095 | 1095 | 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 ) |
1099 | 1099 | $schema = $wgDBmwschema; |
1100 | | - $etable = $this->addQuotes($table); |
1101 | | - $eschema = $this->addQuotes($schema); |
| 1100 | + $etable = $this->addQuotes( $table ); |
| 1101 | + $eschema = $this->addQuotes( $schema ); |
1102 | 1102 | $SQL = "SELECT 1 FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n " |
1103 | 1103 | . "WHERE c.relnamespace = n.oid AND c.relname = $etable AND n.nspname = $eschema " |
1104 | 1104 | . "AND c.relkind IN ('" . implode("','", $types) . "')"; |
— | — | @@ -1112,15 +1112,15 @@ |
1113 | 1113 | * For backward compatibility, this function checks both tables and |
1114 | 1114 | * views. |
1115 | 1115 | */ |
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 ); |
1118 | 1118 | } |
1119 | 1119 | |
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 ); |
1122 | 1122 | } |
1123 | 1123 | |
1124 | | - function triggerExists($table, $trigger) { |
| 1124 | + function triggerExists( $table, $trigger ) { |
1125 | 1125 | global $wgDBmwschema; |
1126 | 1126 | |
1127 | 1127 | $q = <<<END |
— | — | @@ -1136,20 +1136,20 @@ |
1137 | 1137 | if (!$res) |
1138 | 1138 | return NULL; |
1139 | 1139 | $rows = $res->numRows(); |
1140 | | - $this->freeResult($res); |
| 1140 | + $this->freeResult( $res ); |
1141 | 1141 | return $rows; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | | - function ruleExists($table, $rule) { |
| 1144 | + function ruleExists( $table, $rule ) { |
1145 | 1145 | global $wgDBmwschema; |
1146 | 1146 | $exists = $this->selectField("pg_rules", "rulename", |
1147 | 1147 | array( "rulename" => $rule, |
1148 | 1148 | "tablename" => $table, |
1149 | | - "schemaname" => $wgDBmwschema)); |
| 1149 | + "schemaname" => $wgDBmwschema ) ); |
1150 | 1150 | return $exists === $rule; |
1151 | 1151 | } |
1152 | 1152 | |
1153 | | - function constraintExists($table, $constraint) { |
| 1153 | + function constraintExists( $table, $constraint ) { |
1154 | 1154 | global $wgDBmwschema; |
1155 | 1155 | $SQL = sprintf("SELECT 1 FROM information_schema.table_constraints ". |
1156 | 1156 | "WHERE constraint_schema = %s AND table_name = %s AND constraint_name = %s", |
— | — | @@ -1228,7 +1228,7 @@ |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | /* Not even sure why this is used in the main codebase... */ |
1232 | | - function limitResultForUpdate($sql, $num) { |
| 1232 | + function limitResultForUpdate( $sql, $num ) { |
1233 | 1233 | return $sql; |
1234 | 1234 | } |
1235 | 1235 | |