SQLite

Check-in [fa49666fb9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Simplifications and tweaks to vdbeaux.c resulting from structural testing. (CVS 6891)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fa49666fb913f0d82e84bdfa2af3a294be04e47c
User & Date: drh 2009-07-14 14:15:27.000
Context
2009-07-14
17:48
Simplifications to the PRAGMA integrity_check logic. Remove unreachable code. (CVS 6892) (check-in: 17749fa548 user: drh tags: trunk)
14:15
Simplifications and tweaks to vdbeaux.c resulting from structural testing. (CVS 6891) (check-in: fa49666fb9 user: drh tags: trunk)
02:33
Make sure the IN operator works with zeroblobs. Ticket #3965. Other simplifications associated with structural testing. (CVS 6890) (check-in: 25dd342283 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbeaux.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used for creating, destroying, and populating
** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)  Prior
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
** $Id: vdbeaux.c,v 1.472 2009/07/14 02:33:02 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"



/*







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used for creating, destroying, and populating
** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)  Prior
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
** $Id: vdbeaux.c,v 1.473 2009/07/14 14:15:27 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"



/*
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
  idx = getVarint32(aKey, szHdr);
  d = szHdr;
  u = 0;
  while( idx<szHdr && u<p->nField ){
    u32 serial_type;

    idx += getVarint32(&aKey[idx], serial_type);
    if( d>=nKey && sqlite3VdbeSerialTypeLen(serial_type)>0 ) break;
    pMem->enc = pKeyInfo->enc;
    pMem->db = pKeyInfo->db;
    pMem->flags = 0;
    pMem->zMalloc = 0;
    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
    pMem++;
    u++;







|







2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
  idx = getVarint32(aKey, szHdr);
  d = szHdr;
  u = 0;
  while( idx<szHdr && u<p->nField ){
    u32 serial_type;

    idx += getVarint32(&aKey[idx], serial_type);
    assert( d+sqlite3VdbeSerialTypeLen(serial_type) <= nKey );
    pMem->enc = pKeyInfo->enc;
    pMem->db = pKeyInfo->db;
    pMem->flags = 0;
    pMem->zMalloc = 0;
    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
    pMem++;
    u++;
2529
2530
2531
2532
2533
2534
2535


2536
2537
2538
2539
2540
2541
2542
2543
    rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i],
                           i<nField ? pKeyInfo->aColl[i] : 0);
    if( rc!=0 ){
      break;
    }
    i++;
  }


  if( mem1.zMalloc ) sqlite3VdbeMemRelease(&mem1);

  /* If the PREFIX_SEARCH flag is set and all fields except the final
  ** rowid field were equal, then clear the PREFIX_SEARCH flag and set 
  ** pPKey2->rowid to the value of the rowid field in (pKey1, nKey1).
  ** This is used by the OP_IsUnique opcode.
  */
  if( (pPKey2->flags & UNPACKED_PREFIX_SEARCH) && i==(pPKey2->nField-1) ){







>
>
|







2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
    rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i],
                           i<nField ? pKeyInfo->aColl[i] : 0);
    if( rc!=0 ){
      break;
    }
    i++;
  }

  /* No memory allocation is ever used on mem1. */
  if( NEVER(mem1.zMalloc) ) sqlite3VdbeMemRelease(&mem1);

  /* If the PREFIX_SEARCH flag is set and all fields except the final
  ** rowid field were equal, then clear the PREFIX_SEARCH flag and set 
  ** pPKey2->rowid to the value of the rowid field in (pKey1, nKey1).
  ** This is used by the OP_IsUnique opcode.
  */
  if( (pPKey2->flags & UNPACKED_PREFIX_SEARCH) && i==(pPKey2->nField-1) ){
2664
2665
2666
2667
2668
2669
2670


2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
){
  i64 nCellKey = 0;
  int rc;
  BtCursor *pCur = pC->pCursor;
  Mem m;

  sqlite3BtreeKeySize(pCur, &nCellKey);


  if( nCellKey<=0 || nCellKey>0x7fffffff ){
    *res = 0;
    return SQLITE_OK;
  }
  m.db = 0;
  m.flags = 0;
  m.zMalloc = 0;
  rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (int)nCellKey, 1, &m);
  if( rc ){
    return rc;







>
>
|

|







2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
){
  i64 nCellKey = 0;
  int rc;
  BtCursor *pCur = pC->pCursor;
  Mem m;

  sqlite3BtreeKeySize(pCur, &nCellKey);
  /* nCellKey will always be between 0 and 0xffffffff because of the say
  ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */
  if( NEVER(nCellKey<=0) || nCellKey>0x7fffffff ){
    *res = 0;
    return SQLITE_CORRUPT;
  }
  m.db = 0;
  m.flags = 0;
  m.zMalloc = 0;
  rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (int)nCellKey, 1, &m);
  if( rc ){
    return rc;