Merge latest trunk changes into this branch.

FossilOrigin-Name: d468101b421e073e9debd7381bde1d36af31369e
This commit is contained in:
dan 2016-08-02 16:24:10 +00:00
commit 080508a186
20 changed files with 191 additions and 102 deletions

View File

@ -1223,6 +1223,7 @@ static void jsonQuoteFunc(
sqlite3_value **argv
){
JsonString jx;
UNUSED_PARAM(argc);
jsonInit(&jx, ctx);
jsonAppendValue(&jx, argv[0]);

View File

@ -1,5 +1,5 @@
C Add\smissing\scomments\sand\smake\ssome\scode\son\sthis\sbranch\sclearer.
D 2016-08-02T16:18:35.278
C Merge\slatest\strunk\schanges\sinto\sthis\sbranch.
D 2016-08-02T16:24:10.101
F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233
@ -212,7 +212,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
F ext/misc/json1.c d51a764ba43a49e191bc3536238bfab3def258ca
F ext/misc/json1.c 9799e4252b305edcbe659329eec3ca80ed85f968
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
F ext/misc/percentile.c 92699c8cd7d517ff610e6037e56506f8904dae2e
F ext/misc/regexp.c a68d25c659bd2d893cd1215667bbf75ecb9dc7d4
@ -347,7 +347,7 @@ F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4
F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da
F src/insert.c 8f4e9fcbd8e95e85f15647ba8b413b18d556ec2b
F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e
F src/loadext.c c3c2a37e4ce940d17c73971738754d412c79e09d
F src/loadext.c dd7a2b77902cc66c22555aef02e1a682554b7aec
F src/main.c 16c1b2114eae8804caf3a8de8cb47bf2c6d83ad3
F src/malloc.c 1443d1ad95d67c21d77af7ae3f44678252f0efec
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
@ -384,16 +384,16 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
F src/resolve.c cca3aa77b95706df5d635a2141a4d1de60ae6598
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
F src/select.c 952aa1b4148ed4c0024586e9049b8742a765c6f9
F src/shell.c 9351fc6de11e1d908648c0a92d85627138e3dee5
F src/sqlite.h.in cd10e4206b91c4bf03f121ab9209a14af0b48f14
F src/shell.c 79dda477be6c96eba6e952a934957ad36f87acc7
F src/sqlite.h.in e011dcc3942e6ddc8dd7b894e9e6702e4269161e
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h f4206565eb5f5cef9a1544d32a076b5f47af1bdc
F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
F src/sqliteInt.h ccfffd24330a373a971fee69b6b06a9b7e9ddced
F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
F src/status.c 5b18f9526900f61189ab0b83f1ef41d9f871a2ab
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
F src/tclsqlite.c bdae822f21e229b6daced15938b6343ce44ef454
F src/test1.c 906a04b649c7139e943193a3905d583e325c30c7
F src/test1.c 0a0909cf7962d2359db329c08d15b90b4b6e724f
F src/test2.c b7174313e993754303a8b33c43df7c44b46857ab
F src/test3.c 1339a40be39650ae83894b6578f971dc7f96ea8a
F src/test4.c 18ec393bb4d0ad1de729f0b94da7267270f3d8e6
@ -403,7 +403,7 @@ F src/test7.c 5612e9aecf934d6df7bba6ce861fdf5ba5456010
F src/test8.c 4f4904721167b32f7a4fa8c7b32a07a673d6cc86
F src/test9.c 12e5ba554d2d1cbe0158f6ab3f7ffcd7a86ee4e5
F src/test_async.c 195ab49da082053fdb0f949c114b806a49ca770a
F src/test_autoext.c cc69375c006b7bac6094ec602f52525350fd5229
F src/test_autoext.c 915d245e736652a219a907909bb6710f0d587871
F src/test_backup.c bf5da90c9926df0a4b941f2d92825a01bbe090a0
F src/test_bestindex.c d23f80d334c59662af69191854c76b8d3d0c8c96
F src/test_blob.c a0f7ad49a0c9d4b72f693fe2a71c58d7e507174d
@ -412,7 +412,7 @@ F src/test_config.c 4d3d4a886416f369771d69a6dba926866deda788
F src/test_demovfs.c a0c3bdd45ed044115c2c9f7779e56eafff18741e
F src/test_devsym.c 4e58dec2602d8e139ca08659f62a62450587cb58
F src/test_fs.c ac62ce7d5c0c23aa6932891cad5746945564c91c
F src/test_func.c 6f34b19ae097e3cf0b0fe5d6904cb9900e67f2ff
F src/test_func.c a2b4993da973b0ea60dd5d51a7066238ede8c329
F src/test_hexio.c 1d4469ca61ab202a1fcec6543f584d2407205e8d
F src/test_init.c 4413c211a94b62157ca4c145b3f27c497f03c664
F src/test_intarray.c 988fc61cb0ff539f4172c0d95f15287c92516f64
@ -420,7 +420,7 @@ F src/test_intarray.h f3b7672f5d1056eac563c0d6ea8480a660b1475c
F src/test_journal.c d3b83f2bcb7792c709e57abddc456a2b1818643a
F src/test_loadext.c 337056bae59f80b9eb00ba82088b39d0f4fe6dfd
F src/test_malloc.c c05f6c40bd6c8bfe5f1718212f81fd5687f91766
F src/test_multiplex.c 371d3874fd6365f18468d1c131e153e5c9abe95e
F src/test_multiplex.c 7c5b218d855cd0505a43185d55283b3fc257c8da
F src/test_multiplex.h 5436d03f2d0501d04f3ed50a75819e190495b635
F src/test_mutex.c 7f4337ba23ee6b1d2ec81c189653608cb069926a
F src/test_onefile.c 416f87a28d6d673352d33fc4b1c7d39db878e50f
@ -435,7 +435,7 @@ F src/test_sqllog.c 0d138a8180a312bf996b37fa66da5c5799d4d57b
F src/test_superlock.c 4839644b9201da822f181c5bc406c0b2385f672e
F src/test_syscall.c 1073306ba2e9bfc886771871a13d3de281ed3939
F src/test_tclvar.c df9fe1213c2634687a9ca0b0bec0d2119d359ae3
F src/test_thread.c 89f0e47dac64e7ab15ca0a4fc87e0882c495ae21
F src/test_thread.c 911d15fb14e19c0c542bdc8aabf981c2f10a4858
F src/test_vfs.c f0186261a24de2671d080bcd8050732f0cb64f6e
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
F src/test_windirent.c 8f5fada630348558d5745b334702f301da1ffc61
@ -458,12 +458,12 @@ F src/vdbeblob.c 83d2d266383157b02e2b809350bb197e89d7895b
F src/vdbemem.c 1ecaa5ee0caff07255f25d04e8dc88befb6f88d1
F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c
F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834
F src/vtab.c 948d2d4984219eee37a7bf427d6667e21e6eb92e
F src/vtab.c 6fece06fdd50eb2b0673e37e627ce6710e4af5be
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 02eeecc265f6ffd0597378f5d8ae9070b62a406a
F src/wal.h 6dd221ed384afdc204bc61e25c23ef7fd5a511f2
F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354
F src/where.c a1c2fde60e806f1e045fdf745bfa449e3be82f55
F src/where.c 9dcbc1be0e8e84b1d323dae55983bbb902a6c484
F src/whereInt.h 14dd243e13b81cbb0a66063d38b70f93a7d6e613
F src/wherecode.c c01c8af9311b5d6d65de311101f72d94a11ae506
F src/whereexpr.c 4a8cefc7c122132ac9f3ed125c61629a0e3de094
@ -746,7 +746,7 @@ F test/fts3aux2.test 7ae2b2c13aefdf4169279a27a5f51780ce57f6ba
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
F test/fts3comp1.test a0f5b16a2df44dd0b15751787130af2183167c0c
F test/fts3conf.test 1c8b8adb0ab28a41b68d1514df44380bd7353402
F test/fts3conf.test 60317efd562080e198b5bdc9fcd222ce32cf01d7
F test/fts3corrupt.test 2710b77983cc7789295ddbffea52c1d3b7506dbb
F test/fts3corrupt2.test 6d96efae2f8a6af3eeaf283aba437e6d0e5447ba
F test/fts3cov.test e0fb00d8b715ddae4a94c305992dfc3ef70353d7
@ -889,7 +889,7 @@ F test/like2.test 3b2ee13149ba4a8a60b59756f4e5d345573852da
F test/like3.test 3608a2042b6f922f900fbfd5d3ce4e7eca57f7c4
F test/limit.test 0c99a27a87b14c646a9d583c7c89fd06c352663e
F test/limit2.test 55c9f4d08c89311e00afd75045ee1a2aca205cb4
F test/loadext.test 42a3b8166dfcadcb0e0c8710dc520d97c31a8b98
F test/loadext.test d077450695ddb5c1ea3ad7d48e5f5850fe732ad9
F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7
F test/lock.test be4fe08118fb988fed741f429b7dd5d65e1c90db
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
@ -1010,7 +1010,7 @@ F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/regexp2.test aa7ffcc21350007a78361b82bcf3b74d12227144
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/releasetest.tcl 3a66c7b8fbe55bcd97c907217c3d812d1d3c6b93
F test/releasetest.tcl 53560b838b79c468ec9973e0dfa3d8892628887f
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
F test/rollback2.test 8435d6ff0f13f51d2a4181c232e706005fa90fc5
@ -1146,6 +1146,7 @@ F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c a70a8e94bef23339d34226eb9521015ef99f4df8
F test/threadtest3.c 38a612ea62854349ed66372f330a40d73c5cf956
F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925
F test/time-wordcount.sh 8e0b0f8109367827ad5d58f5cc849705731e4b90
F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2
@ -1420,7 +1421,7 @@ F test/without_rowid3.test aad4f9d383e199349b6c7e508a778f7dff5dff79
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
F test/without_rowid5.test 89b1c587bd92a0590e440da33e7666bf4891572a
F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e
F test/wordcount.c 2a0a6c0d0e8e8bbbac1f06d72a6791828c37c0cf
F test/wordcount.c 97856eec21fd00d77da720007b1888c383f63dcf
F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
F test/zerodamage.test e59a56443d6298ecf7435f618f0b27654f0c849e
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
@ -1512,7 +1513,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 3ef75d45ebcd8ede91596d69e55fe7d685008a60
R ede02eaf849a0a0aa8962160f6f4e818
P 6937677cc2c2db6b21f997559f88a339466cd15b b23c10ac8f65bc88a6c7d88e140217222eb4cbe5
R bdbd7298ee0fa9cbc2f39cf393323b85
U dan
Z d2db5fc489c89774ca610a9face0568f
Z eb5884061bde99d3b56b31ee8ac9fde1

View File

@ -1 +1 @@
6937677cc2c2db6b21f997559f88a339466cd15b
d468101b421e073e9debd7381bde1d36af31369e

View File

@ -21,15 +21,6 @@
#include <string.h>
#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** This is the function signature used for all extension entry points.
*/
typedef int (*sqlite3_loadext_entry)(
sqlite3 *db, /* Handle to the database. */
char **pzErrMsg, /* Used to set error string on failure. */
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
);
/*
** Some API routines are omitted when various features are
** excluded from a build of SQLite. Substitute a NULL pointer
@ -676,7 +667,7 @@ static SQLITE_WSD struct sqlite3AutoExtList {
** loaded by every new database connection.
*/
int sqlite3_auto_extension(
int (*xInit)(sqlite3 *, char **, const sqlite3_api_routines *)
void (*xInit)(void)
){
int rc = SQLITE_OK;
#ifndef SQLITE_OMIT_AUTOINIT
@ -693,7 +684,7 @@ int sqlite3_auto_extension(
wsdAutoextInit;
sqlite3_mutex_enter(mutex);
for(i=0; i<wsdAutoext.nExt; i++){
if( wsdAutoext.aExt[i]==(void*)xInit ) break;
if( wsdAutoext.aExt[i]==xInit ) break;
}
if( i==wsdAutoext.nExt ){
u64 nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]);
@ -703,7 +694,7 @@ int sqlite3_auto_extension(
rc = SQLITE_NOMEM_BKPT;
}else{
wsdAutoext.aExt = aNew;
wsdAutoext.aExt[wsdAutoext.nExt] = (void*)xInit;
wsdAutoext.aExt[wsdAutoext.nExt] = xInit;
wsdAutoext.nExt++;
}
}
@ -723,7 +714,7 @@ int sqlite3_auto_extension(
** was not on the list.
*/
int sqlite3_cancel_auto_extension(
int (*xInit)(sqlite3 *, char **, const sqlite3_api_routines *)
void (*xInit)(void)
){
#if SQLITE_THREADSAFE
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
@ -733,7 +724,7 @@ int sqlite3_cancel_auto_extension(
wsdAutoextInit;
sqlite3_mutex_enter(mutex);
for(i=(int)wsdAutoext.nExt-1; i>=0; i--){
if( wsdAutoext.aExt[i]==(void*)xInit ){
if( wsdAutoext.aExt[i]==xInit ){
wsdAutoext.nExt--;
wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt];
n++;

View File

@ -2550,6 +2550,8 @@ static int sql_trace_callback(
void *pX
){
FILE *f = (FILE*)pArg;
UNUSED_PARAMETER(mType);
UNUSED_PARAMETER(pP);
if( f ){
const char *z = (const char*)pX;
int i = (int)strlen(z);

View File

@ -1045,6 +1045,16 @@ struct sqlite3_io_methods {
*/
typedef struct sqlite3_mutex sqlite3_mutex;
/*
** CAPI3REF: Loadable Extension Thunk
**
** A pointer to the opaque sqlite3_api_routines structure is passed as
** the third parameter to entry points of [loadable extensions]. This
** structure must be typedefed in order to work around compiler warnings
** on some platforms.
*/
typedef struct sqlite3_api_routines sqlite3_api_routines;
/*
** CAPI3REF: OS Interface Object
**
@ -2242,7 +2252,7 @@ int sqlite3_complete16(const void *sql);
** A busy handler must not close the database connection
** or [prepared statement] that invoked the busy handler.
*/
int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
/*
** CAPI3REF: Set A Busy Timeout
@ -4694,12 +4704,13 @@ sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
** SQLite will invoke the destructor function X with parameter P exactly
** once, when the metadata is discarded.
** SQLite is free to discard the metadata at any time, including: <ul>
** <li> when the corresponding function parameter changes, or
** <li> when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
** SQL statement, or
** <li> when sqlite3_set_auxdata() is invoked again on the same parameter, or
** <li> during the original sqlite3_set_auxdata() call when a memory
** allocation error occurs. </ul>)^
** <li> ^(when the corresponding function parameter changes)^, or
** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
** SQL statement)^, or
** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
** parameter)^, or
** <li> ^(during the original sqlite3_set_auxdata() call when a memory
** allocation error occurs.)^ </ul>
**
** Note the last bullet in particular. The destructor X in
** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
@ -5660,8 +5671,8 @@ int sqlite3_load_extension(
**
** ^This interface enables or disables both the C-API
** [sqlite3_load_extension()] and the SQL function [load_extension()].
** Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
** to enable or disable only the C-API.
** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
** to enable or disable only the C-API.)^
**
** <b>Security warning:</b> It is recommended that extension loading
** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
@ -5681,7 +5692,7 @@ int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
**
** ^(Even though the function prototype shows that xEntryPoint() takes
** no arguments and returns void, SQLite invokes xEntryPoint() with three
** arguments and expects and integer result as if the signature of the
** arguments and expects an integer result as if the signature of the
** entry point where as follows:
**
** <blockquote><pre>
@ -5707,10 +5718,7 @@ int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
** See also: [sqlite3_reset_auto_extension()]
** and [sqlite3_cancel_auto_extension()]
*/
typedef struct sqlite3_api_routines sqlite3_api_routines;
int sqlite3_auto_extension(
int (*xEntryPoint)(sqlite3 *, char **, const sqlite3_api_routines *)
);
int sqlite3_auto_extension(void(*xEntryPoint)(void));
/*
** CAPI3REF: Cancel Automatic Extension Loading
@ -5722,9 +5730,7 @@ int sqlite3_auto_extension(
** unregistered and it returns 0 if X was not on the list of initialization
** routines.
*/
int sqlite3_cancel_auto_extension(
int (*xEntryPoint)(sqlite3 *, char **, const sqlite3_api_routines *)
);
int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
/*
** CAPI3REF: Reset Automatic Extension Loading

View File

@ -19,8 +19,6 @@
#define SQLITE3EXT_H
#include "sqlite3.h"
typedef struct sqlite3_api_routines sqlite3_api_routines;
/*
** The following structure holds pointers to all of the SQLite API
** routines.
@ -251,13 +249,12 @@ struct sqlite3_api_routines {
char *(*vsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(int(*)(sqlite3*,char**,const sqlite3_api_routines*));
int (*auto_extension)(void(*)(void));
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
void(*)(void*));
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
void(*)(void*),unsigned char);
int (*cancel_auto_extension)(int(*)(sqlite3*,char**,
const sqlite3_api_routines*));
int (*cancel_auto_extension)(void(*)(void));
int (*load_extension)(sqlite3*,const char*,const char*,char**);
void *(*malloc64)(sqlite3_uint64);
sqlite3_uint64 (*msize)(void*);

View File

@ -158,7 +158,7 @@ int sqlite3_status64(
return SQLITE_OK;
}
int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
sqlite3_int64 iCur, iHwtr;
sqlite3_int64 iCur = 0, iHwtr = 0;
int rc;
#ifdef SQLITE_ENABLE_API_ARMOR
if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;

View File

@ -6742,7 +6742,6 @@ static int SQLITE_TCLAPI optimization_control(
return TCL_OK;
}
typedef struct sqlite3_api_routines sqlite3_api_routines;
/*
** load_static_extension DB NAME ...
**

View File

@ -100,7 +100,7 @@ static int SQLITE_TCLAPI autoExtSqrObjCmd(
int objc,
Tcl_Obj *CONST objv[]
){
int rc = sqlite3_auto_extension(sqr_init);
int rc = sqlite3_auto_extension((void(*)(void))sqr_init);
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
return SQLITE_OK;
}
@ -116,7 +116,7 @@ static int SQLITE_TCLAPI cancelAutoExtSqrObjCmd(
int objc,
Tcl_Obj *CONST objv[]
){
int rc = sqlite3_cancel_auto_extension(sqr_init);
int rc = sqlite3_cancel_auto_extension((void(*)(void))sqr_init);
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
return SQLITE_OK;
}
@ -132,7 +132,7 @@ static int SQLITE_TCLAPI autoExtCubeObjCmd(
int objc,
Tcl_Obj *CONST objv[]
){
int rc = sqlite3_auto_extension(cube_init);
int rc = sqlite3_auto_extension((void(*)(void))cube_init);
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
return SQLITE_OK;
}
@ -148,7 +148,7 @@ static int SQLITE_TCLAPI cancelAutoExtCubeObjCmd(
int objc,
Tcl_Obj *CONST objv[]
){
int rc = sqlite3_cancel_auto_extension(cube_init);
int rc = sqlite3_cancel_auto_extension((void(*)(void))cube_init);
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
return SQLITE_OK;
}
@ -164,7 +164,7 @@ static int SQLITE_TCLAPI autoExtBrokenObjCmd(
int objc,
Tcl_Obj *CONST objv[]
){
int rc = sqlite3_auto_extension(broken_init);
int rc = sqlite3_auto_extension((void(*)(void))broken_init);
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
return SQLITE_OK;
}
@ -180,7 +180,7 @@ static int SQLITE_TCLAPI cancelAutoExtBrokenObjCmd(
int objc,
Tcl_Obj *CONST objv[]
){
int rc = sqlite3_cancel_auto_extension(broken_init);
int rc = sqlite3_cancel_auto_extension((void(*)(void))broken_init);
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
return SQLITE_OK;
}

View File

@ -25,7 +25,6 @@
#include "sqliteInt.h"
#include "vdbeInt.h"
/*
** Allocate nByte bytes of space using sqlite3_malloc(). If the
** allocation fails, call sqlite3_result_error_nomem() to notify
@ -704,9 +703,9 @@ static int SQLITE_TCLAPI autoinstall_test_funcs(
Tcl_Obj *CONST objv[]
){
extern int Md5_Register(sqlite3 *, char **, const sqlite3_api_routines *);
int rc = sqlite3_auto_extension(registerTestFunctions);
int rc = sqlite3_auto_extension((void(*)(void))registerTestFunctions);
if( rc==SQLITE_OK ){
rc = sqlite3_auto_extension(Md5_Register);
rc = sqlite3_auto_extension((void(*)(void))Md5_Register);
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
return TCL_OK;
@ -791,6 +790,7 @@ abuse_err:
return TCL_ERROR;
}
/*
** Register commands with the TCL interpreter.
*/
@ -809,7 +809,7 @@ int Sqlitetest_func_Init(Tcl_Interp *interp){
Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0);
}
sqlite3_initialize();
sqlite3_auto_extension(registerTestFunctions);
sqlite3_auto_extension(Md5_Register);
sqlite3_auto_extension((void(*)(void))registerTestFunctions);
sqlite3_auto_extension((void(*)(void))Md5_Register);
return TCL_OK;
}

View File

@ -1197,7 +1197,7 @@ int sqlite3_multiplex_initialize(const char *zOrigVfsName, int makeDefault){
gMultiplex.sIoMethodsV2.xShmUnmap = multiplexShmUnmap;
sqlite3_vfs_register(&gMultiplex.sThisVfs, makeDefault);
sqlite3_auto_extension(multiplexFuncInit);
sqlite3_auto_extension((void(*)(void))multiplexFuncInit);
return SQLITE_OK;
}

View File

@ -280,7 +280,7 @@ static int SQLITE_TCLAPI sqlthread_open(
const char *zFilename;
sqlite3 *db;
char zBuf[100];
extern int Md5_Register(sqlite3 *, char **, const sqlite3_api_routines *);
extern int Md5_Register(sqlite3*,char**,const sqlite3_api_routines*);
UNUSED_PARAMETER(clientData);
UNUSED_PARAMETER(objc);

View File

@ -947,7 +947,10 @@ int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){
if( rc==SQLITE_OK ){
int iSvpt = db->nStatement + db->nSavepoint;
addToVTrans(db, pVTab);
if( iSvpt ) rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, iSvpt-1);
if( iSvpt && pModule->xSavepoint ){
pVTab->iSavepoint = iSvpt;
rc = pModule->xSavepoint(pVTab->pVtab, iSvpt-1);
}
}
}
}

View File

@ -2862,9 +2862,9 @@ static int whereLoopAddBtree(
LogEst nLookup = rSize + 16; /* Base cost: N*3 */
int ii;
int iCur = pSrc->iCursor;
WhereClause *pWC = &pWInfo->sWC;
for(ii=0; ii<pWC->nTerm; ii++){
WhereTerm *pTerm = &pWC->a[ii];
WhereClause *pWC2 = &pWInfo->sWC;
for(ii=0; ii<pWC2->nTerm; ii++){
WhereTerm *pTerm = &pWC2->a[ii];
if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){
break;
}

View File

@ -211,4 +211,42 @@ do_execsql_test 4.2.2 {
INSERT INTO t01(t01) VALUES('integrity-check');
} {}
do_execsql_test 4.3.1 {
CREATE VIRTUAL TABLE t02 USING fts4;
INSERT INTO t01 VALUES('1 1 1');
INSERT INTO t02 VALUES('2 2 2');
BEGIN;
SAVEPOINT abc;
INSERT INTO t01 VALUES('a b c');
INSERT INTO t02 VALUES('a b c');
ROLLBACK TO abc;
COMMIT;
}
do_execsql_test 4.3.2 {
SELECT * FROM t01 WHERE t01 MATCH 'b';
INSERT INTO t01(t01) VALUES('integrity-check');
} {}
do_execsql_test 4.4.1 {
CREATE TABLE A(ID INTEGER PRIMARY KEY, AnotherID INTEGER, Notes TEXT);
CREATE VIRTUAL TABLE AFTS USING FTS4 (Notes);
CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN
DELETE FROM AFTS WHERE rowid=OLD.ID;
END;
CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT);
CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes);
CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN
DELETE FROM BFTS WHERE rowid=OLD.ID;
END;
}
do_execsql_test 4.4.2 {
BEGIN TRANSACTION;
DELETE FROM A WHERE AnotherID=1;
DELETE FROM B WHERE ID=1;
COMMIT;
}
finish_test

View File

@ -81,7 +81,7 @@ if {![file exists $testextension]} {
set testextsrc $srcdir/test_loadext.c
set cmdline [concat exec gcc $gcc_shared]
lappend cmdline -Wall -I$srcdir -I. -g $testextsrc -o $testextension
lappend cmdline -Wall -I$srcdir -I. -I.. -g $testextsrc -o $testextension
if {[catch $cmdline msg]} {
puts "Skipping loadext tests: Test extension not built..."

View File

@ -58,6 +58,10 @@ array set ::Configs [strip_comments {
-DSQLITE_ENABLE_STAT4
--enable-session
}
"Stdcall" {
-DUSE_STDCALL=1
-O2
}
"Have-Not" {
# The "Have-Not" configuration sets all possible -UHAVE_feature options
# in order to verify that the code works even on platforms that lack
@ -298,10 +302,12 @@ array set ::Platforms [strip_comments {
"Apple" "threadtest fulltest"
}
"Windows NT-intel" {
"Stdcall" test
"Have-Not" test
"Default" "mptest fulltestonly"
}
"Windows NT-amd64" {
"Stdcall" test
"Have-Not" test
"Default" "mptest fulltestonly"
}
@ -725,6 +731,9 @@ proc makeCommand { targets makeOpts cflags opts } {
set nmakeDir [file nativename $::SRCDIR]
set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]]
lappend result nmake /f $nmakeFile TOP=$nmakeDir
if {[regexp {USE_STDCALL=1} $cflags]} {
lappend result USE_STDCALL=1
}
} else {
lappend result make
}

34
test/time-wordcount.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/sh
#
# This script runs the wordcount program in different ways and generates
# an output useful for performance comparisons.
#
# Select the source text to be analyzed.
#
if test "x$1" = "x";
then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
fi
# Do test runs
#
rm -f wcdb1.db
./wordcount --tag A: --timer --summary wcdb1.db $* --insert
rm -f wcdb2.db
./wordcount --tag B: --timer --summary wcdb2.db $* --insert --without-rowid
rm -f wcdb1.db
./wordcount --tag C: --timer --summary wcdb1.db $* --replace
rm -f wcdb2.db
./wordcount --tag D: --timer --summary wcdb2.db $* --replace --without-rowid
rm -f wcdb1.db
./wordcount --tag E: --timer --summary wcdb1.db $* --select
rm -f wcdb2.db
./wordcount --tag F: --timer --summary wcdb2.db $* --select --without-rowid
./wordcount --tag G: --timer --summary wcdb1.db $* --query
./wordcount --tag H: --timer --summary wcdb1.db $* --query --without-rowid
./wordcount --tag I: --timer --summary wcdb1.db $* --delete
./wordcount --tag J: --timer --summary wcdb2.db $* --delete --without-rowid
# Clean up temporary files created.
#
rm -f wcdb1.db wcdb2.db

View File

@ -30,6 +30,7 @@
** --nosync Use PRAGMA synchronous=OFF
** --journal MMMM Use PRAGMA journal_mode=MMMM
** --timer Time the operation of this program
** --tag NAME Tag all output using NAME. Use only stdout.
**
** Modes:
**
@ -82,6 +83,9 @@
#include "sqlite3.h"
#define ISALPHA(X) isalpha((unsigned char)(X))
/* Output tag */
char *zTag = "--";
/* Return the current wall-clock time */
static sqlite3_int64 realTime(void){
static sqlite3_vfs *clockVfs = 0;
@ -115,7 +119,7 @@ static void traceCallback(void *NotUsed, const char *zSql){
** each column separated by a single space. */
static int printResult(void *NotUsed, int nArg, char **azArg, char **azNm){
int i;
printf("--");
printf("%s", zTag);
for(i=0; i<nArg; i++){
printf(" %s", azArg[i] ? azArg[i] : "(null)");
}
@ -220,6 +224,7 @@ int main(int argc, char **argv){
FILE *in; /* The open input file */
int rc; /* Return code from an SQLite interface */
int iCur, iHiwtr; /* Statistics values, current and "highwater" */
FILE *pTimer = stderr; /* Output channel for the timer */
sqlite3_int64 sumCnt = 0; /* Sum in QUERY mode */
sqlite3_int64 startTime;
char zInput[2000]; /* A single line of input */
@ -266,6 +271,9 @@ int main(int argc, char **argv){
commitInterval = atoi(argv[i]);
}else if( strcmp(z,"journal")==0 && i<argc-1 ){
zJMode = argv[++i];
}else if( strcmp(z,"tag")==0 && i<argc-1 ){
zTag = argv[++i];
pTimer = stdout;
}else{
fatal_error("unknown option: %s\n", argv[i]);
}
@ -462,11 +470,11 @@ int main(int argc, char **argv){
sqlite3_finalize(pDelete);
if( iMode==MODE_QUERY ){
printf("sum of cnt: %lld\n", sumCnt);
printf("%s sum of cnt: %lld\n", zTag, sumCnt);
rc = sqlite3_prepare_v2(db,"SELECT sum(cnt*cnt) FROM wordcount", -1,
&pSelect, 0);
if( rc==SQLITE_OK && sqlite3_step(pSelect)==SQLITE_ROW ){
printf("double-check: %lld\n", sqlite3_column_int64(pSelect, 0));
printf("%s double-check: %lld\n", zTag, sqlite3_column_int64(pSelect, 0));
}
sqlite3_finalize(pSelect);
}
@ -474,10 +482,10 @@ int main(int argc, char **argv){
if( showTimer ){
sqlite3_int64 elapseTime = realTime() - startTime;
fprintf(stderr, "%3d.%03d wordcount", (int)(elapseTime/1000),
fprintf(pTimer, "%3d.%03d wordcount", (int)(elapseTime/1000),
(int)(elapseTime%1000));
for(i=1; i<argc; i++) if( i!=showTimer ) fprintf(stderr, " %s", argv[i]);
fprintf(stderr, "\n");
for(i=1; i<argc; i++) if( i!=showTimer ) fprintf(pTimer, " %s", argv[i]);
fprintf(pTimer, "\n");
}
if( showSummary ){
@ -501,25 +509,25 @@ int main(int argc, char **argv){
** have been finalized */
if( showStats ){
sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, 0);
printf("-- Lookaside Slots Used: %d (max %d)\n", iCur,iHiwtr);
printf("%s Lookaside Slots Used: %d (max %d)\n", zTag, iCur,iHiwtr);
sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, 0);
printf("-- Successful lookasides: %d\n", iHiwtr);
printf("%s Successful lookasides: %d\n", zTag, iHiwtr);
sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur,&iHiwtr,0);
printf("-- Lookaside size faults: %d\n", iHiwtr);
printf("%s Lookaside size faults: %d\n", zTag, iHiwtr);
sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur,&iHiwtr,0);
printf("-- Lookaside OOM faults: %d\n", iHiwtr);
printf("%s Lookaside OOM faults: %d\n", zTag, iHiwtr);
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, 0);
printf("-- Pager Heap Usage: %d bytes\n", iCur);
printf("%s Pager Heap Usage: %d bytes\n", zTag, iCur);
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
printf("-- Page cache hits: %d\n", iCur);
printf("%s Page cache hits: %d\n", zTag, iCur);
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
printf("-- Page cache misses: %d\n", iCur);
printf("%s Page cache misses: %d\n", zTag, iCur);
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
printf("-- Page cache writes: %d\n", iCur);
printf("%s Page cache writes: %d\n", zTag, iCur);
sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, 0);
printf("-- Schema Heap Usage: %d bytes\n", iCur);
printf("%s Schema Heap Usage: %d bytes\n", zTag, iCur);
sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, 0);
printf("-- Statement Heap Usage: %d bytes\n", iCur);
printf("%s Statement Heap Usage: %d bytes\n", zTag, iCur);
}
sqlite3_close(db);
@ -528,19 +536,19 @@ int main(int argc, char **argv){
** has closed. Memory usage should be zero at this point. */
if( showStats ){
sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, 0);
printf("-- Memory Used (bytes): %d (max %d)\n", iCur,iHiwtr);
printf("%s Memory Used (bytes): %d (max %d)\n", zTag,iCur,iHiwtr);
sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, 0);
printf("-- Outstanding Allocations: %d (max %d)\n", iCur,iHiwtr);
printf("%s Outstanding Allocations: %d (max %d)\n",zTag,iCur,iHiwtr);
sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, 0);
printf("-- Pcache Overflow Bytes: %d (max %d)\n", iCur,iHiwtr);
printf("%s Pcache Overflow Bytes: %d (max %d)\n",zTag,iCur,iHiwtr);
sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, 0);
printf("-- Scratch Overflow Bytes: %d (max %d)\n", iCur,iHiwtr);
printf("%s Scratch Overflow Bytes: %d (max %d)\n",zTag,iCur,iHiwtr);
sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, 0);
printf("-- Largest Allocation: %d bytes\n",iHiwtr);
printf("%s Largest Allocation: %d bytes\n",zTag,iHiwtr);
sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, 0);
printf("-- Largest Pcache Allocation: %d bytes\n",iHiwtr);
printf("%s Largest Pcache Allocation: %d bytes\n",zTag,iHiwtr);
sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, 0);
printf("-- Largest Scratch Allocation: %d bytes\n", iHiwtr);
printf("%s Largest Scratch Allocation: %d bytes\n",zTag,iHiwtr);
}
return 0;
}