persistentstorage/sql/SQLite/pager.c
branchRCL_3
changeset 21 28839de615b4
parent 0 08ec8eefde2f
equal deleted inserted replaced
18:3da531bb4329 21:28839de615b4
  3060   pList = sort_pagelist(pList);
  3060   pList = sort_pagelist(pList);
  3061   for(p=pList; p; p=p->pDirty){
  3061   for(p=pList; p; p=p->pDirty){
  3062     assert( p->dirty );
  3062     assert( p->dirty );
  3063     p->dirty = 0;
  3063     p->dirty = 0;
  3064   }
  3064   }
       
  3065 
       
  3066   /* If the file has not yet been opened, open it now. */
       
  3067   if( !pPager->fd->pMethods ){
       
  3068     assert(pPager->tempFile);
       
  3069 	rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
       
  3070 	if( rc ) return rc;
       
  3071   }
       
  3072 
  3065   while( pList ){
  3073   while( pList ){
  3066 
       
  3067     /* If the file has not yet been opened, open it now. */
       
  3068     if( !pPager->fd->pMethods ){
       
  3069       assert(pPager->tempFile);
       
  3070       rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
       
  3071       if( rc ) return rc;
       
  3072     }
       
  3073 
       
  3074     /* If there are dirty pages in the page cache with page numbers greater
  3074     /* If there are dirty pages in the page cache with page numbers greater
  3075     ** than Pager.dbSize, this means sqlite3PagerTruncate() was called to
  3075     ** than Pager.dbSize, this means sqlite3PagerTruncate() was called to
  3076     ** make the file smaller (presumably by auto-vacuum code). Do not write
  3076     ** make the file smaller (presumably by auto-vacuum code). Do not write
  3077     ** any such pages to the file.
  3077     ** any such pages to the file.
  3078     */
  3078     */
  3653   if( pPager->nPage<pPager->mxPage
  3653   if( pPager->nPage<pPager->mxPage
  3654    || pPager->lru.pFirst==0 
  3654    || pPager->lru.pFirst==0 
  3655    || MEMDB
  3655    || MEMDB
  3656    || (pPager->lru.pFirstSynced==0 && pPager->doNotSync)
  3656    || (pPager->lru.pFirstSynced==0 && pPager->doNotSync)
  3657   ){
  3657   ){
  3658     void *pData;
  3658     void *pData = 0;                   /* Initialized to placate warning */
  3659     if( pPager->nPage>=pPager->nHash ){
  3659     if( pPager->nPage>=pPager->nHash ){
  3660       pager_resize_hash_table(pPager,
  3660       pager_resize_hash_table(pPager,
  3661          pPager->nHash<256 ? 256 : pPager->nHash*2);
  3661          pPager->nHash<256 ? 256 : pPager->nHash*2);
  3662       if( pPager->nHash==0 ){
  3662       if( pPager->nHash==0 ){
  3663         rc = SQLITE_NOMEM;
  3663         rc = SQLITE_NOMEM;