/ Check-in [578da247]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Remove a memory allocation from sqlite3VdbeIOTraceSql(). This means that when doing I/O tracing, the text of an SQL statement is truncated to the first 1000 characters. But it also means tracing works in an out-of-memory situation. (CVS 4210)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 578da2476e356ea35d272e18faf490efedeaf25c
User & Date: drh 2007-08-13 11:10:35
Context
2007-08-13
12:39
Add a new test cases for a problem with malloc failure during the parsing of CREATE TABLE statements in autovacuum mode. (CVS 4211) check-in: be50387e user: drh tags: trunk
11:10
Remove a memory allocation from sqlite3VdbeIOTraceSql(). This means that when doing I/O tracing, the text of an SQL statement is truncated to the first 1000 characters. But it also means tracing works in an out-of-memory situation. (CVS 4210) check-in: 578da247 user: drh tags: trunk
2007-08-12
20:07
Updates to test scripts for better support of soft-heap-limit testing. (CVS 4209) check-in: 990f621f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeaux.c.

   789    789   void sqlite3VdbeIOTraceSql(Vdbe *p){
   790    790     int nOp = p->nOp;
   791    791     VdbeOp *pOp;
   792    792     if( sqlite3_io_trace==0 ) return;
   793    793     if( nOp<1 ) return;
   794    794     pOp = &p->aOp[nOp-1];
   795    795     if( pOp->opcode==OP_Noop && pOp->p3!=0 ){
   796         -    char *z = sqlite3StrDup(pOp->p3);
   797    796       int i, j;
          797  +    char z[1000];
          798  +    sqlite3_snprintf(sizeof(z), z, "%s", pOp->p3);
   798    799       for(i=0; isspace((unsigned char)z[i]); i++){}
   799    800       for(j=0; z[i]; i++){
   800    801         if( isspace((unsigned char)z[i]) ){
   801    802           if( z[i-1]!=' ' ){
   802    803             z[j++] = ' ';
   803    804           }
   804    805         }else{
   805    806           z[j++] = z[i];
   806    807         }
   807    808       }
   808    809       z[j] = 0;
   809    810       sqlite3_io_trace("SQL %s\n", z);
   810         -    sqliteFree(z);
   811    811     }
   812    812   }
   813    813   #endif /* !SQLITE_OMIT_TRACE && SQLITE_ENABLE_IOTRACE */
   814    814   
   815    815   
   816    816   /*
   817    817   ** Prepare a virtual machine for execution.  This involves things such