/ 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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqlite.h.in.

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

Changes to src/test1.c.

  3649   3649       xDestructor = SQLITE_STATIC;
  3650   3650       objv++;
  3651   3651     }
  3652   3652   
  3653   3653     if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
  3654   3654     if( Tcl_GetIntFromObj(interp, objv[2], &idx) ) return TCL_ERROR;
  3655   3655   
  3656         -  value = Tcl_GetByteArrayFromObj(objv[3], &len);
         3656  +  value = (char*)Tcl_GetByteArrayFromObj(objv[3], &len);
  3657   3657     if( Tcl_GetIntFromObj(interp, objv[4], &bytes) ) return TCL_ERROR;
  3658   3658   
  3659   3659     if( bytes>len ){
  3660   3660       char zBuf[200];
  3661   3661       sqlite3_snprintf(sizeof(zBuf), zBuf,
  3662   3662                        "cannot use %d blob bytes, have %d", bytes, len);
  3663   3663       Tcl_AppendResult(interp, zBuf, -1);

Changes to src/vdbeaux.c.

    78     78   ** obtained from sqlite3_malloc().  The caller is responsible for
    79     79   ** freeing the returned string by passing it to sqlite3_free().
    80     80   **
    81     81   ** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of
    82     82   ** expanded bound parameters.
    83     83   */
    84     84   char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){
           85  +#ifdef SQLITE_OMIT_TRACE
           86  +  return 0;
           87  +#else
    85     88     Vdbe *p = (Vdbe *)pStmt;
    86     89     if( p==0 || p->zSql==0 ) return 0;
    87     90     return sqlite3VdbeExpandSql(p, p->zSql);
           91  +#endif
    88     92   }
    89     93   
    90     94   /*
    91     95   ** Swap all content between two VDBE structures.
    92     96   */
    93     97   void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
    94     98     Vdbe tmp, *pTmp;