mirror of https://github.com/sqlite/sqlite
Merge latest trunk changes into this branch.
FossilOrigin-Name: e7dcd013516723941c2fb78ecdc96806d49d310b
This commit is contained in:
commit
4d14398a61
|
@ -550,7 +550,7 @@ TESTOPTS = --verbose=file --output=test-out.txt
|
|||
#
|
||||
SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5
|
||||
FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
|
||||
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1
|
||||
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
|
||||
|
||||
# This is the default Makefile target. The objects listed here
|
||||
# are what get build when you type just "make" with no arguments.
|
||||
|
|
|
@ -1218,7 +1218,7 @@ FUZZDATA = \
|
|||
#
|
||||
SHELL_COMPILE_OPTS = -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5
|
||||
FUZZERSHELL_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1
|
||||
FUZZCHECK_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1
|
||||
FUZZCHECK_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
|
||||
|
||||
# Standard options to testfixture
|
||||
#
|
||||
|
|
|
@ -544,7 +544,7 @@ int sqlite3Fts5AuxInit(fts5_api *pApi){
|
|||
int rc = SQLITE_OK; /* Return code */
|
||||
int i; /* To iterate through builtin functions */
|
||||
|
||||
for(i=0; rc==SQLITE_OK && i<sizeof(aBuiltin)/sizeof(aBuiltin[0]); i++){
|
||||
for(i=0; rc==SQLITE_OK && i<(int)ArraySize(aBuiltin); i++){
|
||||
rc = pApi->xCreateFunction(pApi,
|
||||
aBuiltin[i].zFunc,
|
||||
aBuiltin[i].pUserData,
|
||||
|
|
|
@ -407,7 +407,7 @@ static int fts5ExprPhraseIsMatch(
|
|||
|
||||
/* If the aStatic[] array is not large enough, allocate a large array
|
||||
** using sqlite3_malloc(). This approach could be improved upon. */
|
||||
if( pPhrase->nTerm>(sizeof(aStatic) / sizeof(aStatic[0])) ){
|
||||
if( pPhrase->nTerm>(int)ArraySize(aStatic) ){
|
||||
int nByte = sizeof(Fts5PoslistReader) * pPhrase->nTerm;
|
||||
aIter = (Fts5PoslistReader*)sqlite3_malloc(nByte);
|
||||
if( !aIter ) return SQLITE_NOMEM;
|
||||
|
@ -543,7 +543,7 @@ static int fts5ExprNearIsMatch(int *pRc, Fts5ExprNearset *pNear){
|
|||
|
||||
/* If the aStatic[] array is not large enough, allocate a large array
|
||||
** using sqlite3_malloc(). This approach could be improved upon. */
|
||||
if( pNear->nPhrase>(sizeof(aStatic) / sizeof(aStatic[0])) ){
|
||||
if( pNear->nPhrase>(int)ArraySize(aStatic) ){
|
||||
int nByte = sizeof(Fts5NearTrimmer) * pNear->nPhrase;
|
||||
a = (Fts5NearTrimmer*)sqlite3Fts5MallocZero(&rc, nByte);
|
||||
}else{
|
||||
|
@ -2214,7 +2214,7 @@ int sqlite3Fts5ExprInit(Fts5Global *pGlobal, sqlite3 *db){
|
|||
int rc = SQLITE_OK;
|
||||
void *pCtx = (void*)pGlobal;
|
||||
|
||||
for(i=0; rc==SQLITE_OK && i<(sizeof(aFunc) / sizeof(aFunc[0])); i++){
|
||||
for(i=0; rc==SQLITE_OK && i<(int)ArraySize(aFunc); i++){
|
||||
struct Fts5ExprFunc *p = &aFunc[i];
|
||||
rc = sqlite3_create_function(db, p->z, -1, SQLITE_UTF8, pCtx, p->x, 0, 0);
|
||||
}
|
||||
|
|
|
@ -545,7 +545,7 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
|
|||
for(i=0; i<pInfo->nConstraint; i++){
|
||||
struct sqlite3_index_constraint *p = &pInfo->aConstraint[i];
|
||||
int j;
|
||||
for(j=0; j<sizeof(aConstraint)/sizeof(aConstraint[0]); j++){
|
||||
for(j=0; j<(int)ArraySize(aConstraint); j++){
|
||||
struct Constraint *pC = &aConstraint[j];
|
||||
if( p->iColumn==aColMap[pC->iCol] && p->op & pC->op ){
|
||||
if( p->usable ){
|
||||
|
@ -592,7 +592,7 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
|
|||
|
||||
/* Assign argvIndex values to each constraint in use. */
|
||||
iNext = 1;
|
||||
for(i=0; i<sizeof(aConstraint)/sizeof(aConstraint[0]); i++){
|
||||
for(i=0; i<(int)ArraySize(aConstraint); i++){
|
||||
struct Constraint *pC = &aConstraint[i];
|
||||
if( pC->iConsIndex>=0 ){
|
||||
pInfo->aConstraintUsage[pC->iConsIndex].argvIndex = iNext++;
|
||||
|
|
|
@ -338,7 +338,7 @@ int sqlite3Fts5StorageClose(Fts5Storage *p){
|
|||
int i;
|
||||
|
||||
/* Finalize all SQL statements */
|
||||
for(i=0; i<ArraySize(p->aStmt); i++){
|
||||
for(i=0; i<(int)ArraySize(p->aStmt); i++){
|
||||
sqlite3_finalize(p->aStmt[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1220,7 +1220,7 @@ int sqlite3Fts5TokenizerInit(fts5_api *pApi){
|
|||
int rc = SQLITE_OK; /* Return code */
|
||||
int i; /* To iterate through builtin functions */
|
||||
|
||||
for(i=0; rc==SQLITE_OK && i<sizeof(aBuiltin)/sizeof(aBuiltin[0]); i++){
|
||||
for(i=0; rc==SQLITE_OK && i<(int)ArraySize(aBuiltin); i++){
|
||||
rc = pApi->xCreateTokenizer(pApi,
|
||||
aBuiltin[i].zName,
|
||||
(void*)pApi,
|
||||
|
|
112
ext/misc/json1.c
112
ext/misc/json1.c
|
@ -1181,7 +1181,7 @@ static void jsonTest1Func(
|
|||
#endif /* SQLITE_DEBUG */
|
||||
|
||||
/****************************************************************************
|
||||
** SQL function implementations
|
||||
** Scalar SQL function implementations
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -1514,6 +1514,102 @@ static void jsonValidFunc(
|
|||
sqlite3_result_int(ctx, rc);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** Aggregate SQL function implementations
|
||||
****************************************************************************/
|
||||
/*
|
||||
** json_group_array(VALUE)
|
||||
**
|
||||
** Return a JSON array composed of all values in the aggregate.
|
||||
*/
|
||||
static void jsonArrayStep(
|
||||
sqlite3_context *ctx,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
JsonString *pStr;
|
||||
pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
|
||||
if( pStr ){
|
||||
if( pStr->zBuf==0 ){
|
||||
jsonInit(pStr, ctx);
|
||||
jsonAppendChar(pStr, '[');
|
||||
}else{
|
||||
jsonAppendChar(pStr, ',');
|
||||
pStr->pCtx = ctx;
|
||||
}
|
||||
jsonAppendValue(pStr, argv[0]);
|
||||
}
|
||||
}
|
||||
static void jsonArrayFinal(sqlite3_context *ctx){
|
||||
JsonString *pStr;
|
||||
pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
|
||||
if( pStr ){
|
||||
pStr->pCtx = ctx;
|
||||
jsonAppendChar(pStr, ']');
|
||||
if( pStr->bErr ){
|
||||
sqlite3_result_error_nomem(ctx);
|
||||
assert( pStr->bStatic );
|
||||
}else{
|
||||
sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
||||
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|
||||
pStr->bStatic = 1;
|
||||
}
|
||||
}else{
|
||||
sqlite3_result_text(ctx, "[]", 2, SQLITE_STATIC);
|
||||
}
|
||||
sqlite3_result_subtype(ctx, JSON_SUBTYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
** json_group_obj(NAME,VALUE)
|
||||
**
|
||||
** Return a JSON object composed of all names and values in the aggregate.
|
||||
*/
|
||||
static void jsonObjectStep(
|
||||
sqlite3_context *ctx,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
JsonString *pStr;
|
||||
const char *z;
|
||||
u32 n;
|
||||
pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
|
||||
if( pStr ){
|
||||
if( pStr->zBuf==0 ){
|
||||
jsonInit(pStr, ctx);
|
||||
jsonAppendChar(pStr, '{');
|
||||
}else{
|
||||
jsonAppendChar(pStr, ',');
|
||||
pStr->pCtx = ctx;
|
||||
}
|
||||
z = (const char*)sqlite3_value_text(argv[0]);
|
||||
n = (u32)sqlite3_value_bytes(argv[0]);
|
||||
jsonAppendString(pStr, z, n);
|
||||
jsonAppendChar(pStr, ':');
|
||||
jsonAppendValue(pStr, argv[1]);
|
||||
}
|
||||
}
|
||||
static void jsonObjectFinal(sqlite3_context *ctx){
|
||||
JsonString *pStr;
|
||||
pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
|
||||
if( pStr ){
|
||||
jsonAppendChar(pStr, '}');
|
||||
if( pStr->bErr ){
|
||||
sqlite3_result_error_nomem(ctx);
|
||||
assert( pStr->bStatic );
|
||||
}else{
|
||||
sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
||||
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|
||||
pStr->bStatic = 1;
|
||||
}
|
||||
}else{
|
||||
sqlite3_result_text(ctx, "{}", 2, SQLITE_STATIC);
|
||||
}
|
||||
sqlite3_result_subtype(ctx, JSON_SUBTYPE);
|
||||
}
|
||||
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
/****************************************************************************
|
||||
** The json_each virtual table
|
||||
|
@ -2012,6 +2108,15 @@ int sqlite3Json1Init(sqlite3 *db){
|
|||
{ "json_test1", 1, 0, jsonTest1Func },
|
||||
#endif
|
||||
};
|
||||
static const struct {
|
||||
const char *zName;
|
||||
int nArg;
|
||||
void (*xStep)(sqlite3_context*,int,sqlite3_value**);
|
||||
void (*xFinal)(sqlite3_context*);
|
||||
} aAgg[] = {
|
||||
{ "json_group_array", 1, jsonArrayStep, jsonArrayFinal },
|
||||
{ "json_group_object", 2, jsonObjectStep, jsonObjectFinal },
|
||||
};
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
static const struct {
|
||||
const char *zName;
|
||||
|
@ -2027,6 +2132,11 @@ int sqlite3Json1Init(sqlite3 *db){
|
|||
(void*)&aFunc[i].flag,
|
||||
aFunc[i].xFunc, 0, 0);
|
||||
}
|
||||
for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
|
||||
rc = sqlite3_create_function(db, aAgg[i].zName, aAgg[i].nArg,
|
||||
SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
|
||||
0, aAgg[i].xStep, aAgg[i].xFinal);
|
||||
}
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){
|
||||
rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0);
|
||||
|
|
2
main.mk
2
main.mk
|
@ -460,7 +460,7 @@ TESTOPTS = --verbose=file --output=test-out.txt
|
|||
#
|
||||
SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5
|
||||
FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
|
||||
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1
|
||||
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
|
||||
|
||||
# This is the default Makefile target. The objects listed here
|
||||
# are what get build when you type just "make" with no arguments.
|
||||
|
|
89
manifest
89
manifest
|
@ -1,8 +1,8 @@
|
|||
C Fix\san\sfts5\sproblem\sinvolving\sdetail=none,\s"ORDER\sBY\srowid\sDESC"\sand\sdeleted\sitems.\sAlso\sadd\stests\sto\sverify\sthat\sthe\sdocumented\soperator\sprecedences\sare\scorrect.
|
||||
D 2016-01-06T18:53:57.055
|
||||
F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d
|
||||
C Merge\slatest\strunk\schanges\sinto\sthis\sbranch.
|
||||
D 2016-01-06T19:35:52.285
|
||||
F Makefile.in 7c8cc4c2f0179efc6fa9492141d1fb65f4807054
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5fff077fcc46de7714ed6eebb6159a4c00eab751
|
||||
F Makefile.msc e45d8b9b56dfa3f2cd860b2c28bd9d304513b042
|
||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||
F VERSION 8b9d3ac6f1962f94e06ba05462422a544f9c4e36
|
||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||
|
@ -98,17 +98,17 @@ F ext/fts3/unicode/parseunicode.tcl da577d1384810fb4e2b209bf3313074353193e95
|
|||
F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0
|
||||
F ext/fts5/fts5.h 88fec577a2148f34df75930dc2b0c45b0bad72c3
|
||||
F ext/fts5/fts5Int.h 3918045ebceb1d600c9c1c1b460489ff0c788e96
|
||||
F ext/fts5/fts5_aux.c 1f384972d606375b8fa078319f25ab4b5feb1b35
|
||||
F ext/fts5/fts5_aux.c 2dafc3aee0c70d643140c77d8d70daffa51a9e9e
|
||||
F ext/fts5/fts5_buffer.c 87204c8b3b8bc62b27376eab09b74d6d5acc41f1
|
||||
F ext/fts5/fts5_config.c b0ed7b0ddd785fb4d4e6f9037d357f8aa95918e6
|
||||
F ext/fts5/fts5_expr.c 5d5dd3044c1a39ace6ddd1034961fd5278ffce2d
|
||||
F ext/fts5/fts5_expr.c 913ab9f9a7651d76f055f9847ca0ae0e2f5da78d
|
||||
F ext/fts5/fts5_hash.c 1b113977296cf4212c6ec667d5e3f2bd18036955
|
||||
F ext/fts5/fts5_index.c 04fe098ffab66d9424ba4e7c0b88ce7c98748cb1
|
||||
F ext/fts5/fts5_main.c cd5f6f0bf868a19e8f8ef01c7b4b86dd152f0bc7
|
||||
F ext/fts5/fts5_storage.c 771dd0fda3ee513e32937a386dc2a4aa2d9ea64e
|
||||
F ext/fts5/fts5_main.c 03bd44e4bd0ba16213ca9259ad5df1d4d743fd7e
|
||||
F ext/fts5/fts5_storage.c f7b2d330dd7b29a9f4da09f6d85879ca8c41b2e8
|
||||
F ext/fts5/fts5_tcl.c 18e9382d8cdad4c05b49559c68494968b9b4a4fb
|
||||
F ext/fts5/fts5_test_mi.c 1ec66ffdf7632077fbd773b7a6df5153272ec070
|
||||
F ext/fts5/fts5_tokenize.c 618efe033bceb80c521b1e9ddfd9fee85fb5946e
|
||||
F ext/fts5/fts5_tokenize.c 504984ac6993323247221eebe3cd55bead01b5f8
|
||||
F ext/fts5/fts5_unicode2.c 78273fbd588d1d9bd0a7e4e0ccc9207348bae33c
|
||||
F ext/fts5/fts5_varint.c 3f86ce09cab152e3d45490d7586b7ed2e40c13f1
|
||||
F ext/fts5/fts5_vocab.c 3742d0abfe8aa8c3cb4a7df56aa38f2e3c3fb1c2
|
||||
|
@ -194,7 +194,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
|
|||
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
|
||||
F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767
|
||||
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
|
||||
F ext/misc/json1.c 4f45afd9dbcd6feca8c528251efbb7fc09299a09
|
||||
F ext/misc/json1.c 7b1155f520d5e8ec1c005d978ac675e8a7f2688a
|
||||
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
|
||||
F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
|
||||
F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
|
||||
|
@ -260,7 +260,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
|
|||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||
F main.mk ed77cbb97848c8dae1ab928245432f74b0580162
|
||||
F main.mk 20e46c09ac8732a74a9e2d55e8d90257d97eb844
|
||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
|
@ -279,41 +279,41 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
|
|||
F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc
|
||||
F src/bitvec.c 1a78d450a17c5016710eec900bedfc5729bf9bdf
|
||||
F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
||||
F src/btree.c 84ede51e371a11c3dbb3e24ccc5e3e99594a6c00
|
||||
F src/btree.c 4d3452b2a3daf875490ac4f0a278da7f85fabe12
|
||||
F src/btree.h 2d76dee44704c47eed323356a758662724b674a0
|
||||
F src/btreeInt.h 3ab435ed27adea54d040584b0bcc488ee7db1e38
|
||||
F src/build.c e83da4d004a4e050c01acbb821ff7a7b1019c29b
|
||||
F src/btreeInt.h b5f2651b41808f038dee9282c5dc0232ce6532d3
|
||||
F src/build.c d8006e9030c61b9495d0b2f724edd3fcdae16930
|
||||
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
||||
F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f
|
||||
F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
|
||||
F src/date.c fb1c99172017dcc8e237339132c91a21a0788584
|
||||
F src/date.c e4655393bb403fa310eef66cc4583d75d4d7fd93
|
||||
F src/dbstat.c ffd63fc8ba7541476ced189b95e95d7f2bc63f78
|
||||
F src/delete.c 00af9f08a15ddc5cba5962d3d3e5bf2d67b2e7da
|
||||
F src/expr.c ccb93d7b7e1ac5d187c9b153bae145933f93ee5c
|
||||
F src/expr.c 38790e65d1219f2b7dc26458f39a5252fe7c60cd
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c 31900763094a3736a5fc887469202eb579fef2d0
|
||||
F src/func.c fe50a9ab977acc0bb0fcd46741e0071fa388888e
|
||||
F src/global.c 508e4087f7b41d688e4762dcf4d4fe28cfbc87f9
|
||||
F src/fkey.c e18b3dff7d47c7bcac5ac4fc178a89b9fd322b44
|
||||
F src/func.c cf5e10af9125b245f1b962e8ba4d520a37818795
|
||||
F src/global.c bd5a0af3f30b0c01be6db756c626cd3c33a3d260
|
||||
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
|
||||
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
|
||||
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
||||
F src/insert.c e1d20ae8979e25519c2670233718676bedcfedc9
|
||||
F src/insert.c 6b45cc86967da11aa024d034745f93f66d53f650
|
||||
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
||||
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
|
||||
F src/loadext.c 84996d7d70a605597d79c1f1d7b2012a5fd34f2b
|
||||
F src/main.c 2f33510a6a392c606fe64964e695e55ad124242f
|
||||
F src/main.c b9641a4f650230bfc5dbb0bebf7b33ff4d27586a
|
||||
F src/malloc.c 8f787669e79de26efc42272b5797bc00fff527c6
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b
|
||||
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
|
||||
F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a
|
||||
F src/mem5.c 5c267678ba9f745a2ee58102a9f482d64a58577a
|
||||
F src/mem5.c 262055c242fa7db59c5f07ad77fdc4e97888c054
|
||||
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85
|
||||
F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495
|
||||
F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c
|
||||
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
|
||||
F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
|
||||
F src/mutex_unix.c fc54f25b2a750d53b32512a4a728cec28039ae2a
|
||||
F src/mutex_unix.c 27bb6cc49485ee46711a6580ab7b3f1402211d23
|
||||
F src/mutex_w32.c 5e6fe1c298fb5a8a15aaed4161d5759311431c17
|
||||
F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7
|
||||
F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8
|
||||
|
@ -337,11 +337,11 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
|||
F src/resolve.c a83b41104e6ff69855d03cd0aaa09e93927ec39f
|
||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||
F src/select.c f8fded11fc443a9f5a73cc5db069d06b34460e2f
|
||||
F src/shell.c abbc74ea43dbf2f306ea18282d666683fb5efab2
|
||||
F src/shell.c ed71dc7679e6f087a3f1ea3f9dae4b0fae7209c3
|
||||
F src/sqlite.h.in 7d87d71b9a4689c51fa092f48f16590ff71558e3
|
||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||
F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
|
||||
F src/sqliteInt.h beb4a63b94428f52a3d7c7af2ba8bdc7d4682a03
|
||||
F src/sqliteInt.h f97614d43833bae0ed6c51ac8e550f0099a1d0ba
|
||||
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
||||
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
|
||||
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
||||
|
@ -363,7 +363,7 @@ F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
|
|||
F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4
|
||||
F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852
|
||||
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
||||
F src/test_fs.c 993c7eab65bed6add4bb48cca29775e963f710cf
|
||||
F src/test_fs.c a61f54247fdb843761d709879c3bcd1989b2050c
|
||||
F src/test_func.c 0d9c25956152adefee8881c6fadc8354793764d0
|
||||
F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd
|
||||
F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32
|
||||
|
@ -398,14 +398,14 @@ F src/tokenize.c 5606871a377f390af7040ec3c12e0d183512d785
|
|||
F src/treeview.c 78842e90c1f71269e7a73a1d4221b6fe360bab66
|
||||
F src/trigger.c de3ed31ad3218a20d7d7e18bf1b3b734e78bda66
|
||||
F src/update.c 17332f9fe818cbc0444c36a811800af8498af4c3
|
||||
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
|
||||
F src/utf.c 32d7f82aa921322f3e1c956f4b58f019ebd2c6b3
|
||||
F src/util.c e802e8e311a0d6c48cd1b3e89db164f6f0248d70
|
||||
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
|
||||
F src/vdbe.c 984c2be6691d3f67deb2e6747c2132150d776f32
|
||||
F src/vdbe.c 6ac8e5d808d48afc369316e147c191102f0584c1
|
||||
F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637
|
||||
F src/vdbeInt.h 75c2e82ee3357e9210c06474f8d9bdf12c81105d
|
||||
F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca
|
||||
F src/vdbeaux.c 68082d9991fc1b8625d34c8b5db1775c9dee426e
|
||||
F src/vdbeaux.c 3308a07a6b0b64e22e83cbcc76773eaf330b056a
|
||||
F src/vdbeblob.c fdc4a81605ae7a35ae94a55bd768b66d6be16f15
|
||||
F src/vdbemem.c fdd1578e47bea61390d472de53c565781d81e045
|
||||
F src/vdbesort.c a7ec02da4494c59dfd071126dd3726be5a11459d
|
||||
|
@ -415,8 +415,8 @@ F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
|
|||
F src/wal.c 974928c988681c5157202c79dd9f26afaa7b5086
|
||||
F src/wal.h 907943dfdef10b583e81906679a347e0ec6f1b1b
|
||||
F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba
|
||||
F src/where.c b18edbb9e5afabb77f4f27550c471c5c824e0fe7
|
||||
F src/whereInt.h e20801d89e34de1912bb6a3babb30c390da27add
|
||||
F src/where.c c6d3d2f6af57d574a7365ee2b225a5024f2a6bec
|
||||
F src/whereInt.h 78b6b4de94db84aecbdc07fe3e38f648eb391e9a
|
||||
F src/wherecode.c dfbfe198e418b01f208b489e088edd230c91a4e7
|
||||
F src/whereexpr.c eebba8340c90de73b3d3bbe8c43b84559b8e6e2c
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
|
@ -444,7 +444,7 @@ F test/analyzeB.test 8bf35ee0a548aea831bf56762cb8e7fdb1db083d
|
|||
F test/analyzeC.test 555a6cc388b9818b6eda6df816f01ce0a75d3a93
|
||||
F test/analyzeD.test 08f9d0bee4e118a66fff3a32d02dbe0ee0a2b594
|
||||
F test/analyzeE.test 8684e8ac5722fb97c251887ad97e5d496a98af1d
|
||||
F test/analyzeF.test 7ccd7a04f7d3061bde1a8a4dacc4792edccf6bf2
|
||||
F test/analyzeF.test 5d1fe1024ba2dfea3c18bede8c1ccef8aba1ab34
|
||||
F test/analyzer1.test 498e2ff4b62740c2751c3a2f8b744fe26689fae9
|
||||
F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b
|
||||
F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
|
||||
|
@ -527,7 +527,7 @@ F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6
|
|||
F test/colmeta.test 2c765ea61ee37bc43bbe6d6047f89004e6508eb1
|
||||
F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b
|
||||
F test/conflict.test 841bcf7cabbfca39c577eb8411ea8601843b46a8
|
||||
F test/conflict2.test 0d3af4fb534fa1bd020c79960bb56e4d52655f09
|
||||
F test/conflict2.test a82dd3b9b41fceb5dd6ff0707c5c7ffba208d538
|
||||
F test/conflict3.test dec0634c0f31dec9a4b01c63063e939f0cd21b6b
|
||||
F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4
|
||||
F test/corrupt.test 141c39ea650c1365e85a49e402fa05cb9617fb97
|
||||
|
@ -565,8 +565,8 @@ F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
|
|||
F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8
|
||||
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
|
||||
F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
|
||||
F test/cursorhint.test 432811b62bd5ffb812729f49bba3b9ad687550bb
|
||||
F test/date.test 42973251b9429f2c41b77eb98a7b0b0ba2d3b2c0
|
||||
F test/cursorhint.test 7bc346788390475e77a345da2b92270d04d35856
|
||||
F test/date.test 984ac1e3e5e031386866f034006148d3972b4a65
|
||||
F test/dbstatus.test 8de104bb5606f19537d23cd553b41349b5ab1204
|
||||
F test/dbstatus2.test 10418e62b3db5dca070f0c3eef3ea13946f339c2
|
||||
F test/default.test 0cb49b1c315a0d81c81d775e407f66906a2a604d
|
||||
|
@ -752,7 +752,7 @@ F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1
|
|||
F test/fuzz3.test 53fabcd5f0f430f8b221282f6c12c4d0903c21eb
|
||||
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
|
||||
F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
|
||||
F test/fuzzcheck.c ccdcdc28579b2c9744696bca8726bdbd729eea11
|
||||
F test/fuzzcheck.c 3309d793165ca61a9996271cb799694839348f9a
|
||||
F test/fuzzdata1.db 7ee3227bad0e7ccdeb08a9e6822916777073c664
|
||||
F test/fuzzdata2.db f03a420d3b822cc82e4f894ca957618fbe9c4973
|
||||
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
|
||||
|
@ -764,7 +764,7 @@ F test/hexlit.test d7b0a5f41123df1e43985b91b8b2e70f95282d21
|
|||
F test/hidden.test 23c1393a79e846d68fd902d72c85d5e5dcf98711
|
||||
F test/hook.test 162d7cef7a2d2b04839fe14402934e6a1b79442f
|
||||
F test/icu.test 70df4faca133254c042d02ae342c0a141f2663f4
|
||||
F test/ieee754.test 118b665a97a8df0e8f2fbdb07d113e596f4a6b53
|
||||
F test/ieee754.test 806fc0ce7f305f57e3331eaceeddcfec9339e607
|
||||
F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8
|
||||
F test/in.test 61a24ae38d4b64ec69f06ccdf022992f68a98176
|
||||
F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
|
||||
|
@ -790,7 +790,7 @@ F test/index5.test 8621491915800ec274609e42e02a97d67e9b13e7
|
|||
F test/index6.test 7102ec371414c42dfb1d5ca37eb4519aa9edc23a
|
||||
F test/index7.test 9c6765a74fc3fcde7aebc5b3bd40d98df14a527c
|
||||
F test/indexedby.test 9c4cd331224e57f79fbf411ae245e6272d415985
|
||||
F test/indexexpr1.test bbb52b5d5717d9f23853826963b0af5110009366
|
||||
F test/indexexpr1.test cb71b6586177b840e28110dd952178bb2bdfedc2
|
||||
F test/indexfault.test 31d4ab9a7d2f6e9616933eb079722362a883eb1d
|
||||
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
|
||||
F test/insert.test 38742b5e9601c8f8d76e9b7555f7270288c2d371
|
||||
|
@ -823,6 +823,7 @@ F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d
|
|||
F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
|
||||
F test/json101.test f0178422b3a2418f423fd0d3caf3571c8d1b9863
|
||||
F test/json102.test bf3fe7a706d30936a76a0f7a0375e1e8e73aff5a
|
||||
F test/json103.test 923b288a0610ec86c0951778f7db19cbcca36ad1
|
||||
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
|
||||
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
|
||||
F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
|
||||
|
@ -949,7 +950,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
|
|||
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
||||
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
||||
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
||||
F test/releasetest.tcl 622f2381b217facdf429584a5c292cc1fc47e7c0
|
||||
F test/releasetest.tcl 975449bf742b8bb9025208292208af816a1fcb58
|
||||
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
||||
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
||||
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
|
||||
|
@ -1276,7 +1277,7 @@ F test/vtabC.test 4528f459a13136f982e75614d120aef165f17292
|
|||
F test/vtabD.test 05b3f1d77117271671089e48719524b676842e96
|
||||
F test/vtabE.test d5024aa42754962f6bb0afd261681686488e7afe
|
||||
F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e
|
||||
F test/vtabH.test f77296bbf55675b72817cc10fbbcb236ac986abf
|
||||
F test/vtabH.test 492ba03dcb7bb8fedcc53f258c410d04013adbc9
|
||||
F test/vtabI.test 751b07636700dbdea328e4265b6077ccd6811a3f
|
||||
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||
|
@ -1342,7 +1343,7 @@ F test/without_rowid1.test 1a7b9bd51b899928d327052df9741d2fe8dbe701
|
|||
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
|
||||
F test/without_rowid3.test aad4f9d383e199349b6c7e508a778f7dff5dff79
|
||||
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
|
||||
F test/without_rowid5.test 61256715b686359df48ca1742db50cc7e3e7b862
|
||||
F test/without_rowid5.test 89b1c587bd92a0590e440da33e7666bf4891572a
|
||||
F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e
|
||||
F test/wordcount.c 2a0a6c0d0e8e8bbbac1f06d72a6791828c37c0cf
|
||||
F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
|
||||
|
@ -1408,7 +1409,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
|||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P a4e55f73b3c81e28b917395089c0201f9a2c9178
|
||||
R 0d0b45c96327e08ac49c0cd0bf01187b
|
||||
P 8d05cfd48db1462dfd3efd502d53bd33214403fb 55a11fd627eaf046b3783622b2925399a50a65b4
|
||||
R cf1317de6526e81224b7c381ca0d373b
|
||||
U dan
|
||||
Z 1ffb33ee956b9f5de9322a26ad6982ed
|
||||
Z 2530c4785808f691eed775076fac89d0
|
||||
|
|
|
@ -1 +1 @@
|
|||
8d05cfd48db1462dfd3efd502d53bd33214403fb
|
||||
e7dcd013516723941c2fb78ecdc96806d49d310b
|
35
src/btree.c
35
src/btree.c
|
@ -1051,8 +1051,7 @@ static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(
|
|||
}else{
|
||||
pInfo->nLocal = (u16)minLocal;
|
||||
}
|
||||
pInfo->iOverflow = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell);
|
||||
pInfo->nSize = pInfo->iOverflow + 4;
|
||||
pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1084,7 +1083,6 @@ static void btreeParseCellPtrNoPayload(
|
|||
pInfo->nSize = 4 + getVarint(&pCell[4], (u64*)&pInfo->nKey);
|
||||
pInfo->nPayload = 0;
|
||||
pInfo->nLocal = 0;
|
||||
pInfo->iOverflow = 0;
|
||||
pInfo->pPayload = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -1154,7 +1152,6 @@ static void btreeParseCellPtr(
|
|||
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
||||
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
||||
pInfo->nLocal = (u16)nPayload;
|
||||
pInfo->iOverflow = 0;
|
||||
}else{
|
||||
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
||||
}
|
||||
|
@ -1193,7 +1190,6 @@ static void btreeParseCellPtrIndex(
|
|||
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
||||
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
||||
pInfo->nLocal = (u16)nPayload;
|
||||
pInfo->iOverflow = 0;
|
||||
}else{
|
||||
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
||||
}
|
||||
|
@ -1309,8 +1305,8 @@ static void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){
|
|||
if( *pRC ) return;
|
||||
assert( pCell!=0 );
|
||||
pPage->xParseCell(pPage, pCell, &info);
|
||||
if( info.iOverflow ){
|
||||
Pgno ovfl = get4byte(&pCell[info.iOverflow]);
|
||||
if( info.nLocal<info.nPayload ){
|
||||
Pgno ovfl = get4byte(&pCell[info.nSize-4]);
|
||||
ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
|
||||
}
|
||||
}
|
||||
|
@ -3348,11 +3344,11 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
|
|||
if( eType==PTRMAP_OVERFLOW1 ){
|
||||
CellInfo info;
|
||||
pPage->xParseCell(pPage, pCell, &info);
|
||||
if( info.iOverflow
|
||||
&& pCell+info.iOverflow+3<=pPage->aData+pPage->maskPage
|
||||
&& iFrom==get4byte(&pCell[info.iOverflow])
|
||||
if( info.nLocal<info.nPayload
|
||||
&& pCell+info.nSize-1<=pPage->aData+pPage->maskPage
|
||||
&& iFrom==get4byte(pCell+info.nSize-4)
|
||||
){
|
||||
put4byte(&pCell[info.iOverflow], iTo);
|
||||
put4byte(pCell+info.nSize-4, iTo);
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
|
@ -5994,13 +5990,13 @@ static int clearCell(
|
|||
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
||||
pPage->xParseCell(pPage, pCell, &info);
|
||||
*pnSize = info.nSize;
|
||||
if( info.iOverflow==0 ){
|
||||
if( info.nLocal==info.nPayload ){
|
||||
return SQLITE_OK; /* No overflow pages. Return without doing anything */
|
||||
}
|
||||
if( pCell+info.iOverflow+3 > pPage->aData+pPage->maskPage ){
|
||||
if( pCell+info.nSize-1 > pPage->aData+pPage->maskPage ){
|
||||
return SQLITE_CORRUPT_BKPT; /* Cell extends past end of page */
|
||||
}
|
||||
ovflPgno = get4byte(&pCell[info.iOverflow]);
|
||||
ovflPgno = get4byte(pCell + info.nSize - 4);
|
||||
assert( pBt->usableSize > 4 );
|
||||
ovflPageSize = pBt->usableSize - 4;
|
||||
nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;
|
||||
|
@ -6149,7 +6145,6 @@ static int fillInCell(
|
|||
assert( info.nKey==nKey );
|
||||
assert( *pnSize == info.nSize );
|
||||
assert( spaceLeft == info.nLocal );
|
||||
assert( pPrior == &pCell[info.iOverflow] );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -6859,8 +6854,8 @@ static int ptrmapCheckPages(MemPage **apPage, int nPage){
|
|||
|
||||
z = findCell(pPage, j);
|
||||
pPage->xParseCell(pPage, z, &info);
|
||||
if( info.iOverflow ){
|
||||
Pgno ovfl = get4byte(&z[info.iOverflow]);
|
||||
if( info.nLocal<info.nPayload ){
|
||||
Pgno ovfl = get4byte(&z[info.nSize-4]);
|
||||
ptrmapGet(pBt, ovfl, &e, &n);
|
||||
assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );
|
||||
}
|
||||
|
@ -8226,7 +8221,7 @@ int sqlite3BtreeDelete(BtCursor *pCur, int bPreserve){
|
|||
|
||||
if( rc==SQLITE_OK ){
|
||||
if( bSkipnext ){
|
||||
assert( bPreserve && pCur->iPage==iCellDepth );
|
||||
assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) );
|
||||
assert( pPage==pCur->apPage[pCur->iPage] );
|
||||
assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
|
||||
pCur->eState = CURSOR_SKIPNEXT;
|
||||
|
@ -9166,9 +9161,9 @@ static int checkTreePage(
|
|||
if( info.nPayload>info.nLocal ){
|
||||
int nPage; /* Number of pages on the overflow chain */
|
||||
Pgno pgnoOvfl; /* First page of the overflow chain */
|
||||
assert( pc + info.iOverflow <= usableSize );
|
||||
assert( pc + info.nSize - 4 <= usableSize );
|
||||
nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);
|
||||
pgnoOvfl = get4byte(&pCell[info.iOverflow]);
|
||||
pgnoOvfl = get4byte(&pCell[info.nSize - 4]);
|
||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||
if( pBt->autoVacuum ){
|
||||
checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage);
|
||||
|
|
|
@ -470,7 +470,6 @@ struct CellInfo {
|
|||
u8 *pPayload; /* Pointer to the start of payload */
|
||||
u32 nPayload; /* Bytes of payload */
|
||||
u16 nLocal; /* Amount of payload held locally, not on overflow */
|
||||
u16 iOverflow; /* Offset to overflow page number. Zero if no overflow */
|
||||
u16 nSize; /* Size of the cell content on the main b-tree page */
|
||||
};
|
||||
|
||||
|
|
25
src/build.c
25
src/build.c
|
@ -444,7 +444,7 @@ static void freeIndex(sqlite3 *db, Index *p){
|
|||
sqlite3ExprDelete(db, p->pPartIdxWhere);
|
||||
sqlite3ExprListDelete(db, p->aColExpr);
|
||||
sqlite3DbFree(db, p->zColAff);
|
||||
if( p->isResized ) sqlite3DbFree(db, p->azColl);
|
||||
if( p->isResized ) sqlite3DbFree(db, (void *)p->azColl);
|
||||
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
|
||||
sqlite3_free(p->aiRowEst);
|
||||
#endif
|
||||
|
@ -1047,15 +1047,15 @@ begin_table_error:
|
|||
/* Set properties of a table column based on the (magical)
|
||||
** name of the column.
|
||||
*/
|
||||
void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
|
||||
#if SQLITE_ENABLE_HIDDEN_COLUMNS
|
||||
void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
|
||||
if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
|
||||
pCol->colFlags |= COLFLAG_HIDDEN;
|
||||
}else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
|
||||
pTab->tabFlags |= TF_OOOHidden;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1635,7 +1635,7 @@ static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
|
|||
zExtra = sqlite3DbMallocZero(db, nByte);
|
||||
if( zExtra==0 ) return SQLITE_NOMEM;
|
||||
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
|
||||
pIdx->azColl = (char**)zExtra;
|
||||
pIdx->azColl = (const char**)zExtra;
|
||||
zExtra += sizeof(char*)*N;
|
||||
memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
|
||||
pIdx->aiColumn = (i16*)zExtra;
|
||||
|
@ -1774,7 +1774,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
|
|||
** do not enforce this for imposter tables.) */
|
||||
if( !db->init.imposterTable ){
|
||||
for(i=0; i<nPk; i++){
|
||||
pTab->aCol[pPk->aiColumn[i]].notNull = 1;
|
||||
pTab->aCol[pPk->aiColumn[i]].notNull = OE_Abort;
|
||||
}
|
||||
pPk->uniqNotNull = 1;
|
||||
}
|
||||
|
@ -1816,7 +1816,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
|
|||
if( !hasColumn(pPk->aiColumn, j, i) ){
|
||||
assert( j<pPk->nColumn );
|
||||
pPk->aiColumn[j] = i;
|
||||
pPk->azColl[j] = "BINARY";
|
||||
pPk->azColl[j] = sqlite3StrBINARY;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
@ -2866,7 +2866,7 @@ Index *sqlite3AllocateIndexObject(
|
|||
p = sqlite3DbMallocZero(db, nByte + nExtra);
|
||||
if( p ){
|
||||
char *pExtra = ((char*)p)+ROUND8(sizeof(Index));
|
||||
p->azColl = (char**)pExtra; pExtra += ROUND8(sizeof(char*)*nCol);
|
||||
p->azColl = (const char**)pExtra; pExtra += ROUND8(sizeof(char*)*nCol);
|
||||
p->aiRowLogEst = (LogEst*)pExtra; pExtra += sizeof(LogEst)*(nCol+1);
|
||||
p->aiColumn = (i16*)pExtra; pExtra += sizeof(i16)*nCol;
|
||||
p->aSortOrder = (u8*)pExtra;
|
||||
|
@ -3143,7 +3143,7 @@ Index *sqlite3CreateIndex(
|
|||
for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){
|
||||
Expr *pCExpr; /* The i-th index expression */
|
||||
int requestedSortOrder; /* ASC or DESC on the i-th expression */
|
||||
char *zColl; /* Collation sequence name */
|
||||
const char *zColl; /* Collation sequence name */
|
||||
|
||||
sqlite3StringToId(pListItem->pExpr);
|
||||
sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0);
|
||||
|
@ -3189,7 +3189,7 @@ Index *sqlite3CreateIndex(
|
|||
}else if( j>=0 ){
|
||||
zColl = pTab->aCol[j].zColl;
|
||||
}
|
||||
if( !zColl ) zColl = "BINARY";
|
||||
if( !zColl ) zColl = sqlite3StrBINARY;
|
||||
if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){
|
||||
goto exit_create_index;
|
||||
}
|
||||
|
@ -3218,7 +3218,7 @@ Index *sqlite3CreateIndex(
|
|||
assert( i==pIndex->nColumn );
|
||||
}else{
|
||||
pIndex->aiColumn[i] = XN_ROWID;
|
||||
pIndex->azColl[i] = "BINARY";
|
||||
pIndex->azColl[i] = sqlite3StrBINARY;
|
||||
}
|
||||
sqlite3DefaultRowEst(pIndex);
|
||||
if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
|
||||
|
@ -4342,9 +4342,8 @@ KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){
|
|||
if( pKey ){
|
||||
assert( sqlite3KeyInfoIsWriteable(pKey) );
|
||||
for(i=0; i<nCol; i++){
|
||||
char *zColl = pIdx->azColl[i];
|
||||
assert( zColl!=0 );
|
||||
pKey->aColl[i] = strcmp(zColl,"BINARY")==0 ? 0 :
|
||||
const char *zColl = pIdx->azColl[i];
|
||||
pKey->aColl[i] = zColl==sqlite3StrBINARY ? 0 :
|
||||
sqlite3LocateCollSeq(pParse, zColl);
|
||||
pKey->aSortOrder[i] = pIdx->aSortOrder[i];
|
||||
}
|
||||
|
|
21
src/date.c
21
src/date.c
|
@ -65,6 +65,7 @@ struct DateTime {
|
|||
char validHMS; /* True (1) if h,m,s are valid */
|
||||
char validJD; /* True (1) if iJD is valid */
|
||||
char validTZ; /* True (1) if tz is valid */
|
||||
char tzSet; /* Timezone was set explicitly */
|
||||
};
|
||||
|
||||
|
||||
|
@ -158,6 +159,7 @@ static int parseTimezone(const char *zDate, DateTime *p){
|
|||
p->tz = sgn*(nMn + nHr*60);
|
||||
zulu_time:
|
||||
while( sqlite3Isspace(*zDate) ){ zDate++; }
|
||||
p->tzSet = 1;
|
||||
return *zDate!=0;
|
||||
}
|
||||
|
||||
|
@ -590,13 +592,18 @@ static int parseModifier(sqlite3_context *pCtx, const char *zMod, DateTime *p){
|
|||
}
|
||||
#ifndef SQLITE_OMIT_LOCALTIME
|
||||
else if( strcmp(z, "utc")==0 ){
|
||||
sqlite3_int64 c1;
|
||||
computeJD(p);
|
||||
c1 = localtimeOffset(p, pCtx, &rc);
|
||||
if( rc==SQLITE_OK ){
|
||||
p->iJD -= c1;
|
||||
clearYMD_HMS_TZ(p);
|
||||
p->iJD += c1 - localtimeOffset(p, pCtx, &rc);
|
||||
if( p->tzSet==0 ){
|
||||
sqlite3_int64 c1;
|
||||
computeJD(p);
|
||||
c1 = localtimeOffset(p, pCtx, &rc);
|
||||
if( rc==SQLITE_OK ){
|
||||
p->iJD -= c1;
|
||||
clearYMD_HMS_TZ(p);
|
||||
p->iJD += c1 - localtimeOffset(p, pCtx, &rc);
|
||||
}
|
||||
p->tzSet = 1;
|
||||
}else{
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
18
src/expr.c
18
src/expr.c
|
@ -888,7 +888,7 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int flags, u8 **pzBuffer){
|
|||
assert( ExprHasProperty(p, EP_Reduced)==0 );
|
||||
memcpy(zAlloc, p, nNewSize);
|
||||
}else{
|
||||
int nSize = exprStructSize(p);
|
||||
u32 nSize = (u32)exprStructSize(p);
|
||||
memcpy(zAlloc, p, nSize);
|
||||
if( nSize<EXPR_FULLSIZE ){
|
||||
memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
|
||||
|
@ -2468,7 +2468,7 @@ void sqlite3ExprCodeLoadIndexColumn(
|
|||
assert( pIdx->aColExpr );
|
||||
assert( pIdx->aColExpr->nExpr>iIdxCol );
|
||||
pParse->iSelfTab = iTabCur;
|
||||
sqlite3ExprCode(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut);
|
||||
sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut);
|
||||
}else{
|
||||
sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur,
|
||||
iTabCol, regOut);
|
||||
|
@ -3321,13 +3321,25 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){
|
|||
sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target);
|
||||
}else{
|
||||
inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);
|
||||
assert( pParse->pVdbe || pParse->db->mallocFailed );
|
||||
assert( pParse->pVdbe!=0 || pParse->db->mallocFailed );
|
||||
if( inReg!=target && pParse->pVdbe ){
|
||||
sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Make a transient copy of expression pExpr and then code it using
|
||||
** sqlite3ExprCode(). This routine works just like sqlite3ExprCode()
|
||||
** except that the input expression is guaranteed to be unchanged.
|
||||
*/
|
||||
void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){
|
||||
sqlite3 *db = pParse->db;
|
||||
pExpr = sqlite3ExprDup(db, pExpr, 0);
|
||||
if( !db->mallocFailed ) sqlite3ExprCode(pParse, pExpr, target);
|
||||
sqlite3ExprDelete(db, pExpr);
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate code that will evaluate expression pExpr and store the
|
||||
** results in register target. The results are guaranteed to appear
|
||||
|
|
|
@ -249,7 +249,7 @@ int sqlite3FkLocateIndex(
|
|||
int i, j;
|
||||
for(i=0; i<nCol; i++){
|
||||
i16 iCol = pIdx->aiColumn[i]; /* Index of column in parent tbl */
|
||||
char *zDfltColl; /* Def. collation for column */
|
||||
const char *zDfltColl; /* Def. collation for column */
|
||||
char *zIdxCol; /* Name of indexed column */
|
||||
|
||||
if( iCol<0 ) break; /* No foreign keys against expression indexes */
|
||||
|
@ -258,9 +258,7 @@ int sqlite3FkLocateIndex(
|
|||
** the default collation sequence for the column, this index is
|
||||
** unusable. Bail out early in this case. */
|
||||
zDfltColl = pParent->aCol[iCol].zColl;
|
||||
if( !zDfltColl ){
|
||||
zDfltColl = "BINARY";
|
||||
}
|
||||
if( !zDfltColl ) zDfltColl = sqlite3StrBINARY;
|
||||
if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break;
|
||||
|
||||
zIdxCol = pParent->aCol[iCol].zName;
|
||||
|
|
|
@ -747,7 +747,7 @@ static int patternCompare(
|
|||
}
|
||||
c2 = Utf8Read(zString);
|
||||
if( c==c2 ) continue;
|
||||
if( noCase && c<0x80 && c2<0x80 && sqlite3Tolower(c)==sqlite3Tolower(c2) ){
|
||||
if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) ){
|
||||
continue;
|
||||
}
|
||||
if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
|
||||
|
|
|
@ -260,3 +260,8 @@ int sqlite3PendingByte = 0x40000000;
|
|||
** the vdbe.c file.
|
||||
*/
|
||||
const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
|
||||
|
||||
/*
|
||||
** Name of the default collating sequence
|
||||
*/
|
||||
const char sqlite3StrBINARY[] = "BINARY";
|
||||
|
|
27
src/insert.c
27
src/insert.c
|
@ -1408,7 +1408,7 @@ void sqlite3GenerateConstraintChecks(
|
|||
int x;
|
||||
if( iField==XN_EXPR ){
|
||||
pParse->ckBase = regNewData+1;
|
||||
sqlite3ExprCode(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i);
|
||||
sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i);
|
||||
pParse->ckBase = 0;
|
||||
VdbeComment((v, "%s column %d", pIdx->zName, i));
|
||||
}else{
|
||||
|
@ -1709,20 +1709,6 @@ int sqlite3_xferopt_count;
|
|||
|
||||
|
||||
#ifndef SQLITE_OMIT_XFER_OPT
|
||||
/*
|
||||
** Check to collation names to see if they are compatible.
|
||||
*/
|
||||
static int xferCompatibleCollation(const char *z1, const char *z2){
|
||||
if( z1==0 ){
|
||||
return z2==0;
|
||||
}
|
||||
if( z2==0 ){
|
||||
return 0;
|
||||
}
|
||||
return sqlite3StrICmp(z1, z2)==0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Check to see if index pSrc is compatible as a source of data
|
||||
** for index pDest in an insert transfer optimization. The rules
|
||||
|
@ -1758,7 +1744,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){
|
|||
if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
|
||||
return 0; /* Different sort orders */
|
||||
}
|
||||
if( !xferCompatibleCollation(pSrc->azColl[i],pDest->azColl[i]) ){
|
||||
if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){
|
||||
return 0; /* Different collating sequences */
|
||||
}
|
||||
}
|
||||
|
@ -1919,7 +1905,7 @@ static int xferOptimization(
|
|||
if( pDestCol->affinity!=pSrcCol->affinity ){
|
||||
return 0; /* Affinity must be the same on all columns */
|
||||
}
|
||||
if( !xferCompatibleCollation(pDestCol->zColl, pSrcCol->zColl) ){
|
||||
if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){
|
||||
return 0; /* Collating sequence must be the same on all columns */
|
||||
}
|
||||
if( pDestCol->notNull && !pSrcCol->notNull ){
|
||||
|
@ -2066,9 +2052,10 @@ static int xferOptimization(
|
|||
** a VACUUM command. In that case keys may not be written in strictly
|
||||
** sorted order. */
|
||||
for(i=0; i<pSrcIdx->nColumn; i++){
|
||||
char *zColl = pSrcIdx->azColl[i];
|
||||
assert( zColl!=0 );
|
||||
if( sqlite3_stricmp("BINARY", zColl) ) break;
|
||||
const char *zColl = pSrcIdx->azColl[i];
|
||||
assert( sqlite3_stricmp(sqlite3StrBINARY, zColl)!=0
|
||||
|| sqlite3StrBINARY==zColl );
|
||||
if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
|
||||
}
|
||||
if( i==pSrcIdx->nColumn ){
|
||||
idxInsFlags = OPFLAG_USESEEKRESULT;
|
||||
|
|
11
src/main.c
11
src/main.c
|
@ -2829,9 +2829,9 @@ static int openDatabase(
|
|||
** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating
|
||||
** functions:
|
||||
*/
|
||||
createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0);
|
||||
createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0);
|
||||
createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
|
||||
createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0);
|
||||
createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0);
|
||||
createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0);
|
||||
createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
|
||||
createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
|
||||
if( db->mallocFailed ){
|
||||
|
@ -2840,7 +2840,7 @@ static int openDatabase(
|
|||
/* EVIDENCE-OF: R-08308-17224 The default collating function for all
|
||||
** strings is BINARY.
|
||||
*/
|
||||
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0);
|
||||
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
|
||||
assert( db->pDfltColl!=0 );
|
||||
|
||||
/* Parse the filename/URI argument. */
|
||||
|
@ -3340,7 +3340,7 @@ int sqlite3_table_column_metadata(
|
|||
primarykey = 1;
|
||||
}
|
||||
if( !zCollSeq ){
|
||||
zCollSeq = "BINARY";
|
||||
zCollSeq = sqlite3StrBINARY;
|
||||
}
|
||||
|
||||
error_out:
|
||||
|
@ -3948,4 +3948,3 @@ void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
|
|||
sqlite3_free(pSnapshot);
|
||||
}
|
||||
#endif /* SQLITE_ENABLE_SNAPSHOT */
|
||||
|
||||
|
|
29
src/mem5.c
29
src/mem5.c
|
@ -25,7 +25,7 @@
|
|||
**
|
||||
** This memory allocator uses the following algorithm:
|
||||
**
|
||||
** 1. All memory allocations sizes are rounded up to a power of 2.
|
||||
** 1. All memory allocation sizes are rounded up to a power of 2.
|
||||
**
|
||||
** 2. If two adjacent free blocks are the halves of a larger block,
|
||||
** then the two blocks are coalesced into the single larger block.
|
||||
|
@ -117,7 +117,7 @@ static SQLITE_WSD struct Mem5Global {
|
|||
/*
|
||||
** Lists of free blocks. aiFreelist[0] is a list of free blocks of
|
||||
** size mem5.szAtom. aiFreelist[1] holds blocks of size szAtom*2.
|
||||
** and so forth.
|
||||
** aiFreelist[2] holds free blocks of size szAtom*4. And so forth.
|
||||
*/
|
||||
int aiFreelist[LOGMAX+1];
|
||||
|
||||
|
@ -183,9 +183,7 @@ static void memsys5Link(int i, int iLogsize){
|
|||
}
|
||||
|
||||
/*
|
||||
** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
|
||||
** will already be held (obtained by code in malloc.c) if
|
||||
** sqlite3GlobalConfig.bMemStat is true.
|
||||
** Obtain or release the mutex needed to access global data structures.
|
||||
*/
|
||||
static void memsys5Enter(void){
|
||||
sqlite3_mutex_enter(mem5.mutex);
|
||||
|
@ -195,9 +193,8 @@ static void memsys5Leave(void){
|
|||
}
|
||||
|
||||
/*
|
||||
** Return the size of an outstanding allocation, in bytes. The
|
||||
** size returned omits the 8-byte header overhead. This only
|
||||
** works for chunks that are currently checked out.
|
||||
** Return the size of an outstanding allocation, in bytes.
|
||||
** This only works for chunks that are currently checked out.
|
||||
*/
|
||||
static int memsys5Size(void *p){
|
||||
int iSize, i;
|
||||
|
@ -230,16 +227,12 @@ static void *memsys5MallocUnsafe(int nByte){
|
|||
/* Keep track of the maximum allocation request. Even unfulfilled
|
||||
** requests are counted */
|
||||
if( (u32)nByte>mem5.maxRequest ){
|
||||
/* Abort if the requested allocation size is larger than the largest
|
||||
** power of two that we can represent using 32-bit signed integers. */
|
||||
if( nByte > 0x40000000 ) return 0;
|
||||
mem5.maxRequest = nByte;
|
||||
}
|
||||
|
||||
/* Abort if the requested allocation size is larger than the largest
|
||||
** power of two that we can represent using 32-bit signed integers.
|
||||
*/
|
||||
if( nByte > 0x40000000 ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Round nByte up to the next valid power of two */
|
||||
for(iFullSz=mem5.szAtom,iLogsize=0; iFullSz<nByte; iFullSz*=2,iLogsize++){}
|
||||
|
||||
|
@ -398,13 +391,11 @@ static void *memsys5Realloc(void *pPrior, int nBytes){
|
|||
if( nBytes<=nOld ){
|
||||
return pPrior;
|
||||
}
|
||||
memsys5Enter();
|
||||
p = memsys5MallocUnsafe(nBytes);
|
||||
p = memsys5Malloc(nBytes);
|
||||
if( p ){
|
||||
memcpy(p, pPrior, nOld);
|
||||
memsys5FreeUnsafe(pPrior);
|
||||
memsys5Free(pPrior);
|
||||
}
|
||||
memsys5Leave();
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ struct sqlite3_mutex {
|
|||
};
|
||||
#if SQLITE_MUTEX_NREF
|
||||
#define SQLITE3_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER,0,0,(pthread_t)0,0}
|
||||
#elif defined(SQLITE_ENABLE_API_ARMOR)
|
||||
#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0 }
|
||||
#else
|
||||
#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
|
||||
#endif
|
||||
|
|
700
src/shell.c
700
src/shell.c
File diff suppressed because it is too large
Load Diff
|
@ -692,11 +692,6 @@ typedef INT16_TYPE LogEst;
|
|||
** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined
|
||||
** at run-time.
|
||||
*/
|
||||
#ifdef SQLITE_AMALGAMATION
|
||||
const int sqlite3one = 1;
|
||||
#else
|
||||
extern const int sqlite3one;
|
||||
#endif
|
||||
#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || \
|
||||
defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
|
||||
defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
|
||||
|
@ -714,6 +709,11 @@ extern const int sqlite3one;
|
|||
# define SQLITE_UTF16NATIVE SQLITE_UTF16BE
|
||||
#endif
|
||||
#if !defined(SQLITE_BYTEORDER)
|
||||
# ifdef SQLITE_AMALGAMATION
|
||||
const int sqlite3one = 1;
|
||||
# else
|
||||
extern const int sqlite3one;
|
||||
# endif
|
||||
# define SQLITE_BYTEORDER 0 /* 0 means "unknown at compile-time" */
|
||||
# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
|
||||
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
|
||||
|
@ -1522,7 +1522,7 @@ struct Column {
|
|||
char *zColl; /* Collating sequence. If NULL, use the default */
|
||||
u8 notNull; /* An OE_ code for handling a NOT NULL constraint */
|
||||
char affinity; /* One of the SQLITE_AFF_... values */
|
||||
u8 szEst; /* Estimated size of this column. INT==1 */
|
||||
u8 szEst; /* Estimated size of value in this column. sizeof(INT)==1 */
|
||||
u8 colFlags; /* Boolean properties. See COLFLAG_ defines below */
|
||||
};
|
||||
|
||||
|
@ -1932,7 +1932,7 @@ struct Index {
|
|||
Index *pNext; /* The next index associated with the same table */
|
||||
Schema *pSchema; /* Schema containing this index */
|
||||
u8 *aSortOrder; /* for each column: True==DESC, False==ASC */
|
||||
char **azColl; /* Array of collation sequence names for index */
|
||||
const char **azColl; /* Array of collation sequence names for index */
|
||||
Expr *pPartIdxWhere; /* WHERE clause for partial indices */
|
||||
ExprList *aColExpr; /* Column expressions */
|
||||
int tnum; /* DB Page containing root of this index */
|
||||
|
@ -2732,6 +2732,7 @@ struct Parse {
|
|||
int nSet; /* Number of sets used so far */
|
||||
int nOnce; /* Number of OP_Once instructions so far */
|
||||
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
|
||||
int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
|
||||
int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
|
||||
int ckBase; /* Base register of data during check constraints */
|
||||
int iSelfTab; /* Table of an index whose exprs are being coded */
|
||||
|
@ -2963,9 +2964,9 @@ struct StrAccum {
|
|||
sqlite3 *db; /* Optional database for lookaside. Can be NULL */
|
||||
char *zBase; /* A base allocation. Not from malloc. */
|
||||
char *zText; /* The string collected so far */
|
||||
int nChar; /* Length of the string so far */
|
||||
int nAlloc; /* Amount of space allocated in zText */
|
||||
int mxAlloc; /* Maximum allowed allocation. 0 for no malloc usage */
|
||||
u32 nChar; /* Length of the string so far */
|
||||
u32 nAlloc; /* Amount of space allocated in zText */
|
||||
u32 mxAlloc; /* Maximum allowed allocation. 0 for no malloc usage */
|
||||
u8 accError; /* STRACCUM_NOMEM or STRACCUM_TOOBIG */
|
||||
u8 bMalloced; /* zText points to allocated space */
|
||||
};
|
||||
|
@ -3348,7 +3349,11 @@ void sqlite3OpenMasterTable(Parse *, int);
|
|||
Index *sqlite3PrimaryKeyIndex(Table*);
|
||||
i16 sqlite3ColumnOfIndex(Index*, i16);
|
||||
void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
|
||||
void sqlite3ColumnPropertiesFromName(Table*, Column*);
|
||||
#if SQLITE_ENABLE_HIDDEN_COLUMNS
|
||||
void sqlite3ColumnPropertiesFromName(Table*, Column*);
|
||||
#else
|
||||
# define sqlite3ColumnPropertiesFromName(T,C) /* no-op */
|
||||
#endif
|
||||
void sqlite3AddColumn(Parse*,Token*);
|
||||
void sqlite3AddNotNull(Parse*, int);
|
||||
void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
|
||||
|
@ -3461,6 +3466,7 @@ void sqlite3ExprCacheRemove(Parse*, int, int);
|
|||
void sqlite3ExprCacheClear(Parse*);
|
||||
void sqlite3ExprCacheAffinityChange(Parse*, int, int);
|
||||
void sqlite3ExprCode(Parse*, Expr*, int);
|
||||
void sqlite3ExprCodeCopy(Parse*, Expr*, int);
|
||||
void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
|
||||
void sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8);
|
||||
int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
|
||||
|
@ -3698,6 +3704,7 @@ int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
|
|||
void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
|
||||
#ifndef SQLITE_AMALGAMATION
|
||||
extern const unsigned char sqlite3OpcodeProperty[];
|
||||
extern const char sqlite3StrBINARY[];
|
||||
extern const unsigned char sqlite3UpperToLower[];
|
||||
extern const unsigned char sqlite3CtypeMap[];
|
||||
extern const Token sqlite3IntTokens[];
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#if SQLITE_OS_UNIX
|
||||
#if SQLITE_OS_UNIX || defined(__MINGW_H)
|
||||
# include <unistd.h>
|
||||
# include <dirent.h>
|
||||
# ifndef DIRENT
|
||||
|
@ -79,7 +79,9 @@
|
|||
#endif
|
||||
#if SQLITE_OS_WIN
|
||||
# include <io.h>
|
||||
# include "test_windirent.h"
|
||||
# if !defined(__MINGW_H)
|
||||
# include "test_windirent.h"
|
||||
# endif
|
||||
# ifndef S_ISREG
|
||||
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
# endif
|
||||
|
@ -231,7 +233,14 @@ static int fsdirNext(sqlite3_vtab_cursor *cur){
|
|||
|
||||
if( pCsr->pDir ){
|
||||
struct DIRENT *pRes = 0;
|
||||
#if defined(__MINGW_H)
|
||||
pRes = readdir(pCsr->pDir);
|
||||
if( pRes!=0 ){
|
||||
memcpy(&pCsr->entry, pRes, sizeof(struct DIRENT));
|
||||
}
|
||||
#else
|
||||
readdir_r(pCsr->pDir, &pCsr->entry, &pRes);
|
||||
#endif
|
||||
if( pRes==0 ){
|
||||
closedir(pCsr->pDir);
|
||||
pCsr->pDir = 0;
|
||||
|
|
|
@ -37,13 +37,13 @@
|
|||
#include <assert.h>
|
||||
#include "vdbeInt.h"
|
||||
|
||||
#ifndef SQLITE_AMALGAMATION
|
||||
#if !defined(SQLITE_AMALGAMATION) && SQLITE_BYTEORDER==0
|
||||
/*
|
||||
** The following constant value is used by the SQLITE_BIGENDIAN and
|
||||
** SQLITE_LITTLEENDIAN macros.
|
||||
*/
|
||||
const int sqlite3one = 1;
|
||||
#endif /* SQLITE_AMALGAMATION */
|
||||
#endif /* SQLITE_AMALGAMATION && SQLITE_BYTEORDER==0 */
|
||||
|
||||
/*
|
||||
** This lookup table is used to help decode the first byte of
|
||||
|
|
17
src/vdbe.c
17
src/vdbe.c
|
@ -1996,21 +1996,21 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
|||
/* Neither operand is NULL. Do a comparison. */
|
||||
affinity = pOp->p5 & SQLITE_AFF_MASK;
|
||||
if( affinity>=SQLITE_AFF_NUMERIC ){
|
||||
if( (pIn1->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
||||
if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
||||
applyNumericAffinity(pIn1,0);
|
||||
}
|
||||
if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
||||
if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
||||
applyNumericAffinity(pIn3,0);
|
||||
}
|
||||
}else if( affinity==SQLITE_AFF_TEXT ){
|
||||
if( (pIn1->flags & MEM_Str)==0 && (pIn1->flags & (MEM_Int|MEM_Real))!=0 ){
|
||||
if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){
|
||||
testcase( pIn1->flags & MEM_Int );
|
||||
testcase( pIn1->flags & MEM_Real );
|
||||
sqlite3VdbeMemStringify(pIn1, encoding, 1);
|
||||
testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
|
||||
flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
|
||||
}
|
||||
if( (pIn3->flags & MEM_Str)==0 && (pIn3->flags & (MEM_Int|MEM_Real))!=0 ){
|
||||
if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
|
||||
testcase( pIn3->flags & MEM_Int );
|
||||
testcase( pIn3->flags & MEM_Real );
|
||||
sqlite3VdbeMemStringify(pIn3, encoding, 1);
|
||||
|
@ -2019,15 +2019,14 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
|||
}
|
||||
}
|
||||
assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
|
||||
if( pIn1->flags & MEM_Zero ){
|
||||
if( flags1 & MEM_Zero ){
|
||||
sqlite3VdbeMemExpandBlob(pIn1);
|
||||
flags1 &= ~MEM_Zero;
|
||||
}
|
||||
if( pIn3->flags & MEM_Zero ){
|
||||
if( flags3 & MEM_Zero ){
|
||||
sqlite3VdbeMemExpandBlob(pIn3);
|
||||
flags3 &= ~MEM_Zero;
|
||||
}
|
||||
if( db->mallocFailed ) goto no_mem;
|
||||
res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
|
||||
}
|
||||
switch( pOp->opcode ){
|
||||
|
@ -2525,7 +2524,7 @@ case OP_Column: {
|
|||
goto op_column_error;
|
||||
}
|
||||
}else{
|
||||
VVA_ONLY( t = 0; ) /* Only needed by assert() statements */
|
||||
t = 0;
|
||||
}
|
||||
|
||||
/* If after trying to extract new entries from the header, nHdrParsed is
|
||||
|
@ -3403,7 +3402,7 @@ open_cursor_set_hints:
|
|||
assert( OPFLAG_BULKCSR==BTREE_BULKLOAD );
|
||||
assert( OPFLAG_SEEKEQ==BTREE_SEEK_EQ );
|
||||
testcase( pOp->p5 & OPFLAG_BULKCSR );
|
||||
#ifdef SQLITE_ENABLE_CURSOR_HINT
|
||||
#ifdef SQLITE_ENABLE_CURSOR_HINTS
|
||||
testcase( pOp->p2 & OPFLAG_SEEKEQ );
|
||||
#endif
|
||||
sqlite3BtreeCursorHintFlags(pCur->uc.pCursor,
|
||||
|
|
|
@ -35,6 +35,7 @@ Vdbe *sqlite3VdbeCreate(Parse *pParse){
|
|||
assert( pParse->aLabel==0 );
|
||||
assert( pParse->nLabel==0 );
|
||||
assert( pParse->nOpAlloc==0 );
|
||||
assert( pParse->szOpAlloc==0 );
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -124,7 +125,8 @@ static int growOpArray(Vdbe *v, int nOp){
|
|||
assert( nNew>=(p->nOpAlloc+nOp) );
|
||||
pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
|
||||
if( pNew ){
|
||||
p->nOpAlloc = sqlite3DbMallocSize(p->db, pNew)/sizeof(Op);
|
||||
p->szOpAlloc = sqlite3DbMallocSize(p->db, pNew);
|
||||
p->nOpAlloc = p->szOpAlloc/sizeof(Op);
|
||||
v->aOp = pNew;
|
||||
}
|
||||
return (pNew ? SQLITE_OK : SQLITE_NOMEM);
|
||||
|
@ -1846,20 +1848,27 @@ void sqlite3VdbeMakeReady(
|
|||
*/
|
||||
nMem += nCursor;
|
||||
|
||||
/* Allocate space for memory registers, SQL variables, VDBE cursors and
|
||||
** an array to marshal SQL function arguments in.
|
||||
/* zCsr will initially point to nFree bytes of unused space at the
|
||||
** end of the opcode array, p->aOp. The computation of nFree is
|
||||
** conservative - it might be smaller than the true number of free
|
||||
** bytes, but never larger. nFree must be a multiple of 8 - it is
|
||||
** rounded down if is not.
|
||||
*/
|
||||
zCsr = (u8*)&p->aOp[p->nOp]; /* Memory avaliable for allocation */
|
||||
assert( pParse->nOpAlloc*sizeof(Op) <= 0x7fffff00 );
|
||||
nFree = (pParse->nOpAlloc - p->nOp)*sizeof(p->aOp[0]); /* Available space */
|
||||
n = ROUND8(sizeof(Op)*p->nOp); /* Bytes of opcode space used */
|
||||
zCsr = &((u8*)p->aOp)[n]; /* Unused opcode space */
|
||||
assert( EIGHT_BYTE_ALIGNMENT(zCsr) );
|
||||
nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused space */
|
||||
assert( nFree>=0 );
|
||||
if( nFree>0 ){
|
||||
memset(zCsr, 0, nFree);
|
||||
assert( EIGHT_BYTE_ALIGNMENT(&zCsr[nFree]) );
|
||||
}
|
||||
|
||||
resolveP2Values(p, &nArg);
|
||||
p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
|
||||
if( pParse->explain && nMem<10 ){
|
||||
nMem = 10;
|
||||
}
|
||||
memset(zCsr, 0, nFree);
|
||||
assert( EIGHT_BYTE_ALIGNMENT(&zCsr[nFree]) );
|
||||
p->expired = 0;
|
||||
|
||||
/* Memory for registers, parameters, cursor, etc, is allocated in two
|
||||
|
@ -3748,7 +3757,7 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
|
|||
return -1;
|
||||
}
|
||||
|
||||
assert( pMem1->enc==pMem2->enc );
|
||||
assert( pMem1->enc==pMem2->enc || pMem1->db->mallocFailed );
|
||||
assert( pMem1->enc==SQLITE_UTF8 ||
|
||||
pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );
|
||||
|
||||
|
|
|
@ -718,7 +718,7 @@ static void constructAutomaticIndex(
|
|||
idxCols |= cMask;
|
||||
pIdx->aiColumn[n] = pTerm->u.leftColumn;
|
||||
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
|
||||
pIdx->azColl[n] = pColl ? pColl->zName : "BINARY";
|
||||
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
@ -730,20 +730,20 @@ static void constructAutomaticIndex(
|
|||
for(i=0; i<mxBitCol; i++){
|
||||
if( extraCols & MASKBIT(i) ){
|
||||
pIdx->aiColumn[n] = i;
|
||||
pIdx->azColl[n] = "BINARY";
|
||||
pIdx->azColl[n] = sqlite3StrBINARY;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
if( pSrc->colUsed & MASKBIT(BMS-1) ){
|
||||
for(i=BMS-1; i<pTable->nCol; i++){
|
||||
pIdx->aiColumn[n] = i;
|
||||
pIdx->azColl[n] = "BINARY";
|
||||
pIdx->azColl[n] = sqlite3StrBINARY;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
assert( n==nKeyCol );
|
||||
pIdx->aiColumn[n] = XN_ROWID;
|
||||
pIdx->azColl[n] = "BINARY";
|
||||
pIdx->azColl[n] = sqlite3StrBINARY;
|
||||
|
||||
/* Create the automatic index */
|
||||
assert( pLevel->iIdxCur>=0 );
|
||||
|
|
|
@ -288,7 +288,7 @@ struct WhereTerm {
|
|||
struct WhereScan {
|
||||
WhereClause *pOrigWC; /* Original, innermost WhereClause */
|
||||
WhereClause *pWC; /* WhereClause currently being scanned */
|
||||
char *zCollName; /* Required collating sequence, if not NULL */
|
||||
const char *zCollName; /* Required collating sequence, if not NULL */
|
||||
Expr *pIdxExpr; /* Search for this index expression */
|
||||
char idxaff; /* Must match this affinity, if zCollName!=NULL */
|
||||
unsigned char nEquiv; /* Number of entries in aEquiv[] */
|
||||
|
|
|
@ -106,7 +106,7 @@ do_catchsql_test 4.1 {
|
|||
} {1 {error one}}
|
||||
|
||||
do_catchsql_test 4.2 {
|
||||
SELECT * FROM t1 WHERE x = zeroblob(2000000000) AND y = 4;
|
||||
SELECT * FROM t1 WHERE x = zeroblob(2200000000) AND y = 4;
|
||||
} {1 {string or blob too big}}
|
||||
|
||||
sqlite3_limit db SQLITE_LIMIT_LENGTH 1000000
|
||||
|
@ -122,6 +122,3 @@ do_catchsql_test 4.4 {
|
|||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -289,11 +289,11 @@ do_test conflict2-6.0 {
|
|||
#
|
||||
foreach {i conf1 cmd t0 t1 t2 t3 t4} {
|
||||
1 {} UPDATE 1 {6 7 8 9} 1 0 1
|
||||
2 REPLACE UPDATE 0 {7 6 9} 1 0 0
|
||||
3 IGNORE UPDATE 0 {6 7 3 9} 1 0 0
|
||||
4 FAIL UPDATE 1 {6 7 3 4} 1 0 0
|
||||
2 REPLACE UPDATE 0 {7 6 9} 1 0 1
|
||||
3 IGNORE UPDATE 0 {6 7 3 9} 1 0 1
|
||||
4 FAIL UPDATE 1 {6 7 3 4} 1 0 1
|
||||
5 ABORT UPDATE 1 {1 2 3 4} 1 0 1
|
||||
6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 0
|
||||
6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 1
|
||||
7 REPLACE {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0
|
||||
8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1
|
||||
9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0
|
||||
|
|
|
@ -46,10 +46,10 @@ proc p4_of_opcode {db opcode sql} {
|
|||
# Run EXPLAIN on $sql. Return a list of P5 values for all $opcode
|
||||
# opcodes that contain regexp $comment in their comment
|
||||
#
|
||||
proc p5_of_opcode {db opcode comment sql} {
|
||||
proc p5_of_opcode {db opcode sql} {
|
||||
set res {}
|
||||
$db eval "EXPLAIN $sql" x {
|
||||
if {$x(opcode)==$opcode && [regexp $comment $x(comment)]} {
|
||||
if {$x(opcode)==$opcode} {
|
||||
lappend res $x(p5)
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ do_test 1.1 {
|
|||
}
|
||||
} {{EQ(r[1],c0)}}
|
||||
do_test 1.2 {
|
||||
p5_of_opcode db OpenRead . {
|
||||
p5_of_opcode db OpenRead {
|
||||
SELECT * FROM t1 CROSS JOIN t2 WHERE a=x
|
||||
}
|
||||
} {00 00}
|
||||
|
@ -79,7 +79,7 @@ do_test 2.1 {
|
|||
}
|
||||
} {{EQ(c0,r[1])}}
|
||||
do_test 2.2 {
|
||||
p5_of_opcode db OpenRead . {
|
||||
p5_of_opcode db OpenRead {
|
||||
SELECT * FROM t2 CROSS JOIN t1 WHERE a=x
|
||||
}
|
||||
} {00 00}
|
||||
|
@ -114,7 +114,7 @@ do_test 4.1desc {
|
|||
}
|
||||
} {GT(c0,11)}
|
||||
do_test 4.2 {
|
||||
p5_of_opcode db OpenRead . {
|
||||
p5_of_opcode db OpenRead {
|
||||
SELECT * FROM t1 WHERE b>11;
|
||||
}
|
||||
} {02 00}
|
||||
|
@ -129,7 +129,7 @@ do_test 4.3desc {
|
|||
}
|
||||
} {}
|
||||
do_test 4.4 {
|
||||
p5_of_opcode db OpenRead . {
|
||||
p5_of_opcode db OpenRead {
|
||||
SELECT c FROM t1 WHERE b<11;
|
||||
}
|
||||
} {00}
|
||||
|
|
|
@ -336,6 +336,15 @@ if {$tzoffset_new==4} {
|
|||
datetest 6.8.1 {datetime('2006-04-02 02:00:00','utc')} {2006-04-02 06:00:00}
|
||||
datetest 6.8.2 {datetime('2007-03-11 02:00:00','utc')} {2007-03-11 06:00:00}
|
||||
|
||||
# The 'utc' modifier is a no-op if the LHS is known to already be in UTC
|
||||
datetest 6.9.1 {datetime('2015-12-23 12:00:00','utc')} {2015-12-23 17:00:00}
|
||||
datetest 6.9.2 {datetime('2015-12-23 12:00:00z','utc')} {2015-12-23 12:00:00}
|
||||
datetest 6.9.3 {datetime('2015-12-23 12:00:00-03:00','utc')} \
|
||||
{2015-12-23 15:00:00}
|
||||
datetest 6.9.4 {datetime('2015-12-23 12:00:00','utc','utc','utc')} \
|
||||
{2015-12-23 17:00:00}
|
||||
|
||||
|
||||
datetest 6.10 {datetime('2000-01-01 12:00:00','localtime')} \
|
||||
{2000-01-01 07:00:00}
|
||||
datetest 6.11 {datetime('1969-01-01 12:00:00','localtime')} \
|
||||
|
|
|
@ -865,8 +865,13 @@ int main(int argc, char **argv){
|
|||
return 0;
|
||||
}else
|
||||
if( strcmp(z,"limit-mem")==0 ){
|
||||
#if !defined(SQLITE_ENABLE_MEMSYS3) && !defined(SQLITE_ENABLE_MEMSYS5)
|
||||
fatalError("the %s option requires -DSQLITE_ENABLE_MEMSYS5 or _MEMSYS3",
|
||||
argv[i]);
|
||||
#else
|
||||
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
|
||||
nMem = integerValue(argv[++i]);
|
||||
#endif
|
||||
}else
|
||||
if( strcmp(z,"limit-vdbe")==0 ){
|
||||
vdbeLimitFlag = 1;
|
||||
|
|
|
@ -43,12 +43,16 @@ foreach {id float rep} {
|
|||
}
|
||||
}
|
||||
|
||||
do_execsql_test ieee754-110 {
|
||||
SELECT ieee754(1,1024), ieee754(4503599627370495,972);
|
||||
} {Inf 1.79769313486232e+308}
|
||||
do_execsql_test ieee754-111 {
|
||||
SELECT ieee754(-1,1024), ieee754(-4503599627370495,972);
|
||||
} {-Inf -1.79769313486232e+308}
|
||||
do_test ieee754-110 {
|
||||
string tolower [
|
||||
db eval {SELECT ieee754(1,1024), ieee754(4503599627370495,972);}
|
||||
]
|
||||
} {inf 1.79769313486232e+308}
|
||||
do_test ieee754-111 {
|
||||
string tolower [
|
||||
db eval {SELECT ieee754(-1,1024), ieee754(-4503599627370495,972);}
|
||||
]
|
||||
} {-inf -1.79769313486232e+308}
|
||||
do_execsql_test ieee754-112 {
|
||||
SELECT ieee754(4503599627370495,973) is null;
|
||||
} {1}
|
||||
|
|
|
@ -307,5 +307,21 @@ do_catchsql_test indexexpr1-910 {
|
|||
INSERT INTO t9(a,b,c,d) VALUES(5,6,7,-8);
|
||||
} {1 {UNIQUE constraint failed: index 't9x1'}}
|
||||
|
||||
# Test cases derived from a NEVER() maro failure discovered by
|
||||
# Jonathan Metzman using AFL
|
||||
#
|
||||
do_execsql_test indexexpr1-1000 {
|
||||
DROP TABLE IF EXISTS t0;
|
||||
CREATE TABLE t0(a,b,t);
|
||||
CREATE INDEX i ON t0(a in(0,1));
|
||||
INSERT INTO t0 VALUES(0,1,2),(2,3,4),(5,6,7);
|
||||
UPDATE t0 SET b=99 WHERE (a in(0,1))=0;
|
||||
SELECT *, '|' FROM t0 ORDER BY +a;
|
||||
} {0 1 2 | 2 99 4 | 5 99 7 |}
|
||||
do_execsql_test indexexpr1-1010 {
|
||||
UPDATE t0 SET b=88 WHERE (a in(0,1))=1;
|
||||
SELECT *, '|' FROM t0 ORDER BY +a;
|
||||
} {0 88 2 | 2 99 4 | 5 99 7 |}
|
||||
|
||||
|
||||
finish_test
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
# 2015-12-30
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements tests for JSON aggregate SQL functions
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
ifcapable !json1 {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
do_execsql_test json103-100 {
|
||||
CREATE TABLE t1(a,b,c);
|
||||
WITH RECURSIVE c(x) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<100)
|
||||
INSERT INTO t1(a,b,c) SELECT x, x%3, printf('n%d',x) FROM c;
|
||||
UPDATE t1 SET a='orange' WHERE rowid=39;
|
||||
UPDATE t1 SET a=32.5 WHERE rowid=31;
|
||||
UPDATE t1 SET a=x'303132' WHERE rowid=29;
|
||||
UPDATE t1 SET a=NULL WHERE rowid=37;
|
||||
SELECT json_group_array(a) FROM t1 WHERE a<0 AND typeof(a)!='blob';
|
||||
} {{[]}}
|
||||
do_catchsql_test json103-101 {
|
||||
SELECT json_group_array(a) FROM t1;
|
||||
} {1 {JSON cannot hold BLOB values}}
|
||||
do_execsql_test json103-110 {
|
||||
SELECT json_group_array(a) FROM t1
|
||||
WHERE rowid BETWEEN 31 AND 39;
|
||||
} {{[32.5,32,33,34,35,36,null,38,"orange"]}}
|
||||
do_execsql_test json103-111 {
|
||||
SELECT json_array_length(json_group_array(a)) FROM t1
|
||||
WHERE rowid BETWEEN 31 AND 39;
|
||||
} {9}
|
||||
do_execsql_test json103-120 {
|
||||
SELECT b, json_group_array(a) FROM t1 WHERE rowid<10 GROUP BY b ORDER BY b;
|
||||
} {0 {[3,6,9]} 1 {[1,4,7]} 2 {[2,5,8]}}
|
||||
|
||||
do_execsql_test json103-200 {
|
||||
SELECT json_group_object(c,a) FROM t1 WHERE a<0 AND typeof(a)!='blob';
|
||||
} {{{}}}
|
||||
do_catchsql_test json103-201 {
|
||||
SELECT json_group_object(c,a) FROM t1;
|
||||
} {1 {JSON cannot hold BLOB values}}
|
||||
|
||||
do_execsql_test json103-210 {
|
||||
SELECT json_group_object(c,a) FROM t1
|
||||
WHERE rowid BETWEEN 31 AND 39 AND rowid%2==1;
|
||||
} {{{"n31":32.5,"n33":33,"n35":35,"n37":null,"n39":"orange"}}}
|
||||
do_execsql_test json103-220 {
|
||||
SELECT b, json_group_object(c,a) FROM t1
|
||||
WHERE rowid<7 GROUP BY b ORDER BY b;
|
||||
} {0 {{"n3":3,"n6":6}} 1 {{"n1":1,"n4":4}} 2 {{"n2":2,"n5":5}}}
|
||||
|
||||
|
||||
|
||||
finish_test
|
|
@ -86,6 +86,8 @@ array set ::Configs [strip_comments {
|
|||
-DSQLITE_DEFAULT_FILE_FORMAT=4
|
||||
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
|
||||
-DSQLITE_ENABLE_STMT_SCANSTATUS
|
||||
-DSQLITE_LIKE_DOESNT_MATCH_BLOBS
|
||||
-DSQLITE_ENABLE_CURSOR_HINTS
|
||||
--enable-json1
|
||||
}
|
||||
"Check-Symbols" {
|
||||
|
@ -830,8 +832,8 @@ proc process_options {argv} {
|
|||
}
|
||||
|
||||
default {
|
||||
PUTSERR stderr ""
|
||||
PUTSERR stderr [string trim $::USAGE_MESSAGE]
|
||||
PUTSERR ""
|
||||
PUTSERR [string trim $::USAGE_MESSAGE]
|
||||
exit -1
|
||||
}
|
||||
}
|
||||
|
@ -945,6 +947,8 @@ proc main {argv} {
|
|||
set min [expr {($elapsetime/60)%60}]
|
||||
set sec [expr {$elapsetime%60}]
|
||||
set etime [format (%02d:%02d:%02d) $hr $min $sec]
|
||||
if {$::JOBS>1} {append etime " $::JOBS cores"}
|
||||
if {[catch {exec hostname} HNAME]==0} {append etime " on $HNAME"}
|
||||
PUTS [string repeat * 79]
|
||||
incr ::NERRCASE $::NERR
|
||||
PUTS "$::NERRCASE failures out of $::NTESTCASE tests in $etime"
|
||||
|
|
|
@ -32,12 +32,12 @@ do_execsql_test 1.0 {
|
|||
|
||||
foreach {tn sql expect} {
|
||||
1 "SELECT * FROM e6 WHERE b LIKE 'abc'" {
|
||||
xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b like ?}
|
||||
xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b like ?}
|
||||
xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} abc
|
||||
}
|
||||
|
||||
2 "SELECT * FROM e6 WHERE b GLOB 'abc'" {
|
||||
xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b glob ?}
|
||||
xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b glob ?}
|
||||
xFilter {SELECT rowid, a, b FROM 't6' WHERE b glob ?} abc
|
||||
}
|
||||
} {
|
||||
|
@ -115,7 +115,7 @@ if {1} {
|
|||
SELECT name FROM fsdir WHERE dir = '.' AND name = 'test.db';
|
||||
SELECT name FROM fsdir WHERE dir = '.' AND name = '.'
|
||||
} {test.db .}
|
||||
|
||||
|
||||
proc list_root_files {} {
|
||||
if {$::tcl_platform(platform) eq "windows"} {
|
||||
set res [list]
|
||||
|
@ -142,20 +142,6 @@ if {1} {
|
|||
}
|
||||
}
|
||||
|
||||
# Read the first 5 entries from the root directory.
|
||||
#
|
||||
set res [list]
|
||||
foreach p [lrange [list_root_files] 0 4] {
|
||||
if {$::tcl_platform(platform) eq "windows"} {
|
||||
lappend res $p
|
||||
} else {
|
||||
lappend res "/$p"
|
||||
}
|
||||
}
|
||||
do_execsql_test 3.1 {
|
||||
SELECT path FROM fstree LIMIT 5;
|
||||
} $res
|
||||
|
||||
# Read all entries in the current directory.
|
||||
#
|
||||
proc contents {pattern} {
|
||||
|
@ -173,7 +159,7 @@ if {1} {
|
|||
do_execsql_test 3.2 {
|
||||
SELECT path FROM fstree WHERE path GLOB $pwd ORDER BY 1
|
||||
} [lsort $res]
|
||||
|
||||
|
||||
# Add some sub-directories and files to the current directory.
|
||||
#
|
||||
do_test 3.3 {
|
||||
|
@ -181,7 +167,7 @@ if {1} {
|
|||
foreach {path sz} {
|
||||
subdir/x1.txt 143
|
||||
subdir/x2.txt 153
|
||||
} {
|
||||
} {
|
||||
set dir [file dirname $path]
|
||||
catch { file mkdir $dir }
|
||||
set fd [open $path w]
|
||||
|
@ -189,7 +175,7 @@ if {1} {
|
|||
close $fd
|
||||
}
|
||||
} {}
|
||||
|
||||
|
||||
set pwd [pwd]
|
||||
do_execsql_test 3.5 {
|
||||
SELECT path, size FROM fstree WHERE path GLOB $pwd || '/subdir/*' ORDER BY 1
|
||||
|
|
|
@ -132,9 +132,13 @@ do_execsql_test without_rowid5-5.1 {
|
|||
INSERT INTO ipk VALUES('rival','bonus'); -- ok to insert non-integer key
|
||||
SELECT * FROM ipk;
|
||||
} {rival bonus}
|
||||
do_catchsql_test without_rowid5-5.2 {
|
||||
do_catchsql_test without_rowid5-5.2a {
|
||||
BEGIN;
|
||||
INSERT INTO ipk VALUES(NULL,'sample'); -- no automatic generation of keys
|
||||
} {1 {NOT NULL constraint failed: ipk.key}}
|
||||
do_execsql_test without_rowid5-5.2b {
|
||||
ROLLBACK;
|
||||
} {}
|
||||
|
||||
# EVIDENCE-OF: R-33142-02092 AUTOINCREMENT does not work on WITHOUT
|
||||
# ROWID tables.
|
||||
|
|
Loading…
Reference in New Issue