/ Check-in [e1e02238]
Login

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

Overview
Comment:Evidence marks and code reformatting for SQLITE_TRACE_STMT operation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e1e022383114525241454f63ea8b9768fb7ec657
User & Date: drh 2016-07-25 02:42:22
Context
2016-07-25
11:27
Add --enable-memsys3 and --enable-memsys5 options to the configure script. check-in: 67e1dc98 user: drh tags: trunk
02:42
Evidence marks and code reformatting for SQLITE_TRACE_STMT operation. check-in: e1e02238 user: drh tags: trunk
02:31
Change SQLITE_TRACE_STMT to return unexpanded SQL text in the X argument. Add documentation on how and when to use sqlite3_expanded_sql(P) to compute the expanded text for legacy sqlite3_trace() compatibility. check-in: 163e1522 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  6778   6778   ** the UTF-8 string contained in P4 is emitted on the trace callback.
  6779   6779   ** Or if P4 is blank, use the string returned by sqlite3_sql().
  6780   6780   **
  6781   6781   ** If P2 is not zero, jump to instruction P2.
  6782   6782   */
  6783   6783   case OP_Init: {          /* jump */
  6784   6784     char *zTrace;
  6785         -  char *z;
  6786   6785   
  6787         -#ifndef SQLITE_OMIT_TRACE
  6788   6786     /* If the P4 argument is not NULL, then it must be an SQL comment string.
  6789         -  ** The "--" string is broken up to prevent false-positives with srcck1.c */
         6787  +  ** The "--" string is broken up to prevent false-positives with srcck1.c.
         6788  +  **
         6789  +  ** This assert() provides evidence for:
         6790  +  ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that
         6791  +  ** would have been returned by the legacy sqlite3_trace() interface by
         6792  +  ** using the X argument when X begins with "--" and invoking
         6793  +  ** sqlite3_expanded_sql(P) otherwise.
         6794  +  */
  6790   6795     assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 );
         6796  +
         6797  +#ifndef SQLITE_OMIT_TRACE
  6791   6798     if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
  6792   6799      && !p->doingRerun
  6793   6800      && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
  6794   6801     ){
  6795   6802   #ifndef SQLITE_OMIT_DEPRECATED
  6796   6803       if( db->mTrace & SQLITE_TRACE_LEGACY ){
  6797   6804         void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace;
  6798         -      z = sqlite3VdbeExpandSql(p, zTrace);
         6805  +      char *z = sqlite3VdbeExpandSql(p, zTrace);
  6799   6806         x(db->pTraceArg, z);
  6800   6807         sqlite3_free(z);
  6801   6808       }else
  6802   6809   #endif
  6803   6810       {
  6804   6811         (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, zTrace);
  6805   6812       }