From: rdc Date: Thu, 4 Mar 2004 19:09:20 +0000 (+0000) Subject: Correct duplicate tracing of SQL statements. (CVS 1284) X-Git-Tag: version-3.6.10~4784 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa5707cd5e1129c433213e3d7ddf851de28b3507;p=thirdparty%2Fsqlite.git Correct duplicate tracing of SQL statements. (CVS 1284) FossilOrigin-Name: bb67311b3db49ce772533da14f62497c55432fae --- diff --git a/manifest b/manifest index 5747c954e6..9a69148d39 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\svdbe\sstack\selement\smight\shave\sa\sstring\svalue\seven\safter\sa\scall\sto\nIntegerify().\s\sTicket\s#641.\s(CVS\s1283) -D 2004-03-03T01:51:25 +C Correct\sduplicate\stracing\sof\sSQL\sstatements.\s(CVS\s1284) +D 2004-03-04T19:09:20 F Makefile.in afc6c0377773421633e592347097ad036eef6aeb F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -36,7 +36,7 @@ F src/func.c 34fead7a33e82095f6412d3fafd379d47864b3be F src/hash.c 9b56ef3b291e25168f630d5643a4264ec011c70e F src/hash.h 3247573ab95b9dd90bcca0307a75d9a16da1ccc7 F src/insert.c c0485ee2d1b99322894e2d1e0b576fd05ed75616 -F src/main.c 2956e9332241ff9e62c25f370d0615a9981e6d8f +F src/main.c 8e1b406d661c6475cc27d4b2b9422d1d2ab94cf7 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565 F src/os.c afcc304d13b0d28755984aa1636e66370210d3e3 F src/os.h 250a3789be609adfee5c5aa20137ce8683276f24 @@ -188,7 +188,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 5aaa2939baa972231def086ed5f9d9ba63302532 -R d722781e30098df56cdb3e08d2d9a7bf -U drh -Z b4ad96d33af4159614ecafeca0eb02b2 +P 3cac4b7b526d6c5dbf394009b534707bcb65b0da +R 0b806b4fc15359bff501f8bfa4b713b2 +U rdc +Z 6400d4c7cfcdcdab8fe7e7a7838b1180 diff --git a/manifest.uuid b/manifest.uuid index 3ebffecc13..4c528399b6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3cac4b7b526d6c5dbf394009b534707bcb65b0da \ No newline at end of file +bb67311b3db49ce772533da14f62497c55432fae \ No newline at end of file diff --git a/src/main.c b/src/main.c index c299c2c30b..6fa014104a 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.161 2004/02/25 22:51:06 rdc Exp $ +** $Id: main.c,v 1.162 2004/03/04 19:09:20 rdc Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -718,8 +718,30 @@ int sqlite_compile( if( db->pVdbe==0 ){ db->nChange = 0; } memset(&sParse, 0, sizeof(sParse)); sParse.db = db; - if( db->xTrace ) db->xTrace(db->pTraceArg, zSql); sqliteRunParser(&sParse, zSql, pzErrMsg); + if( db->xTrace ){ + /* Trace only the statment that was compiled. + ** Make a copy of that part of the SQL string since zSQL is const + ** and we must pass a zero terminated string to the trace function + ** The copy is unnecessary if the tail pointer is pointing at the + ** beginnig or end of the SQL string. + */ + if( sParse.zTail && sParse.zTail!=zSql && *sParse.zTail ){ + char *tmpSql = sqliteStrNDup(zSql, sParse.zTail - zSql); + if( tmpSql ){ + db->xTrace(db->pTraceArg, tmpSql); + free(tmpSql); + }else{ + /* If a memory error occurred during the copy, + ** trace entire SQL string and fall through to the + ** sqlite_malloc_failed test to report the error. + */ + db->xTrace(db->pTraceArg, zSql); + } + }else{ + db->xTrace(db->pTraceArg, zSql); + } + } if( sqlite_malloc_failed ){ sqliteSetString(pzErrMsg, "out of memory", (char*)0); sParse.rc = SQLITE_NOMEM;