persistentstorage/sql/SQLite/pager.c
changeset 41 3256212fc81f
parent 17 55f2396f6d25
--- a/persistentstorage/sql/SQLite/pager.c	Tue Jul 06 16:18:30 2010 +0300
+++ b/persistentstorage/sql/SQLite/pager.c	Wed Aug 18 11:30:17 2010 +0300
@@ -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