~ubuntu-branches/ubuntu/gutsy/php5/gutsy

« back to all changes in this revision

Viewing changes to ext/pdo_sqlite/sqlite/src/btree.c

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2007-06-11 20:32:54 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070611203254-b4k8nggrm5vxul1j
Tags: 5.2.3-1ubuntu1
* Merge from debian unstable, remaining changes:
 - debian/changelog: Add some missing CVEs.
 - debian/control: DebianMaintainerField
 - debian/control, debian/rules: Disable a few build dependencies and
   accompanying binary packages which we do not want to support in main:
   + firebird2-dev/php5-interbase (we have a separate php-interbase source)
   + libc-client-dev/php5-imap (we have a separate php-imap source)
   + libmcrypt-dev/php5-mcrypt (separate php-mcrypt source)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1870
1870
    if( memcmp(page1, zMagicHeader, 16)!=0 ){
1871
1871
      goto page1_init_failed;
1872
1872
    }
1873
 
    if( page1[18]>1 || page1[19]>1 ){
 
1873
    if( page1[18]>1 ){
 
1874
      pBt->readOnly = 1;
 
1875
    }
 
1876
    if( page1[19]>1 ){
1874
1877
      goto page1_init_failed;
1875
1878
    }
1876
1879
    pageSize = get2byte(&page1[16]);
2068
2071
    if( pBt->pPage1==0 ){
2069
2072
      rc = lockBtree(pBt);
2070
2073
    }
2071
 
  
 
2074
 
2072
2075
    if( rc==SQLITE_OK && wrflag ){
2073
 
      rc = sqlite3PagerBegin(pBt->pPage1->pDbPage, wrflag>1);
2074
 
      if( rc==SQLITE_OK ){
2075
 
        rc = newDatabase(pBt);
 
2076
      if( pBt->readOnly ){
 
2077
        rc = SQLITE_READONLY;
 
2078
      }else{
 
2079
        rc = sqlite3PagerBegin(pBt->pPage1->pDbPage, wrflag>1);
 
2080
        if( rc==SQLITE_OK ){
 
2081
          rc = newDatabase(pBt);
 
2082
        }
2076
2083
      }
2077
2084
    }
2078
2085
  
2782
2789
    if( rc!=SQLITE_OK ){
2783
2790
      return rc;
2784
2791
    }
 
2792
    if( pBt->readOnly && wrFlag ){
 
2793
      return SQLITE_READONLY;
 
2794
    }
2785
2795
  }
2786
2796
  pCur = sqliteMalloc( sizeof(*pCur) );
2787
2797
  if( pCur==0 ){
3519
3529
  int rc;
3520
3530
  MemPage *pPage;
3521
3531
 
3522
 
#ifndef SQLITE_OMIT_SHARED_CACHE
3523
3532
  rc = restoreOrClearCursorPosition(pCur);
3524
3533
  if( rc!=SQLITE_OK ){
3525
3534
    return rc;
3526
3535
  }
3527
 
#endif 
3528
3536
  assert( pRes!=0 );
3529
3537
  pPage = pCur->pPage;
3530
3538
  if( CURSOR_INVALID==pCur->eState ){
3531
3539
    *pRes = 1;
3532
3540
    return SQLITE_OK;
3533
3541
  }
3534
 
#ifndef SQLITE_OMIT_SHARED_CACHE
3535
3542
  if( pCur->skip>0 ){
3536
3543
    pCur->skip = 0;
3537
3544
    *pRes = 0;
3538
3545
    return SQLITE_OK;
3539
3546
  }
3540
3547
  pCur->skip = 0;
3541
 
#endif 
3542
3548
 
3543
3549
  assert( pPage->isInit );
3544
3550
  assert( pCur->idx<pPage->nCell );
3589
3595
  Pgno pgno;
3590
3596
  MemPage *pPage;
3591
3597
 
3592
 
#ifndef SQLITE_OMIT_SHARED_CACHE
3593
3598
  rc = restoreOrClearCursorPosition(pCur);
3594
3599
  if( rc!=SQLITE_OK ){
3595
3600
    return rc;
3596
3601
  }
3597
 
#endif
3598
3602
  if( CURSOR_INVALID==pCur->eState ){
3599
3603
    *pRes = 1;
3600
3604
    return SQLITE_OK;
3601
3605
  }
3602
 
#ifndef SQLITE_OMIT_SHARED_CACHE
3603
3606
  if( pCur->skip<0 ){
3604
3607
    pCur->skip = 0;
3605
3608
    *pRes = 0;
3606
3609
    return SQLITE_OK;
3607
3610
  }
3608
3611
  pCur->skip = 0;
3609
 
#endif
3610
3612
 
3611
3613
  pPage = pCur->pPage;
3612
3614
  assert( pPage->isInit );