~ubuntu-branches/ubuntu/maverick/sqlite3/maverick-updates

« back to all changes in this revision

Viewing changes to src/vdbeaux.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-05-31 16:28:06 UTC
  • mfrom: (9.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090531162806-583oaj2nn948jxkc
Tags: 3.6.14.2-1
* New upstream release. Disable ICU support, it causes more trouble than
  good.
* Add 20-hurd-locking-style.patch for proper locking on Hurd
  (closes: #529734).

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
** to version 2.8.7, all this code was combined into the vdbe.c source file.
15
15
** But that file was getting too big so this subroutines were split out.
16
16
**
17
 
** $Id: vdbeaux.c,v 1.451 2009/04/10 15:42:36 shane Exp $
 
17
** $Id: vdbeaux.c,v 1.457 2009/05/06 18:57:10 shane Exp $
18
18
*/
19
19
#include "sqliteInt.h"
20
20
#include "vdbeInt.h"
730
730
*/
731
731
void sqlite3VdbeUsesBtree(Vdbe *p, int i){
732
732
  int mask;
733
 
  assert( i>=0 && i<p->db->nDb );
 
733
  assert( i>=0 && i<p->db->nDb && i<sizeof(u32)*8 );
734
734
  assert( i<(int)sizeof(p->btreeMask)*8 );
735
 
  mask = 1<<i;
 
735
  mask = ((u32)1)<<i;
736
736
  if( (p->btreeMask & mask)==0 ){
737
737
    p->btreeMask |= mask;
738
738
    sqlite3BtreeMutexArrayInsert(&p->aMutex, p->db->aDb[i].pBt);
1940
1940
  int i;
1941
1941
  for(i=0; i<pVdbeFunc->nAux; i++){
1942
1942
    struct AuxData *pAux = &pVdbeFunc->apAux[i];
1943
 
    if( (i>31 || !(mask&(1<<i))) && pAux->pAux ){
 
1943
    if( (i>31 || !(mask&(((u32)1)<<i))) && pAux->pAux ){
1944
1944
      if( pAux->xDelete ){
1945
1945
        pAux->xDelete(pAux->pAux);
1946
1946
      }
2002
2002
    rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res);
2003
2003
    if( rc ) return rc;
2004
2004
    p->lastRowid = keyToInt(p->movetoTarget);
2005
 
    p->rowidIsValid = res==0 ?1:0;
2006
 
    if( res<0 ){
 
2005
    p->rowidIsValid = ALWAYS(res==0) ?1:0;
 
2006
    if( NEVER(res<0) ){
2007
2007
      rc = sqlite3BtreeNext(p->pCursor, &res);
2008
2008
      if( rc ) return rc;
2009
2009
    }
2466
2466
  mem1.enc = pKeyInfo->enc;
2467
2467
  mem1.db = pKeyInfo->db;
2468
2468
  mem1.flags = 0;
 
2469
  mem1.u.i = 0;  /* not needed, here to silence compiler warning */
2469
2470
  mem1.zMalloc = 0;
2470
2471
  
2471
2472
  idx1 = getVarint32(aKey1, szHdr1);
2496
2497
  }
2497
2498
  if( mem1.zMalloc ) sqlite3VdbeMemRelease(&mem1);
2498
2499
 
 
2500
  /* If the PREFIX_SEARCH flag is set and all fields except the final
 
2501
  ** rowid field were equal, then clear the PREFIX_SEARCH flag and set 
 
2502
  ** pPKey2->rowid to the value of the rowid field in (pKey1, nKey1).
 
2503
  ** This is used by the OP_IsUnique opcode.
 
2504
  */
 
2505
  if( (pPKey2->flags & UNPACKED_PREFIX_SEARCH) && i==(pPKey2->nField-1) ){
 
2506
    assert( idx1==szHdr1 && rc );
 
2507
    assert( mem1.flags & MEM_Int );
 
2508
    pPKey2->flags &= ~UNPACKED_PREFIX_SEARCH;
 
2509
    pPKey2->rowid = mem1.u.i;
 
2510
  }
 
2511
 
2499
2512
  if( rc==0 ){
2500
2513
    /* rc==0 here means that one of the keys ran out of fields and
2501
2514
    ** all the fields up to that point were equal. If the UNPACKED_INCRKEY