Merge enhancements from trunk.
FossilOrigin-Name: e2edd34e79af906e7069e3e837730b12de0b73fe
This commit is contained in:
commit
8ca7b177bb
@ -458,7 +458,7 @@ static int testTokenizerNext(
|
||||
if( pCsr->iLangid & 0x00000001 ){
|
||||
for(i=0; i<nToken; i++) pCsr->aBuffer[i] = pToken[i];
|
||||
}else{
|
||||
for(i=0; i<nToken; i++) pCsr->aBuffer[i] = testTolower(pToken[i]);
|
||||
for(i=0; i<nToken; i++) pCsr->aBuffer[i] = (char)testTolower(pToken[i]);
|
||||
}
|
||||
pCsr->iToken++;
|
||||
pCsr->iInput = (int)(p - pCsr->aInput);
|
||||
|
@ -398,8 +398,8 @@ static void showSegmentStats(sqlite3 *db, const char *zTab){
|
||||
if( sqlite3_step(pStmt)==SQLITE_ROW
|
||||
&& (nLeaf = sqlite3_column_int(pStmt, 0))>0
|
||||
){
|
||||
nIdx = sqlite3_column_int(pStmt, 5);
|
||||
sqlite3_int64 sz;
|
||||
nIdx = sqlite3_column_int(pStmt, 5);
|
||||
printf("For level %d:\n", i);
|
||||
printf(" Number of indexes...................... %9d\n", nIdx);
|
||||
printf(" Number of leaf segments................ %9d\n", nLeaf);
|
||||
|
@ -345,11 +345,11 @@ int sqlite3Fts5HashWrite(
|
||||
if( pHash->eDetail==FTS5_DETAIL_FULL ){
|
||||
pPtr[p->nData++] = 0x01;
|
||||
p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iCol);
|
||||
p->iCol = iCol;
|
||||
p->iCol = (i16)iCol;
|
||||
p->iPos = 0;
|
||||
}else{
|
||||
bNew = 1;
|
||||
p->iCol = iPos = iCol;
|
||||
p->iCol = (i16)(iPos = iCol);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3244,7 +3244,7 @@ static void fts5IterSetOutputs_Col100(Fts5Iter *pIter, Fts5SegIter *pSeg){
|
||||
if( aiCol==aiColEnd ) goto setoutputs_col_out;
|
||||
}
|
||||
if( *aiCol==iPrev ){
|
||||
*aOut++ = (iPrev - iPrevOut) + 2;
|
||||
*aOut++ = (u8)((iPrev - iPrevOut) + 2);
|
||||
iPrevOut = iPrev;
|
||||
}
|
||||
}
|
||||
|
@ -625,10 +625,10 @@ static int amatchLoadOneRule(
|
||||
}else{
|
||||
memset(pRule, 0, sizeof(*pRule));
|
||||
pRule->zFrom = &pRule->zTo[nTo+1];
|
||||
pRule->nFrom = nFrom;
|
||||
pRule->nFrom = (amatch_len)nFrom;
|
||||
memcpy(pRule->zFrom, zFrom, nFrom+1);
|
||||
memcpy(pRule->zTo, zTo, nTo+1);
|
||||
pRule->nTo = nTo;
|
||||
pRule->nTo = (amatch_len)nTo;
|
||||
pRule->rCost = rCost;
|
||||
pRule->iLang = (int)iLang;
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ static void amatchAddWord(
|
||||
pWord->rCost = rCost;
|
||||
pWord->iSeq = pCur->nWord++;
|
||||
amatchWriteCost(pWord);
|
||||
pWord->nMatch = nMatch;
|
||||
pWord->nMatch = (short)nMatch;
|
||||
pWord->pNext = pCur->pAllWords;
|
||||
pCur->pAllWords = pWord;
|
||||
pWord->sCost.zKey = pWord->zCost;
|
||||
@ -1162,7 +1162,7 @@ static int amatchNext(sqlite3_vtab_cursor *cur){
|
||||
#endif
|
||||
nWord = (int)strlen(pWord->zWord+2);
|
||||
if( nWord+20>nBuf ){
|
||||
nBuf = nWord+100;
|
||||
nBuf = (char)(nWord+100);
|
||||
zBuf = sqlite3_realloc(zBuf, nBuf);
|
||||
if( zBuf==0 ) return SQLITE_NOMEM;
|
||||
}
|
||||
|
@ -344,10 +344,10 @@ static int fuzzerLoadOneRule(
|
||||
memset(pRule, 0, sizeof(*pRule));
|
||||
pRule->zFrom = pRule->zTo;
|
||||
pRule->zFrom += nTo + 1;
|
||||
pRule->nFrom = nFrom;
|
||||
pRule->nFrom = (fuzzer_len)nFrom;
|
||||
memcpy(pRule->zFrom, zFrom, nFrom+1);
|
||||
memcpy(pRule->zTo, zTo, nTo+1);
|
||||
pRule->nTo = nTo;
|
||||
pRule->nTo = (fuzzer_len)nTo;
|
||||
pRule->rCost = nCost;
|
||||
pRule->iRuleset = (int)iRuleset;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ struct ReCompiled {
|
||||
static void re_add_state(ReStateSet *pSet, int newState){
|
||||
unsigned i;
|
||||
for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
|
||||
pSet->aState[pSet->nState++] = newState;
|
||||
pSet->aState[pSet->nState++] = (ReStateNumber)newState;
|
||||
}
|
||||
|
||||
/* Extract the next unicode character from *pzIn and return it. Advance
|
||||
@ -358,7 +358,7 @@ static int re_insert(ReCompiled *p, int iBefore, int op, int arg){
|
||||
p->aArg[i] = p->aArg[i-1];
|
||||
}
|
||||
p->nState++;
|
||||
p->aOp[iBefore] = op;
|
||||
p->aOp[iBefore] = (char)op;
|
||||
p->aArg[iBefore] = arg;
|
||||
return iBefore;
|
||||
}
|
||||
@ -677,12 +677,12 @@ const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
|
||||
for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
|
||||
unsigned x = pRe->aArg[i];
|
||||
if( x<=127 ){
|
||||
pRe->zInit[j++] = x;
|
||||
pRe->zInit[j++] = (unsigned char)x;
|
||||
}else if( x<=0xfff ){
|
||||
pRe->zInit[j++] = 0xc0 | (x>>6);
|
||||
pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
|
||||
pRe->zInit[j++] = 0x80 | (x&0x3f);
|
||||
}else if( x<=0xffff ){
|
||||
pRe->zInit[j++] = 0xd0 | (x>>12);
|
||||
pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
|
||||
pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
|
||||
pRe->zInit[j++] = 0x80 | (x&0x3f);
|
||||
}else{
|
||||
|
@ -390,7 +390,7 @@ static int editdist1(const char *zA, const char *zB, int *pnMatch){
|
||||
|
||||
/* Special processing if either string is empty */
|
||||
if( nA==0 ){
|
||||
cBprev = dc;
|
||||
cBprev = (char)dc;
|
||||
for(xB=res=0; (cB = zB[xB])!=0; xB++){
|
||||
res += insertOrDeleteCost(cBprev, cB, zB[xB+1])/FINAL_INS_COST_DIV;
|
||||
cBprev = cB;
|
||||
@ -398,7 +398,7 @@ static int editdist1(const char *zA, const char *zB, int *pnMatch){
|
||||
return res;
|
||||
}
|
||||
if( nB==0 ){
|
||||
cAprev = dc;
|
||||
cAprev = (char)dc;
|
||||
for(xA=res=0; (cA = zA[xA])!=0; xA++){
|
||||
res += insertOrDeleteCost(cAprev, cA, zA[xA+1]);
|
||||
cAprev = cA;
|
||||
@ -420,8 +420,8 @@ static int editdist1(const char *zA, const char *zB, int *pnMatch){
|
||||
|
||||
/* Compute the Wagner edit distance */
|
||||
m[0] = 0;
|
||||
cx[0] = dc;
|
||||
cBprev = dc;
|
||||
cx[0] = (char)dc;
|
||||
cBprev = (char)dc;
|
||||
for(xB=1; xB<=nB; xB++){
|
||||
cBnext = zB[xB];
|
||||
cB = zB[xB-1];
|
||||
@ -429,7 +429,7 @@ static int editdist1(const char *zA, const char *zB, int *pnMatch){
|
||||
m[xB] = m[xB-1] + insertOrDeleteCost(cBprev, cB, cBnext);
|
||||
cBprev = cB;
|
||||
}
|
||||
cAprev = dc;
|
||||
cAprev = (char)dc;
|
||||
for(xA=1; xA<=nA; xA++){
|
||||
int lastA = (xA==nA);
|
||||
cA = zA[xA-1];
|
||||
@ -476,7 +476,7 @@ static int editdist1(const char *zA, const char *zB, int *pnMatch){
|
||||
d = m[xB];
|
||||
dc = cx[xB];
|
||||
m[xB] = totalCost;
|
||||
cx[xB] = ncx;
|
||||
cx[xB] = (char)ncx;
|
||||
cBprev = cB;
|
||||
}
|
||||
cAprev = cA;
|
||||
@ -711,9 +711,9 @@ static int editDist3ConfigLoad(
|
||||
if( nExtra<0 ) nExtra = 0;
|
||||
pCost = sqlite3_malloc64( sizeof(*pCost) + nExtra );
|
||||
if( pCost==0 ){ rc = SQLITE_NOMEM; break; }
|
||||
pCost->nFrom = nFrom;
|
||||
pCost->nTo = nTo;
|
||||
pCost->iCost = iCost;
|
||||
pCost->nFrom = (u8)nFrom;
|
||||
pCost->nTo = (u8)nTo;
|
||||
pCost->iCost = (u16)iCost;
|
||||
memcpy(pCost->a, zFrom, nFrom);
|
||||
memcpy(pCost->a + nFrom, zTo, nTo);
|
||||
pCost->pNext = pLang->pCost;
|
||||
@ -1616,7 +1616,7 @@ static unsigned char *transliterate(const unsigned char *zIn, int nIn){
|
||||
zIn += sz;
|
||||
nIn -= sz;
|
||||
if( c<=127 ){
|
||||
zOut[nOut++] = c;
|
||||
zOut[nOut++] = (unsigned char)c;
|
||||
}else{
|
||||
int xTop, xBtm, x;
|
||||
xTop = sizeof(translit)/sizeof(translit[0]) - 1;
|
||||
|
@ -3356,7 +3356,7 @@ sqlite3 *sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){
|
||||
*/
|
||||
static void rbuEditErrmsg(sqlite3rbu *p){
|
||||
if( p->rc==SQLITE_CONSTRAINT && p->zErrmsg ){
|
||||
int i;
|
||||
unsigned int i;
|
||||
size_t nErrmsg = strlen(p->zErrmsg);
|
||||
for(i=0; i<(nErrmsg-8); i++){
|
||||
if( memcmp(&p->zErrmsg[i], "rbu_imp_", 8)==0 ){
|
||||
|
@ -935,9 +935,9 @@ static int sessionTableInfo(
|
||||
int nDbCol = 0;
|
||||
int nThis;
|
||||
int i;
|
||||
u8 *pAlloc;
|
||||
u8 *pAlloc = 0;
|
||||
char **azCol = 0;
|
||||
u8 *abPK;
|
||||
u8 *abPK = 0;
|
||||
|
||||
assert( pazCol && pabPK );
|
||||
|
||||
@ -1593,9 +1593,9 @@ static void sessionDeleteTable(SessionTable *pList){
|
||||
pNext = pTab->pNext;
|
||||
for(i=0; i<pTab->nChange; i++){
|
||||
SessionChange *p;
|
||||
SessionChange *pNext;
|
||||
for(p=pTab->apChange[i]; p; p=pNext){
|
||||
pNext = p->pNext;
|
||||
SessionChange *pNextChange;
|
||||
for(p=pTab->apChange[i]; p; p=pNextChange){
|
||||
pNextChange = p->pNext;
|
||||
sqlite3_free(p);
|
||||
}
|
||||
}
|
||||
@ -2882,7 +2882,6 @@ static int sessionChangesetNext(
|
||||
** modified fields are present in the new.* record. The old.* record
|
||||
** is currently completely empty. This block shifts the PK fields from
|
||||
** new.* to old.*, to accommodate the code that reads these arrays. */
|
||||
int i;
|
||||
for(i=0; i<p->nCol; i++){
|
||||
assert( p->apValue[i]==0 );
|
||||
assert( p->abPK[i]==0 || p->apValue[i+p->nCol] );
|
||||
@ -3655,7 +3654,7 @@ static int sessionConflictHandler(
|
||||
void *pCtx, /* First argument for conflict handler */
|
||||
int *pbReplace /* OUT: Set to true if PK row is found */
|
||||
){
|
||||
int res; /* Value returned by conflict handler */
|
||||
int res = 0; /* Value returned by conflict handler */
|
||||
int rc;
|
||||
int nCol;
|
||||
int op;
|
||||
|
@ -314,7 +314,8 @@ static void test_append_value(Tcl_Obj *pList, sqlite3_value *pVal){
|
||||
pObj = Tcl_NewStringObj(z, n);
|
||||
break;
|
||||
}
|
||||
case SQLITE_BLOB:
|
||||
default:
|
||||
assert( sqlite3_value_type(pVal)==SQLITE_BLOB );
|
||||
Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("b", 1));
|
||||
pObj = Tcl_NewByteArrayObj(
|
||||
sqlite3_value_blob(pVal),
|
||||
@ -871,7 +872,6 @@ static int test_sqlite3session_foreach(
|
||||
|
||||
pOld = Tcl_NewObj();
|
||||
if( op!=SQLITE_INSERT ){
|
||||
int i;
|
||||
for(i=0; i<nCol; i++){
|
||||
sqlite3_value *pVal;
|
||||
sqlite3changeset_old(pIter, i, &pVal);
|
||||
@ -880,7 +880,6 @@ static int test_sqlite3session_foreach(
|
||||
}
|
||||
pNew = Tcl_NewObj();
|
||||
if( op!=SQLITE_DELETE ){
|
||||
int i;
|
||||
for(i=0; i<nCol; i++){
|
||||
sqlite3_value *pVal;
|
||||
sqlite3changeset_new(pIter, i, &pVal);
|
||||
|
56
manifest
56
manifest
@ -1,5 +1,5 @@
|
||||
C Once\sa\stemporary\sdatabase\sfile\shas\sbeen\sopened,\sflush\sall\sdirty\spages\sto\sdisk\swhen\scomitting\sa\stransaction.
|
||||
D 2016-04-12T19:09:29.339
|
||||
C Merge\senhancements\sfrom\strunk.
|
||||
D 2016-04-13T16:02:28.035
|
||||
F Makefile.in eba680121821b8a60940a81454316f47a341487a
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 71b8b16cf9393f68e2e2035486ca104872558836
|
||||
@ -81,7 +81,7 @@ F ext/fts3/fts3_icu.c deb46f7020d87ea7a14a433fb7a7f4bef42a9652
|
||||
F ext/fts3/fts3_porter.c 3565faf04b626cddf85f03825e86056a4562c009
|
||||
F ext/fts3/fts3_snippet.c 68ae118b0f834ea53d2b89e4087fc0f0b8c4ee4e
|
||||
F ext/fts3/fts3_term.c 88c55a6fa1a51ab494e33dced0401a6c28791fd7
|
||||
F ext/fts3/fts3_test.c 11e36437b0f3f2266acea5b4787f615e4337a237
|
||||
F ext/fts3/fts3_test.c a940cf104d545ad1abf926956ce65db2aa5af0cf
|
||||
F ext/fts3/fts3_tokenize_vtab.c a27593ab19657166f6fa5ec073b678cc29a75860
|
||||
F ext/fts3/fts3_tokenizer.c 3cf21cd2212db17a88d4ef7da0fd8a80275979a1
|
||||
F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
|
||||
@ -91,7 +91,7 @@ F ext/fts3/fts3_unicode2.c c3d01968d497bd7001e7dc774ba75b372738c057
|
||||
F ext/fts3/fts3_write.c c3863f23b6b4623c8b9d5cf31c12ce4469f78ca9
|
||||
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
|
||||
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
|
||||
F ext/fts3/tool/fts3view.c 5d78b668f4e9598af9147f8999632599fb0d9dd5
|
||||
F ext/fts3/tool/fts3view.c 202801a2056995b763864d60c2dee744d46f1677
|
||||
F ext/fts3/unicode/CaseFolding.txt 8c678ca52ecc95e16bc7afc2dbf6fc9ffa05db8c
|
||||
F ext/fts3/unicode/UnicodeData.txt cd07314edb62d49fde34debdaf92fa2aa69011e7
|
||||
F ext/fts3/unicode/mkunicode.tcl 2debed3f582d77b3fdd0b8830880250021571fd8
|
||||
@ -103,8 +103,8 @@ F ext/fts5/fts5_aux.c daa57fb45216491814520bbb587e97bf81ced458
|
||||
F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd
|
||||
F ext/fts5/fts5_config.c 5af9c360e99669d29f06492c370892394aba0857
|
||||
F ext/fts5/fts5_expr.c 5ca4bafe29aa3d27683c90e836192e4aefd20a3f
|
||||
F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337
|
||||
F ext/fts5/fts5_index.c fdd82bb421a5d1e64d004acb43f4dd9970c8d2b3
|
||||
F ext/fts5/fts5_hash.c 880998e596b60f078348d48732ca4ad9a90caad2
|
||||
F ext/fts5/fts5_index.c b429e23fabb57506f71e406997cc46b89190dc97
|
||||
F ext/fts5/fts5_main.c b4a0fc5bf17f2f1f056ee76cdd7d2af08b360f55
|
||||
F ext/fts5/fts5_storage.c 3309c6a8e34b974513016fd1ef47c83f5898f94c
|
||||
F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966
|
||||
@ -203,21 +203,21 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
|
||||
F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43
|
||||
F ext/icu/icu.c 4bdf4c5daedabcd8e6eb6e6a377657f7b978f9f7
|
||||
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
||||
F ext/misc/amatch.c a1a8f66c29d40bd71b075546ddeddb477b17a2bb
|
||||
F ext/misc/amatch.c 211108e201105e4bb0c076527b8cfd34330fc234
|
||||
F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704
|
||||
F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83
|
||||
F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
|
||||
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
|
||||
F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767
|
||||
F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25
|
||||
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
|
||||
F ext/misc/json1.c b9c88d5c3b6ecd8c731ffdd7f5b3d902857f8c96
|
||||
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
|
||||
F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
|
||||
F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
|
||||
F ext/misc/regexp.c a68d25c659bd2d893cd1215667bbf75ecb9dc7d4
|
||||
F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
|
||||
F ext/misc/series.c e11e534ada797d5b816d7e7a93c022306563ca35
|
||||
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
|
||||
F ext/misc/spellfix.c 598bbc45516227701558becdd38f4e6fe8e97cc2
|
||||
F ext/misc/spellfix.c bf1b922c2750698e9a3d4c50cce6974adb7e93be
|
||||
F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
|
||||
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
|
||||
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
|
||||
@ -246,7 +246,7 @@ F ext/rbu/rbufault2.test 9a7f19edd6ea35c4c9f807d8a3db0a03a5670c06
|
||||
F ext/rbu/rbufts.test 828cd689da825f0a7b7c53ffc1f6f7fdb6fa5bda
|
||||
F ext/rbu/rbuprogress.test 2023a7df2c523e3df1cb532eff811cda385a789a
|
||||
F ext/rbu/rbusave.test 0f43b6686084f426ddd040b878426452fd2c2f48
|
||||
F ext/rbu/sqlite3rbu.c 007fc4db8c0b95c7ef10162b5864921ef5cc8106
|
||||
F ext/rbu/sqlite3rbu.c 9097f1d95666dbef72ca61d5b6a13a84660735ac
|
||||
F ext/rbu/sqlite3rbu.h d7cc99350c10134f358fe1a8997d9225b3f712b2
|
||||
F ext/rbu/test_rbu.c 3505641a78b723589b8780d5f9b2faeeb73e037d
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
@ -291,9 +291,9 @@ F ext/session/sessionG.test 01ef705096a9d3984eebdcca79807a211dee1b60
|
||||
F ext/session/session_common.tcl a1293167d14774b5e728836720497f40fe4ea596
|
||||
F ext/session/sessionfault.test d52cbb7bee48cc8ee80335e07eb72fcb6b15eb40
|
||||
F ext/session/sessionfault2.test ac1dfd77a0fb0ea310aee40a16645ef1b66d3f88
|
||||
F ext/session/sqlite3session.c 2fc72bd989c424a15802da766c7ebd8eed47bcf6
|
||||
F ext/session/sqlite3session.c beb300cd1b5c5054062c8e6e807b10475e363410
|
||||
F ext/session/sqlite3session.h 64e9e7f185725ef43b97f4a9a0c0df0669844f1d
|
||||
F ext/session/test_session.c 187bd344c5ae9d5be85e22ef7c3010f0c17307ce
|
||||
F ext/session/test_session.c 464f2c8bf502795d95969387eb8e93f68c513c15
|
||||
F ext/userauth/sqlite3userauth.h 19cb6f0e31316d0ee4afdfb7a85ef9da3333a220
|
||||
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
|
||||
F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
|
||||
@ -326,7 +326,7 @@ F src/build.c 1944d95f0250ec72dab939f8319a12e237aaad61
|
||||
F src/callback.c 2e76147783386374bf01b227f752c81ec872d730
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
|
||||
F src/date.c 0b73e681c11fca867fec554750c07fe0d4e417c1
|
||||
F src/date.c 1cc9fb516ec9932c6fd4d2a0d2f8bc4480145c39
|
||||
F src/dbstat.c c845548d4346e606e2f2b7d2e714ace2b8a7dd1b
|
||||
F src/delete.c 78eb999114ec04fcf1b7d123ccedb4b5b734930e
|
||||
F src/expr.c 17d4e745ef6a3fd2e4ef863f5f9a4912f1ba1198
|
||||
@ -360,7 +360,7 @@ F src/os.h 91ff889115ecd01f436d3611f7f5ea4dc12d92f1
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c bde4844f0849cab5924c6a81178f8500774ce76b
|
||||
F src/os_win.c b3ba9573d8d893e70a6a8015bbee572ecf7ffbef
|
||||
F src/os_win.c b169437dff859e308b3726594094a2f8ca922941
|
||||
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
||||
F src/pager.c 525f3698f9a6b47a6e0f5496675529a183c2462b
|
||||
F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56
|
||||
@ -376,7 +376,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20
|
||||
F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e
|
||||
F src/select.c a07e6022e2b559f3c2ec80442472c5965fa7a3fc
|
||||
F src/shell.c b7922fa264f8c8d72a5ec6dd0b091e15a93c4de5
|
||||
F src/shell.c aeaab68456010319cb71406cbaca05865b295154
|
||||
F src/sqlite.h.in 64eb70a3b309751bebf73a5552a51244f68f0ea5
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 98f72cbfe00169c39089115427d06ea05fe4b4a2
|
||||
@ -384,7 +384,7 @@ F src/sqliteInt.h b3744b29555b83054f315f62d61b3a6558fa9e1c
|
||||
F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
|
||||
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
|
||||
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
|
||||
F src/tclsqlite.c 56569acc73d36e836b64aefecbbb709a92ba0077
|
||||
F src/tclsqlite.c 9c4c4589d078de37813ded708d8838b338ffb060
|
||||
F src/test1.c 457c601302b8a0f5960dffd17b6a2877603841dd
|
||||
F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b
|
||||
F src/test3.c 0df6f8dbb4cbaa7106397c70a271fa6a43659042
|
||||
@ -412,11 +412,11 @@ F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202
|
||||
F src/test_journal.c 5360fbe1d1e4416ca36290562fd5a2e3f70f32aa
|
||||
F src/test_loadext.c 337056bae59f80b9eb00ba82088b39d0f4fe6dfd
|
||||
F src/test_malloc.c 94c18e88d6df6d471a0d04ddb809f833d1739950
|
||||
F src/test_multiplex.c 6a9de820fcaaf506c59aa14bc8693822333cea48
|
||||
F src/test_multiplex.c eafc567ebe162e36f17b5062285dfe90461cf8e9
|
||||
F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3
|
||||
F src/test_mutex.c dbdfaff8580071f2212a0deae3325a93a737819c
|
||||
F src/test_onefile.c 38f7cbe79d5bafe95bde683cc3a53b8ca16daf10
|
||||
F src/test_osinst.c 5423dc1d355f594371f27dd292ca54bd320b8196
|
||||
F src/test_onefile.c 416f87a28d6d673352d33fc4b1c7d39db878e50f
|
||||
F src/test_osinst.c ad0233b1dabb0390e25edded4ebd79a2a61538c6
|
||||
F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
|
||||
F src/test_quota.c 180813f43683be5725458fc1ff13ac455d8e722d
|
||||
F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d
|
||||
@ -1051,7 +1051,7 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
|
||||
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
|
||||
F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506
|
||||
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
|
||||
F test/shell1.test b3df199cef9bc722d4078c893a7093d31174ea11
|
||||
F test/shell1.test 023657b3f8ba108dbd5ff2ebc8fceb3cf6d4ff9f
|
||||
F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
|
||||
F test/shell3.test da513d522ef6f01cee8475dcf8332bff8982b3dd
|
||||
F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9
|
||||
@ -1083,7 +1083,7 @@ F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523
|
||||
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
|
||||
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
|
||||
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
|
||||
F test/speedtest1.c 21af8db2492a903835b654517ac8d90aed0af91f
|
||||
F test/speedtest1.c 4476f7030775507f060d27b789e1f4123c5a5866
|
||||
F test/spellfix.test f9c1f431e2c096c8775fec032952320c0e4700db
|
||||
F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
|
||||
F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
|
||||
@ -1417,7 +1417,7 @@ F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
|
||||
F tool/lemon.c cfbfe061a4b2766512f6b484882eee2c86a14506
|
||||
F tool/lempar.c 404ea3dc27dbeed343f0e61b1d36e97b9f5f0fb6
|
||||
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
|
||||
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
|
||||
F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
|
||||
F tool/mkautoconfamal.sh e855df211ecbcc7131dee817110ff386cfb112f7
|
||||
F tool/mkkeywordhash.c f7f3b342211ac6a14258b9726d5b97cf4f548f22
|
||||
F tool/mkmsvcmin.tcl 2f12f7fa8858bbe61cf81820a2da96c79ed1ca8d
|
||||
@ -1438,7 +1438,7 @@ F tool/replace.tcl 7727c60a04299b65a92f5e1590896fea0f25b9e0
|
||||
F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a
|
||||
F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5
|
||||
F tool/run-speed-test.sh f95d19fd669b68c4c38b6b475242841d47c66076
|
||||
F tool/showdb.c 82dca79a999b2701c62417636345e9974151fdad
|
||||
F tool/showdb.c c695a5d5c8110640e0d9fadf5e254da90c79c36e
|
||||
F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818
|
||||
F tool/showlocks.c 9920bcc64f58378ff1118caead34147201f48c68
|
||||
F tool/showstat4.c bda40d6e395df7edb6e9ea630784d3d762c35b4b
|
||||
@ -1484,7 +1484,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 9682c0433c04713c28bd9105a7e20af7372f873e
|
||||
R ade8e2f9d92ad43fcc4c6c4e5d1634ec
|
||||
U dan
|
||||
Z 4a91ff9d1af5229ff41acb5284c79d70
|
||||
P bbac71aa2aa2380d393cda3be64b0208b464b27e 68142dc541b7a0a36fcb075a26f10f03c1e7c422
|
||||
R 1994a5cf2620dcff255de451b3e7e2bc
|
||||
U drh
|
||||
Z 9d74e847564ac60e89481ff586af6447
|
||||
|
@ -1 +1 @@
|
||||
bbac71aa2aa2380d393cda3be64b0208b464b27e
|
||||
e2edd34e79af906e7069e3e837730b12de0b73fe
|
11
src/date.c
11
src/date.c
@ -50,6 +50,15 @@
|
||||
|
||||
#ifndef SQLITE_OMIT_DATETIME_FUNCS
|
||||
|
||||
/*
|
||||
** The MSVC CRT on Windows CE may not have a localtime() function.
|
||||
** So declare a substitute. The substitute function itself is
|
||||
** defined in "os_win.c".
|
||||
*/
|
||||
#if !defined(SQLITE_OMIT_LOCALTIME) && defined(_WIN32_WCE) && \
|
||||
(!defined(SQLITE_MSVC_LOCALTIME_API) || !SQLITE_MSVC_LOCALTIME_API)
|
||||
struct tm *__cdecl localtime(const time_t *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** A structure for holding a single date and time.
|
||||
@ -418,6 +427,7 @@ static void clearYMD_HMS_TZ(DateTime *p){
|
||||
p->validTZ = 0;
|
||||
}
|
||||
|
||||
#ifndef SQLITE_OMIT_LOCALTIME
|
||||
/*
|
||||
** On recent Windows platforms, the localtime_s() function is available
|
||||
** as part of the "Secure CRT". It is essentially equivalent to
|
||||
@ -436,7 +446,6 @@ static void clearYMD_HMS_TZ(DateTime *p){
|
||||
#define HAVE_LOCALTIME_S 1
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_OMIT_LOCALTIME
|
||||
/*
|
||||
** The following routine implements the rough equivalent of localtime_r()
|
||||
** using whatever operating-system specific localtime facility that
|
||||
|
21
src/os_win.c
21
src/os_win.c
@ -2118,16 +2118,17 @@ static void winLogIoerr(int nRetry, int lineno){
|
||||
}
|
||||
}
|
||||
|
||||
#if SQLITE_OS_WINCE
|
||||
/*************************************************************************
|
||||
** This section contains code for WinCE only.
|
||||
*/
|
||||
#if !defined(SQLITE_MSVC_LOCALTIME_API) || !SQLITE_MSVC_LOCALTIME_API
|
||||
/*
|
||||
** The MSVC CRT on Windows CE may not have a localtime() function. So
|
||||
** create a substitute.
|
||||
** This #if does not rely on the SQLITE_OS_WINCE define because the
|
||||
** corresponding section in "date.c" cannot use it.
|
||||
*/
|
||||
#include <time.h>
|
||||
#if !defined(SQLITE_OMIT_LOCALTIME) && defined(_WIN32_WCE) && \
|
||||
(!defined(SQLITE_MSVC_LOCALTIME_API) || !SQLITE_MSVC_LOCALTIME_API)
|
||||
/*
|
||||
** The MSVC CRT on Windows CE may not have a localtime() function.
|
||||
** So define a substitute.
|
||||
*/
|
||||
# include <time.h>
|
||||
struct tm *__cdecl localtime(const time_t *t)
|
||||
{
|
||||
static struct tm y;
|
||||
@ -2151,6 +2152,10 @@ struct tm *__cdecl localtime(const time_t *t)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SQLITE_OS_WINCE
|
||||
/*************************************************************************
|
||||
** This section contains code for WinCE only.
|
||||
*/
|
||||
#define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-(int)offsetof(winFile,h)]
|
||||
|
||||
/*
|
||||
|
109
src/shell.c
109
src/shell.c
@ -669,6 +669,7 @@ struct ShellState {
|
||||
#define MODE_Csv 7 /* Quote strings, numbers are plain */
|
||||
#define MODE_Explain 8 /* Like MODE_Column, but do not truncate data */
|
||||
#define MODE_Ascii 9 /* Use ASCII unit and record separators (0x1F/0x1E) */
|
||||
#define MODE_Pretty 10 /* Pretty-print schemas */
|
||||
|
||||
static const char *modeDescr[] = {
|
||||
"line",
|
||||
@ -681,6 +682,7 @@ static const char *modeDescr[] = {
|
||||
"csv",
|
||||
"explain",
|
||||
"ascii",
|
||||
"prettyprint",
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1054,7 +1056,71 @@ static int shell_callback(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MODE_Semi:
|
||||
case MODE_Semi: { /* .schema and .fullschema output */
|
||||
utf8_printf(p->out, "%s;\n", azArg[0]);
|
||||
break;
|
||||
}
|
||||
case MODE_Pretty: { /* .schema and .fullschema with --indent */
|
||||
char *z;
|
||||
int i,j;
|
||||
int nParen = 0;
|
||||
char cEnd = 0;
|
||||
char c;
|
||||
int nLine = 0;
|
||||
assert( nArg==1 );
|
||||
if( azArg[0]==0 ) break;
|
||||
if( sqlite3_strlike("CREATE VIEW%", azArg[0], 0)==0
|
||||
|| sqlite3_strlike("CREATE TRIG%", azArg[0], 0)==0
|
||||
){
|
||||
utf8_printf(p->out, "%s;\n", azArg[0]);
|
||||
break;
|
||||
}
|
||||
z = sqlite3_mprintf("%s", azArg[0]);
|
||||
j = 0;
|
||||
for(i=0; IsSpace(z[i]); i++){}
|
||||
for(; (c = z[i])!=0; i++){
|
||||
if( IsSpace(c) ){
|
||||
if( IsSpace(z[j-1]) || z[j-1]=='(' ) continue;
|
||||
}else if( (c=='(' || c==')') && j>0 && IsSpace(z[j-1]) ){
|
||||
j--;
|
||||
}
|
||||
z[j++] = c;
|
||||
}
|
||||
while( j>0 && IsSpace(z[j-1]) ){ j--; }
|
||||
z[j] = 0;
|
||||
if( strlen30(z)>=79 ){
|
||||
for(i=j=0; z[i]; i++){
|
||||
char c = z[i];
|
||||
if( c==cEnd ){
|
||||
cEnd = 0;
|
||||
}else if( c=='"' || c=='\'' || c=='`' ){
|
||||
cEnd = c;
|
||||
}else if( c=='[' ){
|
||||
cEnd = ']';
|
||||
}else if( c=='(' ){
|
||||
nParen++;
|
||||
}else if( c==')' ){
|
||||
nParen--;
|
||||
if( nLine>0 && nParen==0 && j>0 ){
|
||||
utf8_printf(p->out, "%.*s\n", j, z);
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
z[j++] = c;
|
||||
if( nParen==1 && (c=='(' || c==',' || c=='\n') ){
|
||||
if( c=='\n' ) j--;
|
||||
utf8_printf(p->out, "%.*s\n ", j, z);
|
||||
j = 0;
|
||||
nLine++;
|
||||
while( IsSpace(z[i+1]) ){ i++; }
|
||||
}
|
||||
}
|
||||
z[j] = 0;
|
||||
}
|
||||
utf8_printf(p->out, "%s;\n", z);
|
||||
sqlite3_free(z);
|
||||
break;
|
||||
}
|
||||
case MODE_List: {
|
||||
if( p->cnt++==0 && p->showHeader ){
|
||||
for(i=0; i<nArg; i++){
|
||||
@ -1069,8 +1135,6 @@ static int shell_callback(
|
||||
utf8_printf(p->out, "%s", z);
|
||||
if( i<nArg-1 ){
|
||||
utf8_printf(p->out, "%s", p->colSeparator);
|
||||
}else if( p->cMode==MODE_Semi ){
|
||||
utf8_printf(p->out, ";%s", p->rowSeparator);
|
||||
}else{
|
||||
utf8_printf(p->out, "%s", p->rowSeparator);
|
||||
}
|
||||
@ -2024,7 +2088,7 @@ static char zHelp[] =
|
||||
".eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN\n"
|
||||
".exit Exit this program\n"
|
||||
".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic\n"
|
||||
".fullschema Show schema and the content of sqlite_stat tables\n"
|
||||
".fullschema ?--indent? Show schema and the content of sqlite_stat tables\n"
|
||||
".headers on|off Turn display of headers on or off\n"
|
||||
".help Show this message\n"
|
||||
".import FILE TABLE Import data from FILE into TABLE\n"
|
||||
@ -2060,9 +2124,8 @@ static char zHelp[] =
|
||||
".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n"
|
||||
".save FILE Write in-memory database into FILE\n"
|
||||
".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off\n"
|
||||
".schema ?TABLE? Show the CREATE statements\n"
|
||||
" If TABLE specified, only show tables matching\n"
|
||||
" LIKE pattern TABLE.\n"
|
||||
".schema ?PATTERN? Show the CREATE statements matching PATTERN\n"
|
||||
" Add --indent for pretty-printing\n"
|
||||
".separator COL ?ROW? Change the column separator and optionally the row\n"
|
||||
" separator for both the output mode and .import\n"
|
||||
#if defined(SQLITE_ENABLE_SESSION)
|
||||
@ -2933,6 +2996,17 @@ static int shellNomemError(void){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** Compare the string as a command-line option with either one or two
|
||||
** initial "-" characters.
|
||||
*/
|
||||
static int optionMatch(const char *zStr, const char *zOpt){
|
||||
if( zStr[0]!='-' ) return 0;
|
||||
zStr++;
|
||||
if( zStr[0]=='-' ) zStr++;
|
||||
return strcmp(zStr, zOpt)==0;
|
||||
}
|
||||
|
||||
/*
|
||||
** If an input line begins with "." then invoke this routine to
|
||||
** process that line.
|
||||
@ -3219,15 +3293,19 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
ShellState data;
|
||||
char *zErrMsg = 0;
|
||||
int doStats = 0;
|
||||
memcpy(&data, p, sizeof(data));
|
||||
data.showHeader = 0;
|
||||
data.cMode = data.mode = MODE_Semi;
|
||||
if( nArg==2 && optionMatch(azArg[1], "indent") ){
|
||||
data.cMode = data.mode = MODE_Pretty;
|
||||
nArg = 1;
|
||||
}
|
||||
if( nArg!=1 ){
|
||||
raw_printf(stderr, "Usage: .fullschema\n");
|
||||
raw_printf(stderr, "Usage: .fullschema ?--indent?\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
open_db(p, 0);
|
||||
memcpy(&data, p, sizeof(data));
|
||||
data.showHeader = 0;
|
||||
data.cMode = data.mode = MODE_Semi;
|
||||
rc = sqlite3_exec(p->db,
|
||||
"SELECT sql FROM"
|
||||
" (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
|
||||
@ -3862,7 +3940,12 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
memcpy(&data, p, sizeof(data));
|
||||
data.showHeader = 0;
|
||||
data.cMode = data.mode = MODE_Semi;
|
||||
if( nArg==2 ){
|
||||
if( nArg>=2 && optionMatch(azArg[1], "indent") ){
|
||||
data.cMode = data.mode = MODE_Pretty;
|
||||
nArg--;
|
||||
if( nArg==2 ) azArg[1] = azArg[2];
|
||||
}
|
||||
if( nArg==2 && azArg[1][0]!='-' ){
|
||||
int i;
|
||||
for(i=0; azArg[1][i]; i++) azArg[1][i] = ToLower(azArg[1][i]);
|
||||
if( strcmp(azArg[1],"sqlite_master")==0 ){
|
||||
@ -3917,7 +4000,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
callback, &data, &zErrMsg
|
||||
);
|
||||
}else{
|
||||
raw_printf(stderr, "Usage: .schema ?LIKE-PATTERN?\n");
|
||||
raw_printf(stderr, "Usage: .schema ?--indent? ?LIKE-PATTERN?\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
|
@ -3035,7 +3035,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
||||
/* set ppHook to point at pUpdateHook or pRollbackHook, depending on
|
||||
** whether [$db update_hook] or [$db rollback_hook] was invoked.
|
||||
*/
|
||||
Tcl_Obj **ppHook;
|
||||
Tcl_Obj **ppHook = 0;
|
||||
if( choice==DB_WAL_HOOK ) ppHook = &pDb->pWalHook;
|
||||
if( choice==DB_UPDATE_HOOK ) ppHook = &pDb->pUpdateHook;
|
||||
if( choice==DB_ROLLBACK_HOOK ) ppHook = &pDb->pRollbackHook;
|
||||
|
@ -539,7 +539,7 @@ static int multiplexOpen(
|
||||
memset(pGroup, 0, sz);
|
||||
pMultiplexOpen->pGroup = pGroup;
|
||||
pGroup->bEnabled = (unsigned char)-1;
|
||||
pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate",
|
||||
pGroup->bTruncate = (unsigned char)sqlite3_uri_boolean(zUri, "truncate",
|
||||
(flags & SQLITE_OPEN_MAIN_DB)==0);
|
||||
pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize",
|
||||
SQLITE_MULTIPLEX_CHUNK_SIZE);
|
||||
@ -978,7 +978,7 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){
|
||||
case MULTIPLEX_CTRL_ENABLE:
|
||||
if( pArg ) {
|
||||
int bEnabled = *(int *)pArg;
|
||||
pGroup->bEnabled = bEnabled;
|
||||
pGroup->bEnabled = (unsigned char)bEnabled;
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -508,7 +508,7 @@ static int fsSync(sqlite3_file *pFile, int flags){
|
||||
if( p->eType==DATABASE_FILE ){
|
||||
unsigned char zSize[4];
|
||||
zSize[0] = (pReal->nDatabase&0xFF000000)>>24;
|
||||
zSize[1] = (pReal->nDatabase&0x00FF0000)>>16;
|
||||
zSize[1] = (unsigned char)((pReal->nDatabase&0x00FF0000)>>16);
|
||||
zSize[2] = (pReal->nDatabase&0x0000FF00)>>8;
|
||||
zSize[3] = (pReal->nDatabase&0x000000FF);
|
||||
rc = pRealFile->pMethods->xWrite(pRealFile, zSize, 4, 0);
|
||||
|
@ -644,9 +644,9 @@ static void vfslog_flush(VfslogVfs *p){
|
||||
|
||||
static void put32bits(unsigned char *p, unsigned int v){
|
||||
p[0] = v>>24;
|
||||
p[1] = v>>16;
|
||||
p[2] = v>>8;
|
||||
p[3] = v;
|
||||
p[1] = (unsigned char)(v>>16);
|
||||
p[2] = (unsigned char)(v>>8);
|
||||
p[3] = (unsigned char)v;
|
||||
}
|
||||
|
||||
static void vfslog_call(
|
||||
|
@ -568,7 +568,7 @@ do_test shell1-3.21.2 {
|
||||
do_test shell1-3.21.3 {
|
||||
# too many arguments
|
||||
catchcmd "test.db" ".schema FOO BAD"
|
||||
} {1 {Usage: .schema ?LIKE-PATTERN?}}
|
||||
} {1 {Usage: .schema ?--indent? ?LIKE-PATTERN?}}
|
||||
|
||||
do_test shell1-3.21.4 {
|
||||
catchcmd "test.db" {
|
||||
|
@ -30,6 +30,7 @@ static const char zHelp[] =
|
||||
" --shrink-memory Invoke sqlite3_db_release_memory() frequently.\n"
|
||||
" --size N Relative test size. Default=100\n"
|
||||
" --stats Show statistics at the end\n"
|
||||
" --temp N N from 0 to 9. 0: no temp table. 9: all temp tables\n"
|
||||
" --testset T Run test-set T\n"
|
||||
" --trace Turn on SQL tracing\n"
|
||||
" --threads N Use up to N threads for sorting\n"
|
||||
@ -69,6 +70,7 @@ static struct Global {
|
||||
int bExplain; /* Print SQL with EXPLAIN prefix */
|
||||
int bVerify; /* Try to verify that results are correct */
|
||||
int bMemShrink; /* Call sqlite3_db_release_memory() often */
|
||||
int eTemp; /* 0: no TEMP. 9: always TEMP. */
|
||||
int szTest; /* Scale factor for test iterations */
|
||||
const char *zWR; /* Might be WITHOUT ROWID */
|
||||
const char *zNN; /* Might be NOT NULL */
|
||||
@ -78,6 +80,12 @@ static struct Global {
|
||||
char zResult[3000]; /* Text of the current result */
|
||||
} g;
|
||||
|
||||
/* Return " TEMP" or "", as appropriate for creating a table.
|
||||
*/
|
||||
static const char *isTemp(int N){
|
||||
return g.eTemp>=N ? " TEMP" : "";
|
||||
}
|
||||
|
||||
|
||||
/* Print an error message and exit */
|
||||
static void fatal_error(const char *zMsg, ...){
|
||||
@ -459,8 +467,8 @@ void testset_main(void){
|
||||
maxb = roundup_allones(sz);
|
||||
speedtest1_begin_test(100, "%d INSERTs into table with no index", n);
|
||||
speedtest1_exec("BEGIN");
|
||||
speedtest1_exec("CREATE TABLE t1(a INTEGER %s, b INTEGER %s, c TEXT %s);",
|
||||
g.zNN, g.zNN, g.zNN);
|
||||
speedtest1_exec("CREATE%s TABLE t1(a INTEGER %s, b INTEGER %s, c TEXT %s);",
|
||||
isTemp(9), g.zNN, g.zNN, g.zNN);
|
||||
speedtest1_prepare("INSERT INTO t1 VALUES(?1,?2,?3); -- %d times", n);
|
||||
for(i=1; i<=n; i++){
|
||||
x1 = swizzle(i,maxb);
|
||||
@ -477,8 +485,9 @@ void testset_main(void){
|
||||
n = sz;
|
||||
speedtest1_begin_test(110, "%d ordered INSERTS with one index/PK", n);
|
||||
speedtest1_exec("BEGIN");
|
||||
speedtest1_exec("CREATE TABLE t2(a INTEGER %s %s, b INTEGER %s, c TEXT %s) %s",
|
||||
g.zNN, g.zPK, g.zNN, g.zNN, g.zWR);
|
||||
speedtest1_exec(
|
||||
"CREATE%s TABLE t2(a INTEGER %s %s, b INTEGER %s, c TEXT %s) %s",
|
||||
isTemp(5), g.zNN, g.zPK, g.zNN, g.zNN, g.zWR);
|
||||
speedtest1_prepare("INSERT INTO t2 VALUES(?1,?2,?3); -- %d times", n);
|
||||
for(i=1; i<=n; i++){
|
||||
x1 = swizzle(i,maxb);
|
||||
@ -495,8 +504,9 @@ void testset_main(void){
|
||||
n = sz;
|
||||
speedtest1_begin_test(120, "%d unordered INSERTS with one index/PK", n);
|
||||
speedtest1_exec("BEGIN");
|
||||
speedtest1_exec("CREATE TABLE t3(a INTEGER %s %s, b INTEGER %s, c TEXT %s) %s",
|
||||
g.zNN, g.zPK, g.zNN, g.zNN, g.zWR);
|
||||
speedtest1_exec(
|
||||
"CREATE%s TABLE t3(a INTEGER %s %s, b INTEGER %s, c TEXT %s) %s",
|
||||
isTemp(3), g.zNN, g.zPK, g.zNN, g.zNN, g.zWR);
|
||||
speedtest1_prepare("INSERT INTO t3 VALUES(?1,?2,?3); -- %d times", n);
|
||||
for(i=1; i<=n; i++){
|
||||
x1 = swizzle(i,maxb);
|
||||
@ -654,12 +664,12 @@ void testset_main(void){
|
||||
speedtest1_begin_test(180, "%d INSERTS with three indexes", n);
|
||||
speedtest1_exec("BEGIN");
|
||||
speedtest1_exec(
|
||||
"CREATE TABLE t4(\n"
|
||||
"CREATE%s TABLE t4(\n"
|
||||
" a INTEGER %s %s,\n"
|
||||
" b INTEGER %s,\n"
|
||||
" c TEXT %s\n"
|
||||
") %s",
|
||||
g.zNN, g.zPK, g.zNN, g.zNN, g.zWR);
|
||||
isTemp(1), g.zNN, g.zPK, g.zNN, g.zNN, g.zWR);
|
||||
speedtest1_exec("CREATE INDEX t4b ON t4(b)");
|
||||
speedtest1_exec("CREATE INDEX t4c ON t4(c)");
|
||||
speedtest1_exec("INSERT INTO t4 SELECT * FROM t1");
|
||||
@ -1047,7 +1057,7 @@ void testset_rtree(int p1, int p2){
|
||||
speedtest1_end_test();
|
||||
|
||||
speedtest1_begin_test(101, "Copy from rtree to a regular table");
|
||||
speedtest1_exec("CREATE TABLE t1(id INTEGER PRIMARY KEY,x0,x1,y0,y1,z0,z1)");
|
||||
speedtest1_exec(" TABLE t1(id INTEGER PRIMARY KEY,x0,x1,y0,y1,z0,z1)");
|
||||
speedtest1_exec("INSERT INTO t1 SELECT * FROM rt1");
|
||||
speedtest1_end_test();
|
||||
|
||||
@ -1321,6 +1331,13 @@ int main(int argc, char **argv){
|
||||
g.szTest = integerValue(argv[++i]);
|
||||
}else if( strcmp(z,"stats")==0 ){
|
||||
showStats = 1;
|
||||
}else if( strcmp(z,"temp")==0 ){
|
||||
if( i>=argc-1 ) fatal_error("missing argument on %s\n", argv[i]);
|
||||
i++;
|
||||
if( argv[i][0]<'0' || argv[i][0]>'9' || argv[i][1]!=0 ){
|
||||
fatal_error("argument to --temp should be integer between 0 and 9");
|
||||
}
|
||||
g.eTemp = argv[i][0] - '0';
|
||||
}else if( strcmp(z,"testset")==0 ){
|
||||
if( i>=argc-1 ) fatal_error("missing argument on %s\n", argv[i]);
|
||||
zTSet = argv[++i];
|
||||
@ -1352,11 +1369,7 @@ int main(int argc, char **argv){
|
||||
argv[i], argv[0]);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if( zDbName==0 ){
|
||||
fatal_error(zHelp, argv[0]);
|
||||
}
|
||||
#endif
|
||||
if( zDbName!=0 ) unlink(zDbName);
|
||||
#if SQLITE_VERSION_NUMBER>=3006001
|
||||
if( nHeap>0 ){
|
||||
pHeap = malloc( nHeap );
|
||||
|
@ -147,7 +147,7 @@ int main(int argc, char **argv){
|
||||
}else if( strcmp(z,"inv")==0 ){
|
||||
if( n>0 ) a[n-1] = -a[n-1];
|
||||
}else if( z[0]=='^' ){
|
||||
a[n++] = atoi(z+1);
|
||||
a[n++] = (LogEst)atoi(z+1);
|
||||
}else if( isInteger(z) ){
|
||||
a[n++] = logEstFromInteger(atoi(z));
|
||||
}else if( isFloat(z) && z[0]!='-' ){
|
||||
|
@ -151,7 +151,7 @@ static unsigned char *fileRead(sqlite3_int64 ofst, int nByte){
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
lseek(g.dbfd, ofst, SEEK_SET);
|
||||
lseek(g.dbfd, (long)ofst, SEEK_SET);
|
||||
got = read(g.dbfd, aData, nByte);
|
||||
if( got>0 && got<nByte ) memset(aData+got, 0, nByte-got);
|
||||
}
|
||||
@ -1098,7 +1098,7 @@ int main(int argc, char **argv){
|
||||
sqlite3_free(zPgSz);
|
||||
|
||||
printf("Pagesize: %d\n", g.pagesize);
|
||||
g.mxPage = (szFile+g.pagesize-1)/g.pagesize;
|
||||
g.mxPage = (int)((szFile+g.pagesize-1)/g.pagesize);
|
||||
|
||||
printf("Available pages: 1..%d\n", g.mxPage);
|
||||
if( nArg==2 ){
|
||||
|
Loading…
x
Reference in New Issue
Block a user