persistentstorage/sql/SQLite/pager.c
changeset 31 ba1c4f4a893f
parent 17 55f2396f6d25
--- a/persistentstorage/sql/SQLite/pager.c	Thu Jul 01 17:02:22 2010 +0100
+++ b/persistentstorage/sql/SQLite/pager.c	Tue Jul 06 11:54:49 2010 +0100
@@ -3062,15 +3062,15 @@
     assert( p->dirty );
     p->dirty = 0;
   }
+
+  /* If the file has not yet been opened, open it now. */
+  if( !pPager->fd->pMethods ){
+    assert(pPager->tempFile);
+	rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
+	if( rc ) return rc;
+  }
+
   while( pList ){
-
-    /* If the file has not yet been opened, open it now. */
-    if( !pPager->fd->pMethods ){
-      assert(pPager->tempFile);
-      rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
-      if( rc ) return rc;
-    }
-
     /* If there are dirty pages in the page cache with page numbers greater
     ** than Pager.dbSize, this means sqlite3PagerTruncate() was called to
     ** make the file smaller (presumably by auto-vacuum code). Do not write