diff options
author | Brion Vibber <brion@users.mediawiki.org> | 2004-09-07 08:37:50 +0000 |
---|---|---|
committer | Brion Vibber <brion@users.mediawiki.org> | 2004-09-07 08:37:50 +0000 |
commit | 631eda22a1e873ea7c91c58d68df072ff66d2f54 (patch) | |
tree | 5b9a2c9b8607d345e85b2ec4245dc3c3decbf9c9 /includes/DatabasePostgreSQL.php | |
parent | cbfdfb60dd6cee5bc37f8d6e98cf5cd8dbd20a8c (diff) | |
download | mediawikicore-631eda22a1e873ea7c91c58d68df072ff66d2f54.tar.gz mediawikicore-631eda22a1e873ea7c91c58d68df072ff66d2f54.zip |
replace fixes:
* use array_keys() instead of array_flip() to get the keys, since the latter fails with NULL data
* where there is a single-column unique index, don't forget the initial paren since it's going to get closed [fix for <math> rendering]
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/5147
Diffstat (limited to 'includes/DatabasePostgreSQL.php')
-rw-r--r-- | includes/DatabasePostgreSQL.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 4f437fea95fc..b3e74ec2f699 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -289,12 +289,12 @@ class DatabasePgsql extends Database { foreach ( $uniqueIndexes as $index ) { if ( $first ) { $first = false; + $sql .= "("; } else { $sql .= ') OR ('; } if ( is_array( $index ) ) { $first2 = true; - $sql .= "("; foreach ( $index as $col ) { if ( $first2 ) { $first2 = false; @@ -303,16 +303,16 @@ class DatabasePgsql extends Database { } $sql .= $col.'=' . $this->addQuotes( $row[$col] ); } - } else { + } else { $sql .= $index.'=' . $this->addQuotes( $row[$index] ); - } + } } $sql .= ')'; $this->query( $sql, $fname ); } # Now insert the row - $sql = "INSERT INTO $table (" . $this->makeList( array_flip( $row ), LIST_NAMES ) .') VALUES (' . + $sql = "INSERT INTO $table (" . $this->makeList( array_keys( $row ), LIST_NAMES ) .') VALUES (' . $this->makeList( $row, LIST_COMMA ) . ')'; $this->query( $sql, $fname ); } |