Fixed duplicateTableStructure() for SQLite, it previously didn't copy row properties...
authorMax Semenik <maxsem@users.mediawiki.org>
Sun, 6 Dec 2009 11:09:39 +0000 (11:09 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Sun, 6 Dec 2009 11:09:39 +0000 (11:09 +0000)
RELEASE-NOTES
includes/db/DatabaseSqlite.php

index e050a63..af9b472 100644 (file)
@@ -668,6 +668,7 @@ Hopefully we will remove this configuration var soon)
   the page selector when they have only one page
 * (bug 21559) "logempty" message is now wrapped in a div with class
   "mw-warning-logempty" when used in log extract
+* (bug 20549) Parser tests were broken on SQLite backend
 
 == API changes in 1.16 ==
 
index bab37cd..745bc71 100644 (file)
@@ -521,7 +521,10 @@ class DatabaseSqlite extends DatabaseBase {
        }
 
        function duplicateTableStructure( $oldName, $newName, $temporary = false, $fname = 'DatabaseSqlite::duplicateTableStructure' ) {
-               return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' : '' ) . " TABLE $newName AS SELECT * FROM $oldName LIMIT 0", $fname );
+               $res = $this->query( "SELECT sql FROM sqlite_master WHERE tbl_name='$oldName' AND type='table'", $fname );
+               $sql = $this->fetchObject( $res )->sql;
+               $sql = preg_replace( '/\b' . preg_quote( $oldName ) . '\b/', $newName, $sql, 1 );
+               return $this->query( $sql, $fname );
        }
 
 } // end DatabaseSqlite class