aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c12
-rw-r--r--src/pager.c10
-rw-r--r--src/pragma.c4
-rw-r--r--src/sqliteInt.h4
-rw-r--r--src/vdbeaux.c4
5 files changed, 25 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index 2e15479d1..118b388df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.211 2004/06/10 00:29:09 drh Exp $
+** $Id: main.c,v 1.212 2004/06/10 01:30:59 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -931,6 +931,16 @@ int sqlite3_prepare(
}
}
+ /* Print a copy of SQL as it is executed if the SQL_TRACE pragma is turned
+ ** on in debugging mode.
+ */
+#ifdef SQLITE_DEBUG
+ if( (db->flags & SQLITE_SqlTrace)!=0 && sParse.zTail && sParse.zTail!=zSql ){
+ sqlite3DebugPrintf("SQL-trace: %.*s\n", sParse.zTail - zSql, zSql);
+ }
+#endif /* SQLITE_DEBUG */
+
+
if( sqlite3_malloc_failed ){
rc = SQLITE_NOMEM;
sqlite3RollbackAll(db);
diff --git a/src/pager.c b/src/pager.c
index e9269f813..7a2611478 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.118 2004/06/10 00:51:44 drh Exp $
+** @(#) $Id: pager.c,v 1.119 2004/06/10 01:30:59 drh Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
@@ -29,13 +29,13 @@
/*
** Macros for troubleshooting. Normally turned off
*/
-#if 0
+#if 1
static Pager *mainPager = 0;
#define SET_PAGER(X) if( mainPager==0 ) mainPager = (X)
#define CLR_PAGER(X) if( mainPager==(X) ) mainPager = 0
-#define TRACE1(X) if( pPager==mainPager ) fprintf(stderr,X)
-#define TRACE2(X,Y) if( pPager==mainPager ) fprintf(stderr,X,Y)
-#define TRACE3(X,Y,Z) if( pPager==mainPager ) fprintf(stderr,X,Y,Z)
+#define TRACE1(X) if( pPager==mainPager ) sqlite3DebugPrintf(X)
+#define TRACE2(X,Y) if( pPager==mainPager ) sqlite3DebugPrintf(X,Y)
+#define TRACE3(X,Y,Z) if( pPager==mainPager ) sqlite3DebugPrintf(X,Y,Z)
#else
#define SET_PAGER(X)
#define CLR_PAGER(X)
diff --git a/src/pragma.c b/src/pragma.c
index 9a6eac16a..05a1d034d 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.40 2004/06/09 14:17:21 drh Exp $
+** $Id: pragma.c,v 1.41 2004/06/10 01:30:59 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -122,6 +122,8 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
int mask; /* Mask for the db->flags value */
} aPragma[] = {
{ "vdbe_trace", SQLITE_VdbeTrace },
+ { "sql_trace", SQLITE_SqlTrace },
+ { "vdbe_listing", SQLITE_VdbeListing },
{ "full_column_names", SQLITE_FullColNames },
{ "short_column_names", SQLITE_ShortColNames },
{ "count_changes", SQLITE_CountRows },
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 18fa04071..37dd9c749 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.277 2004/06/10 00:29:10 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.278 2004/06/10 01:30:59 drh Exp $
*/
#include "config.h"
#include "sqlite3.h"
@@ -444,6 +444,8 @@ struct sqlite {
/* the count using a callback. */
#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
/* result set is empty */
+#define SQLITE_SqlTrace 0x00000200 /* Debug print SQL as it executes */
+#define SQLITE_VdbeListing 0x00000400 /* Debug listings of VDBE programs */
/*
** Possible values for the sqlite.magic field.
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index f16a99012..598b0c6b5 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -654,7 +654,9 @@ void sqlite3VdbeMakeReady(
sqlite3HashInit(&p->agg.hash, SQLITE_HASH_BINARY, 0);
p->agg.pSearch = 0;
#ifdef SQLITE_DEBUG
- if( sqlite3OsFileExists("vdbe_explain") ){
+ if( (p->db->flags & SQLITE_VdbeListing)!=0
+ || sqlite3OsFileExists("vdbe_explain")
+ ){
int i;
printf("VDBE Program Listing:\n");
for(i=0; i<p->nOp; i++){