r59765 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59764‎ | r59765 | r59766 >
Date:11:09, 6 December 2009
Author:maxsem
Status:ok
Tags:
Comment:
Fixed duplicateTableStructure() for SQLite, it previously didn't copy row properties such as autoincrement. Resolves bug 20549 - parser tests now work with SQLite.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -521,7 +521,10 @@
522522 }
523523
524524 function duplicateTableStructure( $oldName, $newName, $temporary = false, $fname = 'DatabaseSqlite::duplicateTableStructure' ) {
525 - return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' : '' ) . " TABLE $newName AS SELECT * FROM $oldName LIMIT 0", $fname );
 525+ $res = $this->query( "SELECT sql FROM sqlite_master WHERE tbl_name='$oldName' AND type='table'", $fname );
 526+ $sql = $this->fetchObject( $res )->sql;
 527+ $sql = preg_replace( '/\b' . preg_quote( $oldName ) . '\b/', $newName, $sql, 1 );
 528+ return $this->query( $sql, $fname );
526529 }
527530
528531 } // end DatabaseSqlite class
Index: trunk/phase3/RELEASE-NOTES
@@ -668,6 +668,7 @@
669669 the page selector when they have only one page
670670 * (bug 21559) "logempty" message is now wrapped in a div with class
671671 "mw-warning-logempty" when used in log extract
 672+* (bug 20549) Parser tests were broken on SQLite backend
672673
673674 == API changes in 1.16 ==
674675

Status & tagging log