SQLite

Check-in [e1e0223831]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e1e022383114525241454f63ea8b9768fb7ec657
User & Date: drh 2016-07-25 02:42:22.338
Context
2016-07-25
11:27
Add --enable-memsys3 and --enable-memsys5 options to the configure script. (check-in: 67e1dc9842 user: drh tags: trunk)
02:42
Evidence marks and code reformatting for SQLITE_TRACE_STMT operation. (check-in: e1e0223831 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: 163e15229d user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/vdbe.c.
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789








6790


6791
6792
6793
6794
6795
6796
6797
6798

6799
6800
6801
6802
6803
6804
6805
6778
6779
6780
6781
6782
6783
6784

6785

6786

6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804

6805
6806
6807
6808
6809
6810
6811
6812







-

-

-
+
+
+
+
+
+
+
+

+
+







-
+







** the UTF-8 string contained in P4 is emitted on the trace callback.
** Or if P4 is blank, use the string returned by sqlite3_sql().
**
** If P2 is not zero, jump to instruction P2.
*/
case OP_Init: {          /* jump */
  char *zTrace;
  char *z;

#ifndef SQLITE_OMIT_TRACE
  /* If the P4 argument is not NULL, then it must be an SQL comment string.
  ** The "--" string is broken up to prevent false-positives with srcck1.c */
  ** The "--" string is broken up to prevent false-positives with srcck1.c.
  **
  ** This assert() provides evidence for:
  ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that
  ** would have been returned by the legacy sqlite3_trace() interface by
  ** using the X argument when X begins with "--" and invoking
  ** sqlite3_expanded_sql(P) otherwise.
  */
  assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 );

#ifndef SQLITE_OMIT_TRACE
  if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
   && !p->doingRerun
   && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
  ){
#ifndef SQLITE_OMIT_DEPRECATED
    if( db->mTrace & SQLITE_TRACE_LEGACY ){
      void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace;
      z = sqlite3VdbeExpandSql(p, zTrace);
      char *z = sqlite3VdbeExpandSql(p, zTrace);
      x(db->pTraceArg, z);
      sqlite3_free(z);
    }else
#endif
    {
      (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, zTrace);
    }