SQLite4
Check-in [b5ceafc26f]
Not logged in

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

Overview
Comment:Add the kvreplace(K,V) pragma for use in testing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b5ceafc26fd265519efd4690b93e7602044befb1
User & Date: drh 2013-07-25 23:26:34
Context
2013-07-26
15:30
Add decoder logic to facilitate extracting column values from the key of a key/value pair for a row. check-in: 30167422e4 user: drh tags: trunk
2013-07-25
23:26
Add the kvreplace(K,V) pragma for use in testing. check-in: b5ceafc26f user: drh tags: trunk
20:02
Partially reenable automatic indexes. Six legacy tests cases in autoindex1.test are still failing as of this commit. check-in: 2244abfac2 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
633
634
635
636
637
638
639





























640

641
642
643
644
645
646
647
    }else{
      goto pragma_out;
    }
  }

  pParse->nMem = 2;
  sqlite4VdbeRunOnlyOnce(v);
  if( pList && pList->nExpr>1 ) goto pragma_out;
  zRight = 0;
  if( pList ){
    zRight = pList->a[0].zSpan;
    if( zRight==0 ){ 
      assert( pList->a[0].pExpr->op==TK_ID );
      zRight = pList->a[0].pExpr->u.zToken; 
    }
................................................................................
  **   PRAGMA kvdump
  **
  ** Print an ascii rendering of the complete content of the database file.
  */
  if( sqlite4_stricmp(zPragma, "kvdump")==0 ){
    sqlite4KVStoreDump(db->aDb[0].pKV);
  }else





























#endif /* SQLITE4_OMIT_COMPILEOPTION_DIAGS */

  /*
  **   PRAGMA integrity_check
  **
  ** Check that for each table, the content of any auxilliary indexes are 
  ** consistent with the primary key index.
  */
  if( sqlite4_stricmp(zPragma, "integrity_check")==0 ){







<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>







238
239
240
241
242
243
244

245
246
247
248
249
250
251
...
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
    }else{
      goto pragma_out;
    }
  }

  pParse->nMem = 2;
  sqlite4VdbeRunOnlyOnce(v);

  zRight = 0;
  if( pList ){
    zRight = pList->a[0].zSpan;
    if( zRight==0 ){ 
      assert( pList->a[0].pExpr->op==TK_ID );
      zRight = pList->a[0].pExpr->u.zToken; 
    }
................................................................................
  **   PRAGMA kvdump
  **
  ** Print an ascii rendering of the complete content of the database file.
  */
  if( sqlite4_stricmp(zPragma, "kvdump")==0 ){
    sqlite4KVStoreDump(db->aDb[0].pKV);
  }else

  /*
  **   PRAGMA kvreplace(BLOB,BLOB)
  **
  ** Insert or replace a single raw record into the KV store.  This pragma
  ** is exceedingly dangerous and should not be used by general-purpose
  ** applications.  It is intended for internal testing only - to provide
  ** a convenient way to insert arbitrary content into the key/value store.
  */
  if( sqlite4_stricmp(zPragma, "kvreplace")==0
   && pList->nExpr==2
  ){
    int r1, r2;
    Vdbe *v = sqlite4GetVdbe(pParse);
    pParse->nTab = 1;
    pParse->nMem = 3;
    sqlite4BeginWriteOperation(pParse, 0, iDb);
    r1 = sqlite4ExprCodeTarget(pParse, pList->a[0].pExpr, 1);
    sqlite4VdbeAddOp4(v, OP_HaltIfNull, SQLITE4_CONSTRAINT, OE_Abort,
                         r1, "key may not be null", SQLITE4_STATIC);
    sqlite4VdbeAddOp1(v, OP_ToBlob, r1);
    r2 = sqlite4ExprCodeTarget(pParse, pList->a[1].pExpr, 2);
    sqlite4VdbeAddOp4(v, OP_HaltIfNull, SQLITE4_CONSTRAINT, OE_Abort,
                         r2, "value may not be null", SQLITE4_STATIC);
    sqlite4VdbeAddOp1(v, OP_ToBlob, r2);
    sqlite4VdbeAddOp0(v, OP_OpenWrite);
    sqlite4VdbeAddOp3(v, OP_IdxInsert, 0, r2, r1);
    sqlite4VdbeAddOp0(v, OP_Halt);
  }else
#endif /* SQLITE4_DEBUG

  /*
  **   PRAGMA integrity_check
  **
  ** Check that for each table, the content of any auxilliary indexes are 
  ** consistent with the primary key index.
  */
  if( sqlite4_stricmp(zPragma, "integrity_check")==0 ){