/ Check-in [5a0fe985]
Login

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

Overview
Comment:Disable tracing pragmas when not in debug mode. This eliminates an external dependency on stdout. (CVS 3959)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a0fe9854849bf3f04008a5dbb7a74e7d0d815ca
User & Date: drh 2007-05-08 20:59:49
Context
2007-05-08
21:45
Remove compiler warnings in the amalgamation. (CVS 3960) check-in: c5754530 user: drh tags: trunk
20:59
Disable tracing pragmas when not in debug mode. This eliminates an external dependency on stdout. (CVS 3959) check-in: 5a0fe985 user: drh tags: trunk
20:37
Fix the amalgamation generator so that all non-API functions have file scope. (CVS 3958) check-in: e9f56ead user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.428 2007/05/08 20:37:39 drh Exp $
           25  +** $Id: build.c,v 1.429 2007/05/08 20:59:49 drh Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
   190    190   #endif /* SQLITE_OMIT_TRACE */
   191    191     }
   192    192   
   193    193   
   194    194     /* Get the VDBE program ready for execution
   195    195     */
   196    196     if( v && pParse->nErr==0 && !sqlite3MallocFailed() ){
          197  +#ifdef SQLITE_DEBUG
   197    198       FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0;
   198    199       sqlite3VdbeTrace(v, trace);
          200  +#endif
   199    201       sqlite3VdbeMakeReady(v, pParse->nVar, pParse->nMem+3,
   200    202                            pParse->nTab+3, pParse->explain);
   201    203       pParse->rc = SQLITE_DONE;
   202    204       pParse->colNamesSet = 0;
   203    205     }else if( pParse->rc==SQLITE_OK ){
   204    206       pParse->rc = SQLITE_ERROR;
   205    207     }

Changes to src/pragma.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.136 2007/05/08 14:51:37 drh Exp $
           14  +** $Id: pragma.c,v 1.137 2007/05/08 20:59:49 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include "os.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /* Ignore this whole file if pragmas are disabled
    21     21   */
................................................................................
   168    168   ** Also, implement the pragma.
   169    169   */
   170    170   static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
   171    171     static const struct sPragmaType {
   172    172       const char *zName;  /* Name of the pragma */
   173    173       int mask;           /* Mask for the db->flags value */
   174    174     } aPragma[] = {
   175         -    { "vdbe_trace",               SQLITE_VdbeTrace     },
   176         -    { "sql_trace",                SQLITE_SqlTrace      },
   177         -    { "vdbe_listing",             SQLITE_VdbeListing   },
   178    175       { "full_column_names",        SQLITE_FullColNames  },
   179    176       { "short_column_names",       SQLITE_ShortColNames },
   180    177       { "count_changes",            SQLITE_CountRows     },
   181    178       { "empty_result_callbacks",   SQLITE_NullCallback  },
   182    179       { "legacy_file_format",       SQLITE_LegacyFileFmt },
   183    180       { "fullfsync",                SQLITE_FullFSync     },
          181  +#ifdef SQLITE_DEBUG
          182  +    { "sql_trace",                SQLITE_SqlTrace      },
          183  +    { "vdbe_listing",             SQLITE_VdbeListing   },
          184  +    { "vdbe_trace",               SQLITE_VdbeTrace     },
          185  +#endif
   184    186   #ifndef SQLITE_OMIT_CHECK
   185    187       { "ignore_check_constraints", SQLITE_IgnoreChecks  },
   186    188   #endif
   187    189       /* The following is VERY experimental */
   188    190       { "writable_schema",          SQLITE_WriteSchema|SQLITE_RecoveryMode },
   189    191       { "omit_readlock",            SQLITE_NoReadlock    },
   190    192   

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.611 2007/05/08 20:37:40 drh Exp $
           46  +** $Id: vdbe.c,v 1.612 2007/05/08 20:59:49 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  5070   5070       ** cell, so avoid calling MemSanity() in this case.
  5071   5071       */
  5072   5072       if( pTos>=p->aStack && pTos->flags ){
  5073   5073         sqlite3VdbeMemSanity(pTos);
  5074   5074         assert( !sqlite3VdbeMemTooBig(pTos) );
  5075   5075       }
  5076   5076       assert( pc>=-1 && pc<p->nOp );
  5077         -#ifdef SQLITE_DEBUG
  5078   5077   
         5078  +#ifdef SQLITE_DEBUG
  5079   5079       /* Code for tracing the vdbe stack. */
  5080   5080       if( p->trace && pTos>=p->aStack ){
  5081   5081         int i;
  5082   5082         fprintf(p->trace, "Stack:");
  5083   5083         for(i=0; i>-5 && &pTos[i]>=p->aStack; i--){
  5084   5084           if( pTos[i].flags & MEM_Null ){
  5085   5085             fprintf(p->trace, " NULL");

Changes to src/vdbeInt.h.

   284    284   ** "DROP TABLE" statements and to prevent some nasty side effects of
   285    285   ** malloc failure when SQLite is invoked recursively by a virtual table 
   286    286   ** method function.
   287    287   */
   288    288   struct Vdbe {
   289    289     sqlite3 *db;        /* The whole database */
   290    290     Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
   291         -  FILE *trace;        /* Write an execution trace here, if not NULL */
   292    291     int nOp;            /* Number of instructions in the program */
   293    292     int nOpAlloc;       /* Number of slots allocated for aOp[] */
   294    293     Op *aOp;            /* Space to hold the virtual machine's program */
   295    294     int nLabel;         /* Number of labels used */
   296    295     int nLabelAlloc;    /* Number of slots allocated in aLabel[] */
   297    296     int *aLabel;        /* Space to hold the labels */
   298    297     Mem *aStack;        /* The operand stack, except string values */
................................................................................
   332    331     u8 expired;             /* True if the VM needs to be recompiled */
   333    332     u8 minWriteFileFormat;  /* Minimum file format for writable database files */
   334    333     u8 inVtabMethod;        /* See comments above */
   335    334     int nChange;            /* Number of db changes made since last reset */
   336    335     i64 startTime;          /* Time when query started - used for profiling */
   337    336     int nSql;             /* Number of bytes in zSql */
   338    337     char *zSql;           /* Text of the SQL statement that generated this */
          338  +#ifdef SQLITE_DEBUG
          339  +  FILE *trace;        /* Write an execution trace here, if not NULL */
          340  +#endif
   339    341   #ifdef SQLITE_SSE
   340    342     int fetchId;          /* Statement number used by sqlite3_fetch_statement */
   341    343     int lru;              /* Counter used for LRU cache replacement */
   342    344   #endif
   343    345   };
   344    346   
   345    347   /*

Changes to src/vdbeaux.c.

    84     84     pA->zSql = pB->zSql;
    85     85     pB->zSql = zTmp;
    86     86     nTmp = pA->nSql;
    87     87     pA->nSql = pB->nSql;
    88     88     pB->nSql = nTmp;
    89     89   }
    90     90   
           91  +#ifdef SQLITE_DEBUG
    91     92   /*
    92     93   ** Turn tracing on or off
    93     94   */
    94     95   void sqlite3VdbeTrace(Vdbe *p, FILE *trace){
    95     96     p->trace = trace;
    96     97   }
           98  +#endif
    97     99   
    98    100   /*
    99    101   ** Resize the Vdbe.aOp array so that it contains at least N
   100    102   ** elements. If the Vdbe is in VDBE_MAGIC_RUN state, then
   101    103   ** the Vdbe.aOp array will be sized to contain exactly N
   102    104   ** elements. Vdbe.nOpAlloc is set to reflect the new size of
   103    105   ** the array.