diff options
author | drh <drh@noemail.net> | 2016-07-23 02:07:26 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-07-23 02:07:26 +0000 |
commit | 557341e8fa72f03a35768a34c33cfb18645f95cd (patch) | |
tree | 4219e54766748a1717dee9b68af02d66bbbca327 /src/vdbeapi.c | |
parent | cf1e395acb41d886d72aa77d7e49f08ed1d36317 (diff) | |
download | sqlite-557341e8fa72f03a35768a34c33cfb18645f95cd.tar.gz sqlite-557341e8fa72f03a35768a34c33cfb18645f95cd.zip |
Add requirements marks to the sqlite3_trace_v2() interface documentation.
FossilOrigin-Name: ebd388e94da4a2b29c2a546f832d359619803ec5
Diffstat (limited to 'src/vdbeapi.c')
-rw-r--r-- | src/vdbeapi.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 883e5c95b..b17c0e0a4 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 |