From: drh Date: Sat, 23 Jul 2016 02:07:26 +0000 (+0000) Subject: Add requirements marks to the sqlite3_trace_v2() interface documentation. X-Git-Tag: version-3.14.0~57^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=557341e8fa72f03a35768a34c33cfb18645f95cd;p=thirdparty%2Fsqlite.git Add requirements marks to the sqlite3_trace_v2() interface documentation. FossilOrigin-Name: ebd388e94da4a2b29c2a546f832d359619803ec5 --- diff --git a/manifest b/manifest index a844004956..631dae73d0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssqlite3VdbeExpandSql()\sso\sthat\sit\shandles\sOOMs\sby\salways\sreturning\sNULL. -D 2016-07-23T00:43:14.540 +C Add\srequirements\smarks\sto\sthe\ssqlite3_trace_v2()\sinterface\sdocumentation. +D 2016-07-23T02:07:26.475 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -385,7 +385,7 @@ F src/resolve.c cca3aa77b95706df5d635a2141a4d1de60ae6598 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c f3c6e9065fb34f6a23af27ec7f1f717ffbfc2ee4 F src/shell.c a8a9e392a6a2777fabf5feb536931cb190f235e5 -F src/sqlite.h.in f1e866f8b789391ba7f77f71164e51b7f8b4b111 +F src/sqlite.h.in 35e253c3b408157a9edc3306d4f1b770af73a398 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 46f300b6e300e0fa916d7d58c44b53415b8471a9 F src/sqliteInt.h 48cd97eb134665348393dfe277b4c14d1085bfc7 @@ -452,12 +452,12 @@ F src/vacuum.c 544ec90a66a4b0460b7c1baeadbc21b45e6ca0b6 F src/vdbe.c 7b5570f77e32766949fd8f9478e4a9bb06e6ab24 F src/vdbe.h 67bc551f7faf04c33493892e4b378aada823ed10 F src/vdbeInt.h c59381049af5c7751a83456c39b80d1a6fde1f9d -F src/vdbeapi.c 460b90f7f0894753d33df377702c1dc9cc5fa21b -F src/vdbeaux.c 8557563e9b0fed6ba05b0ce42e3b3049d93f26fa +F src/vdbeapi.c c3f6715a99995c11748ecad91d25e93fd9fc390b +F src/vdbeaux.c a32d79aeaa88dc2b97c261172d952d395254a055 F src/vdbeblob.c 83d2d266383157b02e2b809350bb197e89d7895b F src/vdbemem.c 1ecaa5ee0caff07255f25d04e8dc88befb6f88d1 F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c -F src/vdbetrace.c bea16fb07070b33f6efdece3169c3c4b423894a8 +F src/vdbetrace.c 05d1f843117c4fdcc1f8b1e950011bbeef0cef84 F src/vtab.c 948d2d4984219eee37a7bf427d6667e21e6eb92e F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 02eeecc265f6ffd0597378f5d8ae9070b62a406a @@ -1506,7 +1506,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 527b5ba68c0b0185958b945b197f9022951d9379 -R e119b9614fe99fd5a44e65f51db3182b +P 5a027fe4127d498e0dc0d9439131c6a29085cf0a +R 424a44eb6e790a98bbdc6c3248de6bc5 U drh -Z 16700eecfd0a8ed6af44720c8587b7e0 +Z 5a7cc904a805d16230629029b0dc335a diff --git a/manifest.uuid b/manifest.uuid index 7d4379e1ee..4db50f7e69 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5a027fe4127d498e0dc0d9439131c6a29085cf0a \ No newline at end of file +ebd388e94da4a2b29c2a546f832d359619803ec5 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 5c4c373b80..1308a1122d 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2795,45 +2795,45 @@ SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, ** These constants identify classes of events that can be monitored ** using the [sqlite3_trace_v2()] tracing logic. The third argument ** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of -** the following constants. The first argument to the trace callback +** the following constants. ^The first argument to the trace callback ** is one of the following constants. ** ** New tracing constants may be added in future releases. ** -** A trace callback has four arguments: xCallback(T,C,P,X). -** The T argument is one of the integer type codes above. -** The C argument is a copy of the context pointer passed in as the +** ^A trace callback has four arguments: xCallback(T,C,P,X). +** ^The T argument is one of the integer type codes above. +** ^The C argument is a copy of the context pointer passed in as the ** fourth argument to [sqlite3_trace_v2()]. ** The P and X arguments are pointers whose meanings depend on T. ** **
** [[SQLITE_TRACE_STMT]]
SQLITE_TRACE_STMT
-**
An SQLITE_TRACE_STMT callback is invoked when a prepared statement +**
^An SQLITE_TRACE_STMT callback is invoked when a prepared statement ** first begins running and possibly at other times during the ** execution of the prepared statement, such as at the start of each -** trigger subprogram. The P argument is a pointer to the -** [prepared statement]. The X argument is a pointer to a string which +** trigger subprogram. ^The P argument is a pointer to the +** [prepared statement]. ^The X argument is a pointer to a string which ** is the expanded SQL text of the prepared statement or a comment that ** indicates the invocation of a trigger. ** ** [[SQLITE_TRACE_PROFILE]]
SQLITE_TRACE_PROFILE
-**
An SQLITE_TRACE_PROFILE callback provides approximately the same +**
^An SQLITE_TRACE_PROFILE callback provides approximately the same ** information as is provided by the [sqlite3_profile()] callback. -** The P argument is a pointer to the [prepared statement] and the -** X argument points to a 64-bit integer which is the estimated of +** ^The P argument is a pointer to the [prepared statement] and the +** ^X argument points to a 64-bit integer which is the estimated of ** the number of nanosecond that the prepared statement took to run. -** The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. +** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. ** ** [[SQLITE_TRACE_ROW]]
SQLITE_TRACE_ROW
-**
An SQLITE_TRACE_ROW callback is invoked whenever a prepared +**
^An SQLITE_TRACE_ROW callback is invoked whenever a prepared ** statement generates a single row of result. -** The P argument is a pointer to the [prepared statement] and the +** ^The P argument is a pointer to the [prepared statement] and the ** X argument is unused. ** ** [[SQLITE_TRACE_CLOSE]]
SQLITE_TRACE_CLOSE
-**
An SQLITE_TRACE_CLOSE callback is invoked when a database +**
^An SQLITE_TRACE_CLOSE callback is invoked when a database ** connection closes. -** The P argument is a pointer to the [database connection] object +** ^The P argument is a pointer to the [database connection] object ** and the X argument is unused. **
*/ @@ -2846,25 +2846,25 @@ SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, ** CAPI3REF: SQL Trace Hook ** METHOD: sqlite3 ** -** The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback +** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback ** function X against [database connection] D, using property mask M -** and context pointer P. If the X callback is +** and context pointer P. ^If the X callback is ** NULL or if the M mask is zero, then tracing is disabled. The ** M argument must be one or more of the [SQLITE_TRACE] ** constants. ** -** Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides +** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides ** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). ** -** The X callback is invoked whenever any of the events identified by -** mask M occur. The integer return value from the callback is currently +** ^The X callback is invoked whenever any of the events identified by +** mask M occur. ^The integer return value from the callback is currently ** ignored, though this may change in future releases. Callback ** implementations should return zero to ensure future compatibility. ** -** A trace callback is invoked with four arguments: callback(T,C,P,X). -** The T argument is one of the [SQLITE_TRACE] +** ^A trace callback is invoked with four arguments: callback(T,C,P,X). +** ^The T argument is one of the [SQLITE_TRACE] ** constants to indicate why the callback was invoked. -** The C argument is a copy of the context pointer. +** ^The C argument is a copy of the context pointer. ** The P and X arguments are pointers whose meanings depend on T. ** ** The sqlite3_trace_v2() interface is intended to replace the legacy diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 883e5c95bf..b17c0e0a40 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -1612,6 +1612,39 @@ int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){ return (int)v; } +/* +** Return the SQL associated with a prepared statement +*/ +const char *sqlite3_sql(sqlite3_stmt *pStmt){ + Vdbe *p = (Vdbe *)pStmt; + return p ? p->zSql : 0; +} + +/* +** Return the SQL associated with a prepared statement with +** bound parameters expanded. Space to hold the returned string is +** obtained from sqlite3_malloc(). The caller is responsible for +** freeing the returned string by passing it to sqlite3_free(). +** +** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of +** expanded bound parameters. +*/ +char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){ +#ifdef SQLITE_OMIT_TRACE + return 0; +#else + char *z = 0; + const char *zSql = sqlite3_sql(pStmt); + if( zSql ){ + Vdbe *p = (Vdbe *)pStmt; + sqlite3_mutex_enter(p->db->mutex); + z = sqlite3VdbeExpandSql(p, zSql); + sqlite3_mutex_leave(p->db->mutex); + } + return z; +#endif +} + #ifdef SQLITE_ENABLE_PREUPDATE_HOOK /* ** Allocate and populate an UnpackedRecord structure based on the serialized diff --git a/src/vdbeaux.c b/src/vdbeaux.c index b04a1d23f2..992fa4db9e 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -64,39 +64,6 @@ void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){ p->isPrepareV2 = (u8)isPrepareV2; } -/* -** Return the SQL associated with a prepared statement -*/ -const char *sqlite3_sql(sqlite3_stmt *pStmt){ - Vdbe *p = (Vdbe *)pStmt; - return p ? p->zSql : 0; -} - -/* -** Return the SQL associated with a prepared statement with -** bound parameters expanded. Space to hold the returned string is -** obtained from sqlite3_malloc(). The caller is responsible for -** freeing the returned string by passing it to sqlite3_free(). -** -** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of -** expanded bound parameters. -*/ -char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){ -#ifdef SQLITE_OMIT_TRACE - return 0; -#else - char *z = 0; - const char *zSql = sqlite3_sql(pStmt); - if( zSql ){ - Vdbe *p = (Vdbe *)pStmt; - sqlite3_mutex_enter(p->db->mutex); - z = sqlite3VdbeExpandSql(p, zSql); - sqlite3_mutex_leave(p->db->mutex); - } - return z; -#endif -} - /* ** Swap all content between two VDBE structures. */ diff --git a/src/vdbetrace.c b/src/vdbetrace.c index 8a1c23bc35..d30cf3acd5 100644 --- a/src/vdbetrace.c +++ b/src/vdbetrace.c @@ -141,8 +141,8 @@ char *sqlite3VdbeExpandSql( if( enc!=SQLITE_UTF8 ){ memset(&utf8, 0, sizeof(utf8)); utf8.db = db; - if( SQLITE_NOMEM== sqlite3VdbeMemSetStr(&utf8,pVar->z,pVar->n,enc,SQLITE_STATIC) - || SQLITE_NOMEM== sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) + if( SQLITE_NOMEM==sqlite3VdbeMemSetStr(&utf8,pVar->z,pVar->n,enc,SQLITE_STATIC) + || SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){ sqlite3StrAccumReset(&out); sqlite3VdbeMemRelease(&utf8);