Test that the binary record "0x01 0x00" is interpreted by OP_Column as a vector of NULL (or default) values.
FossilOrigin-Name: 5bdc3c82bd10f924c12568eb0fa7a07393fc864f
This commit is contained in:
parent
2b4e95226c
commit
6b513640c0
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
|||||||
C Remove\san\sunused\s#define\sfrom\swhereInt.h.\sAdd\scomments\sdescribing\sthe\snew\ssqlite3BtreeCursor()\sflags.
|
C Test\sthat\sthe\sbinary\srecord\s"0x01\s0x00"\sis\sinterpreted\sby\sOP_Column\sas\sa\svector\sof\sNULL\s(or\sdefault)\svalues.
|
||||||
D 2015-10-23T11:50:23.745
|
D 2015-10-26T16:31:18.909
|
||||||
F Makefile.in 2ea961bc09e441874eb3d1bf7398e04feb24f3ee
|
F Makefile.in 2ea961bc09e441874eb3d1bf7398e04feb24f3ee
|
||||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||||
F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4
|
F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4
|
||||||
@ -350,7 +350,7 @@ F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
|||||||
F src/tclsqlite.c d9439b6a910985b7fff43ba6756bcef00de22649
|
F src/tclsqlite.c d9439b6a910985b7fff43ba6756bcef00de22649
|
||||||
F src/test1.c 8fff9c5aa63d6490f516d018b70c12a9cb9a4d8a
|
F src/test1.c 8fff9c5aa63d6490f516d018b70c12a9cb9a4d8a
|
||||||
F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d
|
F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d
|
||||||
F src/test3.c 11b13d561846e5d1ffd29653be340d2f4b59a723
|
F src/test3.c 5d5e771bee407b2a8bee1602228eca167f8f649a
|
||||||
F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e
|
F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e
|
||||||
F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1
|
F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1
|
||||||
F src/test6.c 41cacf3b0dd180823919bf9e1fbab287c9266723
|
F src/test6.c 41cacf3b0dd180823919bf9e1fbab287c9266723
|
||||||
@ -628,7 +628,7 @@ F test/fkey6.test abb59f866c1b44926fd02d1fdd217d831fe04f48
|
|||||||
F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13
|
F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13
|
||||||
F test/fkey8.test 8f08203458321e6c19a263829de4cfc936274ab0
|
F test/fkey8.test 8f08203458321e6c19a263829de4cfc936274ab0
|
||||||
F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749
|
F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749
|
||||||
F test/fordelete.test a30de567eb69a377e0c3ab1a8be4d74588de2a33
|
F test/fordelete.test ba12ec1d27cc34a4c23db4446029126d773f3849
|
||||||
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
|
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
|
||||||
F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c
|
F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c
|
||||||
F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
|
F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
|
||||||
@ -1392,7 +1392,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P cdc92919e600007cae5eb61223684f48a65babc0
|
P 4c0ba8be43bb7c7100456bd8cd6921c164be31e1
|
||||||
R 372ed0826353f0987c018dd56c7ed9e6
|
R 034dc33437dfb21294c759656e936af8
|
||||||
U dan
|
U dan
|
||||||
Z 7d97368360f9df42d106befc4db01e49
|
Z d7a6f95ed6a65ff4ab5499c664dec3c3
|
||||||
|
@ -1 +1 @@
|
|||||||
4c0ba8be43bb7c7100456bd8cd6921c164be31e1
|
5bdc3c82bd10f924c12568eb0fa7a07393fc864f
|
49
src/test3.c
49
src/test3.c
@ -219,7 +219,7 @@ static int btree_cursor(
|
|||||||
memset(pCur, 0, sqlite3BtreeCursorSize());
|
memset(pCur, 0, sqlite3BtreeCursorSize());
|
||||||
sqlite3BtreeEnter(pBt);
|
sqlite3BtreeEnter(pBt);
|
||||||
#ifndef SQLITE_OMIT_SHARED_CACHE
|
#ifndef SQLITE_OMIT_SHARED_CACHE
|
||||||
rc = sqlite3BtreeLockTable(pBt, iTable, wrFlag);
|
rc = sqlite3BtreeLockTable(pBt, iTable, !!wrFlag);
|
||||||
#endif
|
#endif
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
rc = sqlite3BtreeCursor(pBt, iTable, wrFlag, 0, pCur);
|
rc = sqlite3BtreeCursor(pBt, iTable, wrFlag, 0, pCur);
|
||||||
@ -599,6 +599,51 @@ static int btree_set_cache_size(
|
|||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** usage: btree_insert CSR ?KEY? VALUE
|
||||||
|
**
|
||||||
|
** Set the size of the cache used by btree $ID.
|
||||||
|
*/
|
||||||
|
static int btree_insert(
|
||||||
|
ClientData clientData,
|
||||||
|
Tcl_Interp *interp,
|
||||||
|
int objc,
|
||||||
|
Tcl_Obj *const objv[]
|
||||||
|
){
|
||||||
|
BtCursor *pCur;
|
||||||
|
int rc;
|
||||||
|
int bIntkey = 0;
|
||||||
|
void *pKey = 0;
|
||||||
|
int nKey = 0;
|
||||||
|
void *pData = 0;
|
||||||
|
int nData = 0;
|
||||||
|
|
||||||
|
if( objc!=4 && objc!=3 ){
|
||||||
|
Tcl_WrongNumArgs(interp, 1, objv, "?-intkey? CSR KEY VALUE");
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( objc==4 ){
|
||||||
|
if( Tcl_GetIntFromObj(interp, objv[2], &nKey) ) return TCL_ERROR;
|
||||||
|
pData = (void*)Tcl_GetByteArrayFromObj(objv[3], &nData);
|
||||||
|
}else{
|
||||||
|
pKey = (void*)Tcl_GetByteArrayFromObj(objv[2], &nKey);
|
||||||
|
}
|
||||||
|
pCur = (BtCursor*)sqlite3TestTextToPtr(Tcl_GetString(objv[1]));
|
||||||
|
|
||||||
|
sqlite3BtreeEnter(pCur->pBtree);
|
||||||
|
if( rc==SQLITE_OK ){
|
||||||
|
rc = sqlite3BtreeInsert(pCur, pKey, nKey, pData, nData, 0, 0, 0);
|
||||||
|
}
|
||||||
|
sqlite3BtreeLeave(pCur->pBtree);
|
||||||
|
|
||||||
|
Tcl_ResetResult(interp);
|
||||||
|
if( rc ){
|
||||||
|
Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
return TCL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -630,5 +675,7 @@ int Sqlitetest3_Init(Tcl_Interp *interp){
|
|||||||
Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
|
Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tcl_CreateObjCommand(interp, "btree_insert", btree_insert, 0, 0);
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
@ -76,5 +76,55 @@ foreach {tn sql res} {
|
|||||||
} {
|
} {
|
||||||
do_adp_test 2.$tn $sql $res
|
do_adp_test 2.$tn $sql $res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# Test that a record that consists of the bytes:
|
||||||
|
#
|
||||||
|
# 0x01 0x00
|
||||||
|
#
|
||||||
|
# is interpreted by OP_Column as a vector of NULL values (assuming the
|
||||||
|
# default column values are NULL). Also test that:
|
||||||
|
#
|
||||||
|
# 0x00
|
||||||
|
#
|
||||||
|
# is handled in the same way.
|
||||||
|
#
|
||||||
|
do_execsql_test 3.0 {
|
||||||
|
CREATE TABLE x1(a INTEGER PRIMARY KEY, b, c, d);
|
||||||
|
CREATE TABLE x2(a INTEGER PRIMARY KEY, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test 3.1 {
|
||||||
|
set root [db one { SELECT rootpage FROM sqlite_master WHERE name = 'x1' }]
|
||||||
|
db eval {
|
||||||
|
BEGIN IMMEDIATE;
|
||||||
|
}
|
||||||
|
set bt [btree_from_db db]
|
||||||
|
set csr [btree_cursor $bt $root 1]
|
||||||
|
btree_insert $csr 5 "\000"
|
||||||
|
btree_close_cursor $csr
|
||||||
|
db eval { COMMIT }
|
||||||
|
|
||||||
|
db eval {
|
||||||
|
SELECT * FROM x1;
|
||||||
|
}
|
||||||
|
} {5 {} {} {}}
|
||||||
|
|
||||||
|
do_test 3.2 {
|
||||||
|
set root [db one { SELECT rootpage FROM sqlite_master WHERE name = 'x2' }]
|
||||||
|
db eval {
|
||||||
|
BEGIN IMMEDIATE;
|
||||||
|
}
|
||||||
|
set bt [btree_from_db db]
|
||||||
|
set csr [btree_cursor $bt $root 1]
|
||||||
|
btree_insert $csr 6 "\000"
|
||||||
|
btree_close_cursor $csr
|
||||||
|
db eval { COMMIT }
|
||||||
|
|
||||||
|
db eval {
|
||||||
|
SELECT * FROM x2;
|
||||||
|
}
|
||||||
|
} {6 {} {} {}}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user