/ Check-in [53c25ebe]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:The sqlite3_expanded_sql() function compiles, but always returns NULL, when the SQLITE_OMIT_TRACE compile-time option is used.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sqlite3_trace_v2
Files: files | file ages | folders
SHA1:53c25ebe34e6776a12260078852973b1d581d20f
User & Date: drh 2016-07-15 10:01:06
Context
2016-07-22
20:20
Add requirements marks to the sqlite3_expanded_sql() documentation. check-in: 409535e6 user: drh tags: sqlite3_trace_v2
2016-07-15
10:01
The sqlite3_expanded_sql() function compiles, but always returns NULL, when the SQLITE_OMIT_TRACE compile-time option is used. check-in: 53c25ebe user: drh tags: sqlite3_trace_v2
02:55
Merge fixes from trunk. Fix the tclsqlite.test script. check-in: d2b1fa55 user: drh tags: sqlite3_trace_v2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/sqlite.h.in.

3506
3507
3508
3509
3510
3511
3512
3513


3514
3515
3516
3517
3518
3519
3520
** For example, if a prepared statement is created using the SQL
** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345
** and parameter :xyz is unbound, then sqlite3_sql() will return
** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql()
** will return "SELECT 2345,NULL".
**
** The [SQLITE_TRACE_SIZE_LIMIT] setting limits the size of a 
** bound parameter expansion.


**
** ^The string returned by sqlite3_sql(P) is managed by SQLite and is
** automatically freed when the prepared statement is finalized.
** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
** is obtained from [sqlite3_malloc()] and must be free by the application
** by passing it to [sqlite3_free()].
*/







|
>
>







3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
** For example, if a prepared statement is created using the SQL
** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345
** and parameter :xyz is unbound, then sqlite3_sql() will return
** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql()
** will return "SELECT 2345,NULL".
**
** The [SQLITE_TRACE_SIZE_LIMIT] setting limits the size of a 
** bound parameter expansion.  If SQLite is built with the
** [SQLITE_OMIT_TRACE] compile-time option then the sqlite3_expanded_sql()
** interface is non-functional and always returns NULL.
**
** ^The string returned by sqlite3_sql(P) is managed by SQLite and is
** automatically freed when the prepared statement is finalized.
** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
** is obtained from [sqlite3_malloc()] and must be free by the application
** by passing it to [sqlite3_free()].
*/

Changes to src/test1.c.

3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
    xDestructor = SQLITE_STATIC;
    objv++;
  }

  if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
  if( Tcl_GetIntFromObj(interp, objv[2], &idx) ) return TCL_ERROR;

  value = Tcl_GetByteArrayFromObj(objv[3], &len);
  if( Tcl_GetIntFromObj(interp, objv[4], &bytes) ) return TCL_ERROR;

  if( bytes>len ){
    char zBuf[200];
    sqlite3_snprintf(sizeof(zBuf), zBuf,
                     "cannot use %d blob bytes, have %d", bytes, len);
    Tcl_AppendResult(interp, zBuf, -1);







|







3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
    xDestructor = SQLITE_STATIC;
    objv++;
  }

  if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
  if( Tcl_GetIntFromObj(interp, objv[2], &idx) ) return TCL_ERROR;

  value = (char*)Tcl_GetByteArrayFromObj(objv[3], &len);
  if( Tcl_GetIntFromObj(interp, objv[4], &bytes) ) return TCL_ERROR;

  if( bytes>len ){
    char zBuf[200];
    sqlite3_snprintf(sizeof(zBuf), zBuf,
                     "cannot use %d blob bytes, have %d", bytes, len);
    Tcl_AppendResult(interp, zBuf, -1);

Changes to src/vdbeaux.c.

78
79
80
81
82
83
84



85
86
87

88
89
90
91
92
93
94
** 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){



  Vdbe *p = (Vdbe *)pStmt;
  if( p==0 || p->zSql==0 ) return 0;
  return sqlite3VdbeExpandSql(p, p->zSql);

}

/*
** Swap all content between two VDBE structures.
*/
void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
  Vdbe tmp, *pTmp;







>
>
>



>







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
** 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
  Vdbe *p = (Vdbe *)pStmt;
  if( p==0 || p->zSql==0 ) return 0;
  return sqlite3VdbeExpandSql(p, p->zSql);
#endif
}

/*
** Swap all content between two VDBE structures.
*/
void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
  Vdbe tmp, *pTmp;