mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Merge updates from trunk.
FossilOrigin-Name: 59d1a3bb6050a812c4eb0d25ac53327081b9efed
This commit is contained in:
28
manifest
28
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Modify\sthe\s'mkvsix'\stool\sitself\sto\ssupport\sthe\sVisual\sStudio\s2015\sCTP.
|
C Merge\supdates\sfrom\strunk.
|
||||||
D 2015-04-19T23:39:05.488
|
D 2015-04-19T23:40:55.108
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in faaf75b89840659d74501bea269c7e33414761c1
|
F Makefile.in faaf75b89840659d74501bea269c7e33414761c1
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -176,13 +176,13 @@ F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
|||||||
F src/btree.c 127aceb71ba93f59bc9c6ba810e992a04299e98a
|
F src/btree.c 127aceb71ba93f59bc9c6ba810e992a04299e98a
|
||||||
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
|
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
|
||||||
F src/btreeInt.h 973a22a6fd61350b454ad614832b1f0a5e25a1e4
|
F src/btreeInt.h 973a22a6fd61350b454ad614832b1f0a5e25a1e4
|
||||||
F src/build.c 2d43ee768a3678eaeed203ba5b55490b970f0a5e
|
F src/build.c e246c2cea69c8f6fc825a156ea2de9dd4a17f18b
|
||||||
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
||||||
F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575
|
F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575
|
||||||
F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887
|
F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887
|
||||||
F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac
|
F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac
|
||||||
F src/delete.c 37964e6c1d73ff49cbea9ff690c9605fb15f600e
|
F src/delete.c 37964e6c1d73ff49cbea9ff690c9605fb15f600e
|
||||||
F src/expr.c 55e7ce8f7e6c98402365e253b277377fe567772a
|
F src/expr.c 25a732f30ba391dfb00bbdc9ec079056c2fbced5
|
||||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||||
F src/fkey.c 3343d551a8d810782257244fb33f2ce191493c39
|
F src/fkey.c 3343d551a8d810782257244fb33f2ce191493c39
|
||||||
F src/func.c 1414c24c873c48796ad45942257a179a423ba42f
|
F src/func.c 1414c24c873c48796ad45942257a179a423ba42f
|
||||||
@@ -190,7 +190,7 @@ F src/global.c 4f77cadbc5427d00139ba43d0f3979804cbb700e
|
|||||||
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
|
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
|
||||||
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
|
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
|
||||||
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
||||||
F src/insert.c f43325e75175e3ca325f164464bb6475e3653d6d
|
F src/insert.c 8176ba5bad8fcef643558ca5708f33ed05a4035a
|
||||||
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
||||||
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
|
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
|
||||||
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
|
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
|
||||||
@@ -235,7 +235,7 @@ F src/shell.c 78eabce4c16c45e36fea2368f95118116399ba8a
|
|||||||
F src/sqlite.h.in ca27603a36fcacdaac5a19d8ee35aaff8ce8516f
|
F src/sqlite.h.in ca27603a36fcacdaac5a19d8ee35aaff8ce8516f
|
||||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||||
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
|
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
|
||||||
F src/sqliteInt.h af228df2a02bf1a608d678b312d46aa480470b3c
|
F src/sqliteInt.h 3a1fccc2bb62ab16750730b6f6f24305e686a0ce
|
||||||
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
||||||
F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179
|
F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179
|
||||||
F src/table.c e7a09215315a978057fb42c640f890160dbcc45e
|
F src/table.c e7a09215315a978057fb42c640f890160dbcc45e
|
||||||
@@ -302,7 +302,7 @@ F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90
|
|||||||
F src/vdbemem.c c0dc81285b7571b0a31c40f17846fe2397ec1cd9
|
F src/vdbemem.c c0dc81285b7571b0a31c40f17846fe2397ec1cd9
|
||||||
F src/vdbesort.c 2e7f683464fd5db3be4beaa1ff2d39e24fcb64b8
|
F src/vdbesort.c 2e7f683464fd5db3be4beaa1ff2d39e24fcb64b8
|
||||||
F src/vdbetrace.c f95c2dff9041fcf07f871789c22ebb0648ea0b7c
|
F src/vdbetrace.c f95c2dff9041fcf07f871789c22ebb0648ea0b7c
|
||||||
F src/vtab.c be741af2a377bd894104d62504796e7394a04916
|
F src/vtab.c 5f81f8a59c1f5ddb94c918f25ed5d83578fcc633
|
||||||
F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
|
F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
|
||||||
F src/wal.c 753995db83247f20361a8e8a874990b21a75abd9
|
F src/wal.c 753995db83247f20361a8e8a874990b21a75abd9
|
||||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||||
@@ -666,7 +666,7 @@ F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
|
|||||||
F test/insert.test 38742b5e9601c8f8d76e9b7555f7270288c2d371
|
F test/insert.test 38742b5e9601c8f8d76e9b7555f7270288c2d371
|
||||||
F test/insert2.test 4f3a04d168c728ed5ec2c88842e772606c7ce435
|
F test/insert2.test 4f3a04d168c728ed5ec2c88842e772606c7ce435
|
||||||
F test/insert3.test 1b7db95a03ad9c5013fdf7d6722b6cd66ee55e30
|
F test/insert3.test 1b7db95a03ad9c5013fdf7d6722b6cd66ee55e30
|
||||||
F test/insert4.test 4791662c50518bdd37d394cae9a7a8014e845bb3
|
F test/insert4.test a20432f1c0fbbcff8f11d0e6ab4acb8c9db58023
|
||||||
F test/insert5.test 394f96728d1258f406fe5f5aeb0aaf29487c39a6
|
F test/insert5.test 394f96728d1258f406fe5f5aeb0aaf29487c39a6
|
||||||
F test/instr.test 737bbf80685232033f3abedc6ae92f75860b5dd2
|
F test/instr.test 737bbf80685232033f3abedc6ae92f75860b5dd2
|
||||||
F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4
|
F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4
|
||||||
@@ -743,11 +743,11 @@ F test/minmax.test 42fbad0e81afaa6e0de41c960329f2b2c3526efd
|
|||||||
F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc
|
F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc
|
||||||
F test/minmax3.test cc1e8b010136db0d01a6f2a29ba5a9f321034354
|
F test/minmax3.test cc1e8b010136db0d01a6f2a29ba5a9f321034354
|
||||||
F test/minmax4.test 936941484ebdceb8adec7c86b6cd9b6e5e897c1f
|
F test/minmax4.test 936941484ebdceb8adec7c86b6cd9b6e5e897c1f
|
||||||
F test/misc1.test 9abcae9a0b8785d6fa92925dbb19c309ae9ea077
|
F test/misc1.test 783ba75743b2cf71e0f646bf540a6cef57264811
|
||||||
F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d
|
F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d
|
||||||
F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
|
F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
|
||||||
F test/misc4.test 9c078510fbfff05a9869a0b6d8b86a623ad2c4f6
|
F test/misc4.test 9c078510fbfff05a9869a0b6d8b86a623ad2c4f6
|
||||||
F test/misc5.test 528468b26d03303b1f047146e5eefc941b9069f5
|
F test/misc5.test f96428ea95b3820aafc6f1c50cf48a09e4597ee1
|
||||||
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
||||||
F test/misc7.test edd0b63e2ee29a256900b0514f6fff27e19e9bb2
|
F test/misc7.test edd0b63e2ee29a256900b0514f6fff27e19e9bb2
|
||||||
F test/misc8.test fc2754d38892f7dac30c22db3616c2764f117d66
|
F test/misc8.test fc2754d38892f7dac30c22db3616c2764f117d66
|
||||||
@@ -1122,7 +1122,7 @@ F test/vtab6.test 5f5380c425e52993560ab4763db4f826d2ba7b09
|
|||||||
F test/vtab7.test ae560ebea870ed04e9aa4177cc302f910faaabb5
|
F test/vtab7.test ae560ebea870ed04e9aa4177cc302f910faaabb5
|
||||||
F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583
|
F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583
|
||||||
F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b
|
F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b
|
||||||
F test/vtabA.test c86e1990b7e1e2bb34602a06fffa4c69f2b516dc
|
F test/vtabA.test 1317f06a03597eee29f40a49b6c21e1aaba4285f
|
||||||
F test/vtabB.test 04df5dc531b9f44d9ca65b9c1b79f12b5922a796
|
F test/vtabB.test 04df5dc531b9f44d9ca65b9c1b79f12b5922a796
|
||||||
F test/vtabC.test 4528f459a13136f982e75614d120aef165f17292
|
F test/vtabC.test 4528f459a13136f982e75614d120aef165f17292
|
||||||
F test/vtabD.test 05b3f1d77117271671089e48719524b676842e96
|
F test/vtabD.test 05b3f1d77117271671089e48719524b676842e96
|
||||||
@@ -1251,7 +1251,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P d05becd873a03a366843a34e7f4c732dd8f88c86
|
P e0b7a191f3c22d9eacf645c58be59e0fdcb8860d c83052e48bbae0f45db2a44155b4e5482ee4a901
|
||||||
R bb1f1e19d70e43199cc9b8784e79ff68
|
R 82b5a61054e21833b8d835777835ac1a
|
||||||
U mistachkin
|
U mistachkin
|
||||||
Z 8dda7ece1b23ed740b28f121d2c5d713
|
Z eb6e9bb0494d4ea430c53bed9c33a7ce
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
e0b7a191f3c22d9eacf645c58be59e0fdcb8860d
|
59d1a3bb6050a812c4eb0d25ac53327081b9efed
|
||||||
@@ -927,7 +927,7 @@ void sqlite3StartTable(
|
|||||||
if( !noErr ){
|
if( !noErr ){
|
||||||
sqlite3ErrorMsg(pParse, "table %T already exists", pName);
|
sqlite3ErrorMsg(pParse, "table %T already exists", pName);
|
||||||
}else{
|
}else{
|
||||||
assert( !db->init.busy );
|
assert( !db->init.busy || CORRUPT_DB );
|
||||||
sqlite3CodeVerifySchema(pParse, iDb);
|
sqlite3CodeVerifySchema(pParse, iDb);
|
||||||
}
|
}
|
||||||
goto begin_table_error;
|
goto begin_table_error;
|
||||||
@@ -1216,7 +1216,8 @@ void sqlite3AddColumnType(Parse *pParse, Token *pType){
|
|||||||
p = pParse->pNewTable;
|
p = pParse->pNewTable;
|
||||||
if( p==0 || NEVER(p->nCol<1) ) return;
|
if( p==0 || NEVER(p->nCol<1) ) return;
|
||||||
pCol = &p->aCol[p->nCol-1];
|
pCol = &p->aCol[p->nCol-1];
|
||||||
assert( pCol->zType==0 );
|
assert( pCol->zType==0 || CORRUPT_DB );
|
||||||
|
sqlite3DbFree(pParse->db, pCol->zType);
|
||||||
pCol->zType = sqlite3NameFromToken(pParse->db, pType);
|
pCol->zType = sqlite3NameFromToken(pParse->db, pType);
|
||||||
pCol->affinity = sqlite3AffinityType(pCol->zType, &pCol->szEst);
|
pCol->affinity = sqlite3AffinityType(pCol->zType, &pCol->szEst);
|
||||||
}
|
}
|
||||||
@@ -2450,6 +2451,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){
|
|||||||
}
|
}
|
||||||
assert( pParse->nErr==0 );
|
assert( pParse->nErr==0 );
|
||||||
assert( pName->nSrc==1 );
|
assert( pName->nSrc==1 );
|
||||||
|
if( sqlite3ReadSchema(pParse) ) goto exit_drop_table;
|
||||||
if( noErr ) db->suppressErr++;
|
if( noErr ) db->suppressErr++;
|
||||||
pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]);
|
pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]);
|
||||||
if( noErr ) db->suppressErr--;
|
if( noErr ) db->suppressErr--;
|
||||||
|
|||||||
@@ -1251,7 +1251,8 @@ u32 sqlite3ExprListFlags(const ExprList *pList){
|
|||||||
u32 m = 0;
|
u32 m = 0;
|
||||||
if( pList ){
|
if( pList ){
|
||||||
for(i=0; i<pList->nExpr; i++){
|
for(i=0; i<pList->nExpr; i++){
|
||||||
m |= pList->a[i].pExpr->flags;
|
Expr *pExpr = pList->a[i].pExpr;
|
||||||
|
if( pExpr ) m |= pList->a[i].pExpr->flags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
|
|||||||
36
src/insert.c
36
src/insert.c
@@ -342,20 +342,23 @@ static int xferOptimization(
|
|||||||
/*
|
/*
|
||||||
** This routine is called to handle SQL of the following forms:
|
** This routine is called to handle SQL of the following forms:
|
||||||
**
|
**
|
||||||
** insert into TABLE (IDLIST) values(EXPRLIST)
|
** insert into TABLE (IDLIST) values(EXPRLIST),(EXPRLIST),...
|
||||||
** insert into TABLE (IDLIST) select
|
** insert into TABLE (IDLIST) select
|
||||||
|
** insert into TABLE (IDLIST) default values
|
||||||
**
|
**
|
||||||
** The IDLIST following the table name is always optional. If omitted,
|
** The IDLIST following the table name is always optional. If omitted,
|
||||||
** then a list of all columns for the table is substituted. The IDLIST
|
** then a list of all (non-hidden) columns for the table is substituted.
|
||||||
** appears in the pColumn parameter. pColumn is NULL if IDLIST is omitted.
|
** The IDLIST appears in the pColumn parameter. pColumn is NULL if IDLIST
|
||||||
|
** is omitted.
|
||||||
**
|
**
|
||||||
** The pList parameter holds EXPRLIST in the first form of the INSERT
|
** For the pSelect parameter holds the values to be inserted for the
|
||||||
** statement above, and pSelect is NULL. For the second form, pList is
|
** first two forms shown above. A VALUES clause is really just short-hand
|
||||||
** NULL and pSelect is a pointer to the select statement used to generate
|
** for a SELECT statement that omits the FROM clause and everything else
|
||||||
** data for the insert.
|
** that follows. If the pSelect parameter is NULL, that means that the
|
||||||
|
** DEFAULT VALUES form of the INSERT statement is intended.
|
||||||
**
|
**
|
||||||
** The code generated follows one of four templates. For a simple
|
** The code generated follows one of four templates. For a simple
|
||||||
** insert with data coming from a VALUES clause, the code executes
|
** insert with data coming from a single-row VALUES clause, the code executes
|
||||||
** once straight down through. Pseudo-code follows (we call this
|
** once straight down through. Pseudo-code follows (we call this
|
||||||
** the "1st template"):
|
** the "1st template"):
|
||||||
**
|
**
|
||||||
@@ -462,7 +465,7 @@ void sqlite3Insert(
|
|||||||
u8 useTempTable = 0; /* Store SELECT results in intermediate table */
|
u8 useTempTable = 0; /* Store SELECT results in intermediate table */
|
||||||
u8 appendFlag = 0; /* True if the insert is likely to be an append */
|
u8 appendFlag = 0; /* True if the insert is likely to be an append */
|
||||||
u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
|
u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
|
||||||
u8 bIdListInOrder = 1; /* True if IDLIST is in table order */
|
u8 bIdListInOrder; /* True if IDLIST is in table order */
|
||||||
ExprList *pList = 0; /* List of VALUES() to be inserted */
|
ExprList *pList = 0; /* List of VALUES() to be inserted */
|
||||||
|
|
||||||
/* Register allocations */
|
/* Register allocations */
|
||||||
@@ -487,8 +490,8 @@ void sqlite3Insert(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the Select object is really just a simple VALUES() list with a
|
/* If the Select object is really just a simple VALUES() list with a
|
||||||
** single row values (the common case) then keep that one row of values
|
** single row (the common case) then keep that one row of values
|
||||||
** and go ahead and discard the Select object
|
** and discard the other (unused) parts of the pSelect object
|
||||||
*/
|
*/
|
||||||
if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){
|
if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){
|
||||||
pList = pSelect->pEList;
|
pList = pSelect->pEList;
|
||||||
@@ -596,6 +599,7 @@ void sqlite3Insert(
|
|||||||
** is appears in the original table. (The index of the INTEGER
|
** is appears in the original table. (The index of the INTEGER
|
||||||
** PRIMARY KEY in the original table is pTab->iPKey.)
|
** PRIMARY KEY in the original table is pTab->iPKey.)
|
||||||
*/
|
*/
|
||||||
|
bIdListInOrder = (pTab->tabFlags & TF_OOOHidden)==0;
|
||||||
if( pColumn ){
|
if( pColumn ){
|
||||||
for(i=0; i<pColumn->nId; i++){
|
for(i=0; i<pColumn->nId; i++){
|
||||||
pColumn->a[i].idx = -1;
|
pColumn->a[i].idx = -1;
|
||||||
@@ -631,7 +635,8 @@ void sqlite3Insert(
|
|||||||
** co-routine is the common header to the 3rd and 4th templates.
|
** co-routine is the common header to the 3rd and 4th templates.
|
||||||
*/
|
*/
|
||||||
if( pSelect ){
|
if( pSelect ){
|
||||||
/* Data is coming from a SELECT. Generate a co-routine to run the SELECT */
|
/* Data is coming from a SELECT or from a multi-row VALUES clause.
|
||||||
|
** Generate a co-routine to run the SELECT. */
|
||||||
int regYield; /* Register holding co-routine entry-point */
|
int regYield; /* Register holding co-routine entry-point */
|
||||||
int addrTop; /* Top of the co-routine */
|
int addrTop; /* Top of the co-routine */
|
||||||
int rc; /* Result code */
|
int rc; /* Result code */
|
||||||
@@ -644,8 +649,7 @@ void sqlite3Insert(
|
|||||||
dest.nSdst = pTab->nCol;
|
dest.nSdst = pTab->nCol;
|
||||||
rc = sqlite3Select(pParse, pSelect, &dest);
|
rc = sqlite3Select(pParse, pSelect, &dest);
|
||||||
regFromSelect = dest.iSdst;
|
regFromSelect = dest.iSdst;
|
||||||
assert( pParse->nErr==0 || rc );
|
if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup;
|
||||||
if( rc || db->mallocFailed ) goto insert_cleanup;
|
|
||||||
sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield);
|
sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield);
|
||||||
sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */
|
sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */
|
||||||
assert( pSelect->pEList );
|
assert( pSelect->pEList );
|
||||||
@@ -693,8 +697,8 @@ void sqlite3Insert(
|
|||||||
sqlite3ReleaseTempReg(pParse, regTempRowid);
|
sqlite3ReleaseTempReg(pParse, regTempRowid);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
/* This is the case if the data for the INSERT is coming from a VALUES
|
/* This is the case if the data for the INSERT is coming from a
|
||||||
** clause
|
** single-row VALUES clause
|
||||||
*/
|
*/
|
||||||
NameContext sNC;
|
NameContext sNC;
|
||||||
memset(&sNC, 0, sizeof(sNC));
|
memset(&sNC, 0, sizeof(sNC));
|
||||||
|
|||||||
@@ -1622,6 +1622,12 @@ struct Table {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
** Allowed values for Table.tabFlags.
|
** Allowed values for Table.tabFlags.
|
||||||
|
**
|
||||||
|
** TF_OOOHidden applies to virtual tables that have hidden columns that are
|
||||||
|
** followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING
|
||||||
|
** vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden,
|
||||||
|
** the TF_OOOHidden attribute would apply in this case. Such tables require
|
||||||
|
** special handling during INSERT processing.
|
||||||
*/
|
*/
|
||||||
#define TF_Readonly 0x01 /* Read-only system table */
|
#define TF_Readonly 0x01 /* Read-only system table */
|
||||||
#define TF_Ephemeral 0x02 /* An ephemeral table */
|
#define TF_Ephemeral 0x02 /* An ephemeral table */
|
||||||
@@ -1629,6 +1635,7 @@ struct Table {
|
|||||||
#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
|
#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
|
||||||
#define TF_Virtual 0x10 /* Is a virtual table */
|
#define TF_Virtual 0x10 /* Is a virtual table */
|
||||||
#define TF_WithoutRowid 0x20 /* No rowid used. PRIMARY KEY is the key */
|
#define TF_WithoutRowid 0x20 /* No rowid used. PRIMARY KEY is the key */
|
||||||
|
#define TF_OOOHidden 0x40 /* Out-of-Order hidden columns */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
11
src/vtab.c
11
src/vtab.c
@@ -472,7 +472,7 @@ void sqlite3VtabArgExtend(Parse *pParse, Token *p){
|
|||||||
pArg->z = p->z;
|
pArg->z = p->z;
|
||||||
pArg->n = p->n;
|
pArg->n = p->n;
|
||||||
}else{
|
}else{
|
||||||
assert(pArg->z < p->z);
|
assert(pArg->z <= p->z);
|
||||||
pArg->n = (int)(&p->z[p->n] - pArg->z);
|
pArg->n = (int)(&p->z[p->n] - pArg->z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -559,6 +559,7 @@ static int vtabCallConstructor(
|
|||||||
rc = SQLITE_ERROR;
|
rc = SQLITE_ERROR;
|
||||||
}else{
|
}else{
|
||||||
int iCol;
|
int iCol;
|
||||||
|
u8 oooHidden = 0;
|
||||||
/* If everything went according to plan, link the new VTable structure
|
/* If everything went according to plan, link the new VTable structure
|
||||||
** into the linked list headed by pTab->pVTable. Then loop through the
|
** into the linked list headed by pTab->pVTable. Then loop through the
|
||||||
** columns of the table to see if any of them contain the token "hidden".
|
** columns of the table to see if any of them contain the token "hidden".
|
||||||
@@ -571,7 +572,10 @@ static int vtabCallConstructor(
|
|||||||
char *zType = pTab->aCol[iCol].zType;
|
char *zType = pTab->aCol[iCol].zType;
|
||||||
int nType;
|
int nType;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if( !zType ) continue;
|
if( !zType ){
|
||||||
|
pTab->tabFlags |= oooHidden;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
nType = sqlite3Strlen30(zType);
|
nType = sqlite3Strlen30(zType);
|
||||||
if( sqlite3StrNICmp("hidden", zType, 6)||(zType[6] && zType[6]!=' ') ){
|
if( sqlite3StrNICmp("hidden", zType, 6)||(zType[6] && zType[6]!=' ') ){
|
||||||
for(i=0; i<nType; i++){
|
for(i=0; i<nType; i++){
|
||||||
@@ -594,6 +598,9 @@ static int vtabCallConstructor(
|
|||||||
zType[i-1] = '\0';
|
zType[i-1] = '\0';
|
||||||
}
|
}
|
||||||
pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
|
pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
|
||||||
|
oooHidden = TF_OOOHidden;
|
||||||
|
}else{
|
||||||
|
pTab->tabFlags |= oooHidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,5 +560,10 @@ do_test insert4-8.25 {
|
|||||||
}
|
}
|
||||||
} {1 3}
|
} {1 3}
|
||||||
|
|
||||||
|
do_catchsql_test insert4-9.1 {
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
CREATE TABLE t1(x);
|
||||||
|
INSERT INTO t1(x) VALUES(5 COLLATE xyzzy) UNION SELECT 0;
|
||||||
|
} {1 {no such collation sequence: xyzzy}}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|||||||
@@ -644,4 +644,44 @@ do_execsql_test misc1-22.1 {
|
|||||||
SELECT ""+3 FROM (SELECT ""+5);
|
SELECT ""+3 FROM (SELECT ""+5);
|
||||||
} {3}
|
} {3}
|
||||||
|
|
||||||
|
# 2015-04-19: NULL pointer dereference on a corrupt schema
|
||||||
|
#
|
||||||
|
db close
|
||||||
|
sqlite3 db :memory:
|
||||||
|
do_execsql_test misc1-23.1 {
|
||||||
|
CREATE TABLE t1(x);
|
||||||
|
PRAGMA writable_schema=ON;
|
||||||
|
UPDATE sqlite_master SET sql='CREATE table t(d CHECK(T(#0)';
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE t2(y);
|
||||||
|
ROLLBACK;
|
||||||
|
DROP TABLE IF EXISTS t3;
|
||||||
|
} {}
|
||||||
|
|
||||||
|
# 2015-04-19: Faulty assert() statement
|
||||||
|
#
|
||||||
|
db close
|
||||||
|
database_may_be_corrupt
|
||||||
|
sqlite3 db :memory:
|
||||||
|
do_catchsql_test misc1-23.2 {
|
||||||
|
CREATE TABLE t1(x UNIQUE);
|
||||||
|
PRAGMA writable_schema=ON;
|
||||||
|
UPDATE sqlite_master SET sql='CREATE TABLE IF not EXISTS t(c)';
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE t2(x);
|
||||||
|
ROLLBACK;
|
||||||
|
DROP TABLE F;
|
||||||
|
} {1 {no such table: F}}
|
||||||
|
db close
|
||||||
|
sqlite3 db :memory:
|
||||||
|
do_catchsql_test misc1-23.3 {
|
||||||
|
CREATE TABLE t1(x UNIQUE);
|
||||||
|
PRAGMA writable_schema=ON;
|
||||||
|
UPDATE sqlite_master SET sql='CREATE table y(a TEXT, a TEXT)';
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE t2(y);
|
||||||
|
ROLLBACK;
|
||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
} {0 {}}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|||||||
@@ -583,6 +583,24 @@ do_test misc5-7.1 {
|
|||||||
catchsql $sql
|
catchsql $sql
|
||||||
} {1 {parser stack overflow}}
|
} {1 {parser stack overflow}}
|
||||||
|
|
||||||
|
# Parser stack overflow is silently ignored when it occurs while parsing the
|
||||||
|
# schema and PRAGMA writable_schema is turned on.
|
||||||
|
#
|
||||||
|
do_test misc5-7.2 {
|
||||||
|
sqlite3 db2 :memory:
|
||||||
|
catchsql {
|
||||||
|
CREATE TABLE t1(x UNIQUE);
|
||||||
|
PRAGMA writable_schema=ON;
|
||||||
|
UPDATE sqlite_master SET sql='CREATE table t(o CHECK(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((;VALUES(o)';
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE t2(y);
|
||||||
|
ROLLBACK;
|
||||||
|
DROP TABLE IF EXISTS D;
|
||||||
|
} db2
|
||||||
|
} {0 {}}
|
||||||
|
db2 close
|
||||||
|
|
||||||
|
|
||||||
# Ticket #1911
|
# Ticket #1911
|
||||||
#
|
#
|
||||||
ifcapable compound {
|
ifcapable compound {
|
||||||
|
|||||||
@@ -74,28 +74,39 @@ do_test vtabA-1.6 {
|
|||||||
SELECT * FROM t1e;
|
SELECT * FROM t1e;
|
||||||
}
|
}
|
||||||
} {{value a} {value c}}
|
} {{value a} {value c}}
|
||||||
|
do_execsql_test vtabA-1.7 {
|
||||||
|
DELETE FROM t1e;
|
||||||
|
INSERT INTO t1e SELECT 'abc','def';
|
||||||
|
} {}
|
||||||
|
do_execsql_test vtabA-1.8 {
|
||||||
|
INSERT INTO t1e VALUES('ghi','jkl'),('mno','pqr'),('stu','vwx');
|
||||||
|
} {}
|
||||||
|
do_execsql_test vtabA-1.9 {
|
||||||
|
SELECT a,b,c, '|' FROM t1e ORDER BY 1;
|
||||||
|
} {abc {} def | ghi {} jkl | mno {} pqr | stu {} vwx |}
|
||||||
|
|
||||||
|
|
||||||
# Test that the expansion of a '*' expression in the result set of
|
# Test that the expansion of a '*' expression in the result set of
|
||||||
# a SELECT does not include the hidden column.
|
# a SELECT does not include the hidden column.
|
||||||
#
|
#
|
||||||
do_test vtabA-1.7 {
|
do_test vtabA-1.20 {
|
||||||
execsql {
|
execsql {
|
||||||
INSERT INTO t1e SELECT * FROM t1e;
|
INSERT INTO t1e SELECT * FROM t1e;
|
||||||
}
|
}
|
||||||
} {}
|
} {}
|
||||||
do_test vtabA-1.8 {
|
do_test vtabA-1.21 {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * FROM t1e;
|
SELECT * FROM t1e ORDER BY 1;
|
||||||
}
|
}
|
||||||
} {{value a} {value c} {value a} {value c}}
|
} {abc def abc def ghi jkl ghi jkl mno pqr mno pqr stu vwx stu vwx}
|
||||||
|
|
||||||
# Test that the declaration type of the hidden column does not include
|
# Test that the declaration type of the hidden column does not include
|
||||||
# the token "HIDDEN".
|
# the token "HIDDEN".
|
||||||
#
|
#
|
||||||
do_test vtabA-1.9 {
|
do_test vtabA-1.22 {
|
||||||
get_decltype t1e b
|
get_decltype t1e b
|
||||||
} {VARCHAR}
|
} {VARCHAR}
|
||||||
do_test vtabA-1.10 {
|
do_test vtabA-1.23 {
|
||||||
get_collist t1e
|
get_collist t1e
|
||||||
} {a c}
|
} {a c}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user