Compare commits

...

6 Commits

Author SHA1 Message Date
mistachkin 75940f9d6e Merge updates from trunk.
FossilOrigin-Name: 10ee36d012e6ee82febbe0ef2e90381e215afb90
2015-05-13 04:52:26 +00:00
mistachkin 8424af0f48 Use the database mutex where applicable.
FossilOrigin-Name: 28cfdabc471e132a856292781767777c6390ea3c
2015-05-12 23:33:32 +00:00
mistachkin 3a02daf8d2 Fix a couple of typos in comments.
FossilOrigin-Name: e908365faea6987f98dc3954b932f9a353241bfc
2015-05-12 23:31:02 +00:00
mistachkin 3971224e9c Improve API armor integration. Fix harmless compiler warnings.
FossilOrigin-Name: fbf29b453f8b49b6b21b8b0a9e09189e35e53986
2015-05-12 23:28:03 +00:00
mistachkin 6ff6032b15 Modify the new functions to make them return a standard return code.
FossilOrigin-Name: 02f694d5babe5fc03a4fcec001e3d878fa58f2c8
2015-05-12 23:20:23 +00:00
drh 25e838549c Experimental API extension for recovering the current trace and profile
callbacks on a database connection.

FossilOrigin-Name: 9de33768fff2d8952fdff552d918da96e5267e5d
2015-05-12 21:27:36 +00:00
6 changed files with 69 additions and 19 deletions
+9 -9
View File
@@ -1,5 +1,5 @@
C Enhancements\sto\sthe\sMSVC\smakefile.
D 2015-05-13T04:50:30.732
C Merge\supdates\sfrom\strunk.
D 2015-05-13T04:52:26.726
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in edfc69769e613a6359c42c06ea1d42c3bece1736
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -196,7 +196,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
F src/loadext.c 29255bbe1cfb2ce9bbff2526a5ecfddcb49b9271
F src/main.c bf14bc6a321965e528d8ab30087e9440335f2e4b
F src/main.c bd2c1bb33f9d01576a028c4c21d5beba86ee316c
F src/malloc.c 5bc15d525811d387b37c29f2e368143460e41e96
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987
@@ -233,10 +233,10 @@ F src/resolve.c 99eabf7eff0bfa65b75939b46caa82e2b2133f28
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
F src/select.c 1b0bfc7d59e48c26b895a6b719157111a617d9e3
F src/shell.c 07dda7cd692911d2f22269953418d049f2e2c0ee
F src/sqlite.h.in bf3fe5eba3a5142477b8dae3cfce627c3e971455
F src/sqlite.h.in 87908d43d02f8b813b151e3586da22f2a6fa12ed
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
F src/sqliteInt.h c9f77bd02f419dcc8c644c5032c42eb29069a545
F src/sqliteInt.h 51bf2dcd742399257fdc6409cae1c84bf66900f2
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
@@ -291,7 +291,7 @@ F src/tokenize.c b15511a2396641792f386ceb440d1d922972a78e
F src/trigger.c 322f23aad694e8f31d384dcfa386d52a48d3c52f
F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
F src/util.c a6431c92803b975b7322724a7b433e538d243539
F src/util.c bb07b2e79e2dff45384b056274b556ecc3d016c9
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
F src/vdbe.c d437887d02d13d79dc69ac018f788aefac3b3972
F src/vdbe.h 7e538ecf47dccb307ea2d087c3ddc2dd8d70e79d
@@ -1258,7 +1258,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P b33f1bacfdb34fe66b7b073e68bfac38498d6e88
R 786cf9bafb843a30daaea508385a36b1
P 28cfdabc471e132a856292781767777c6390ea3c 59e3e9e764440b7feaafadff74f422535d21bca2
R 6d9983e3c63d923bd10dfd89492e7521
U mistachkin
Z cf0d8cd171ac487c0fd87c289759c254
Z c62be7c9e3b3706985519faa753e0586
+1 -1
View File
@@ -1 +1 @@
59e3e9e764440b7feaafadff74f422535d21bca2
10ee36d012e6ee82febbe0ef2e90381e215afb90
+38
View File
@@ -1763,6 +1763,25 @@ void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
return pOld;
}
/*
** Return the current trace function and argument.
*/
int sqlite3_get_trace(
const sqlite3 *db,
void (**pxTrace)(void*,const char*),
void **ppArg
){
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) || pxTrace==0 || ppArg==0 ){
return SQLITE_MISUSE_BKPT;
}
#endif
sqlite3_mutex_enter(db->mutex);
*pxTrace = db->xTrace;
*ppArg = db->pTraceArg;
sqlite3_mutex_leave(db->mutex);
return SQLITE_OK;
}
/*
** Register a profile function. The pArg from the previously registered
** profile function is returned.
**
@@ -1790,6 +1809,25 @@ void *sqlite3_profile(
sqlite3_mutex_leave(db->mutex);
return pOld;
}
/*
** Return the current profile function and argument.
*/
int sqlite3_get_profile(
const sqlite3 *db,
void (**pxProfile)(void*,const char*,sqlite3_uint64),
void **ppArg
){
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) || pxProfile==0 || ppArg==0 ){
return SQLITE_MISUSE_BKPT;
}
#endif
sqlite3_mutex_enter(db->mutex);
*pxProfile = db->xProfile;
*ppArg = db->pProfileArg;
sqlite3_mutex_leave(db->mutex);
return SQLITE_OK;
}
#endif /* SQLITE_OMIT_TRACE */
/*
+17 -5
View File
@@ -2672,7 +2672,7 @@ int sqlite3_set_authorizer(
** CAPI3REF: Tracing And Profiling Functions
** METHOD: sqlite3
**
** These routines register callback functions that can be used for
** These routines control callback functions that can be used for
** tracing and profiling the execution of SQL statements.
**
** ^The callback function registered by sqlite3_trace() is invoked at
@@ -2683,6 +2683,10 @@ int sqlite3_set_authorizer(
** as each triggered subprogram is entered. The callbacks for triggers
** contain a UTF-8 SQL comment that identifies the trigger.)^
**
** ^The [sqlite3_get_trace(D,X,P)] interface writes into X and P the
** values of the trace callback and pointer set by the most recent
** [sqlite3_trace()] call on the same [database connection] D.
**
** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit
** the length of [bound parameter] expansion in the output of sqlite3_trace().
**
@@ -2693,13 +2697,21 @@ int sqlite3_set_authorizer(
** time is in units of nanoseconds, however the current implementation
** is only capable of millisecond resolution so the six least significant
** digits in the time are meaningless. Future versions of SQLite
** might provide greater resolution on the profiler callback. The
** sqlite3_profile() function is considered experimental and is
** subject to change in future versions of SQLite.
** might provide greater resolution on the profiler callback.
**
** ^The [sqlite3_get_profile(D,X,P)] interface writes into X and P the
** values of the profile callback and pointer set by the most recent
** [sqlite3_profile()] call on the same [database connection] D.
**
** All of the tracing and profile interfaces are omitted when the
** [SQLITE_OMIT_TRACE] compile-time option is used.
*/
void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
void *sqlite3_profile(sqlite3*,
void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
int sqlite3_get_trace(const sqlite3*, void(**)(void*,const char*),void**);
int sqlite3_get_profile(const sqlite3*,
void(**)(void*,const char*,sqlite3_uint64),void**);
/*
** CAPI3REF: Query Progress Callbacks
+2 -2
View File
@@ -3384,8 +3384,8 @@ FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,u8);
void sqlite3RegisterBuiltinFunctions(sqlite3*);
void sqlite3RegisterDateTimeFunctions(void);
void sqlite3RegisterGlobalFunctions(void);
int sqlite3SafetyCheckOk(sqlite3*);
int sqlite3SafetyCheckSickOrOk(sqlite3*);
int sqlite3SafetyCheckOk(const sqlite3*);
int sqlite3SafetyCheckSickOrOk(const sqlite3*);
void sqlite3ChangeCookie(Parse*, int);
#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
+2 -2
View File
@@ -1157,7 +1157,7 @@ static void logBadConnection(const char *zType){
** open properly and is not fit for general use but which can be
** used as an argument to sqlite3_errmsg() or sqlite3_close().
*/
int sqlite3SafetyCheckOk(sqlite3 *db){
int sqlite3SafetyCheckOk(const sqlite3 *db){
u32 magic;
if( db==0 ){
logBadConnection("NULL");
@@ -1174,7 +1174,7 @@ int sqlite3SafetyCheckOk(sqlite3 *db){
return 1;
}
}
int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
int sqlite3SafetyCheckSickOrOk(const sqlite3 *db){
u32 magic;
magic = db->magic;
if( magic!=SQLITE_MAGIC_SICK &&