From: drh Date: Tue, 5 May 2009 20:02:47 +0000 (+0000) Subject: Minor changes to the sqlite3_exec() implementation in legacy.c X-Git-Tag: version-3.6.15~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76aeb34f0f7e90d40b051cdfd1a7dbf5e92851ed;p=thirdparty%2Fsqlite.git Minor changes to the sqlite3_exec() implementation in legacy.c to facility full coverage testing. (CVS 6608) FossilOrigin-Name: 9e3016c1846174a64833394a00a09335e8446de8 --- diff --git a/manifest b/manifest index 5d0bc90d2d..cfb280f7a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bump\sthe\sversion\snumber\sup\sto\s3.6.14.\s(CVS\s6607) -D 2009-05-05T18:01:58 +C Minor\schanges\sto\sthe\ssqlite3_exec()\simplementation\sin\slegacy.c\nto\sfacility\sfull\scoverage\stesting.\s(CVS\s6608) +D 2009-05-05T20:02:48 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -123,7 +123,7 @@ F src/hash.h 35b216c13343d0b4f87d9f21969ac55ad72174e1 F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb F src/insert.c 050536ea91c6cf74d87a2386b5da241141943c94 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0 -F src/legacy.c 2ad5b52df322d0f132f66817095e0e79c8942611 +F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0 F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc F src/main.c a01115fda61971701695fe0d1487e2dfe46a8b1e F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19 @@ -728,7 +728,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 866284654c1f163af4164fe8c698d30af32e4eaa -R 614438be85d436fff9d175dacce984a5 +P f4549904b22ff2340a5830cd67ed001d1c4730a1 +R a3b2a24770fbc08c02f4ac7fe2c7f8a9 U drh -Z c91b913e29555819c739c143bde87fdc +Z cd9beca691f90a6e325ce8cd88b48d70 diff --git a/manifest.uuid b/manifest.uuid index f91511a983..73f582639b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f4549904b22ff2340a5830cd67ed001d1c4730a1 \ No newline at end of file +9e3016c1846174a64833394a00a09335e8446de8 \ No newline at end of file diff --git a/src/legacy.c b/src/legacy.c index 75de5dc911..7b27ec0774 100644 --- a/src/legacy.c +++ b/src/legacy.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: legacy.c,v 1.32 2009/03/19 18:51:07 danielk1977 Exp $ +** $Id: legacy.c,v 1.33 2009/05/05 20:02:48 drh Exp $ */ #include "sqliteInt.h" @@ -36,13 +36,12 @@ int sqlite3_exec( void *pArg, /* First argument to xCallback() */ char **pzErrMsg /* Write error messages here */ ){ - int rc = SQLITE_OK; - const char *zLeftover; - sqlite3_stmt *pStmt = 0; - char **azCols = 0; - - int nRetry = 0; - int nCallback; + int rc = SQLITE_OK; /* Return code */ + const char *zLeftover; /* Tail of unprocessed SQL */ + sqlite3_stmt *pStmt = 0; /* The current SQL statement */ + char **azCols = 0; /* Names of result columns */ + int nRetry = 0; /* Number of retry attempts */ + int callbackIsInit; /* True if callback data is initialized */ if( zSql==0 ) zSql = ""; @@ -64,7 +63,7 @@ int sqlite3_exec( continue; } - nCallback = 0; + callbackIsInit = 0; nCol = sqlite3_column_count(pStmt); while( 1 ){ @@ -73,13 +72,12 @@ int sqlite3_exec( /* Invoke the callback function if required */ if( xCallback && (SQLITE_ROW==rc || - (SQLITE_DONE==rc && !nCallback && db->flags&SQLITE_NullCallback)) ){ - if( 0==nCallback ){ + (SQLITE_DONE==rc && !callbackIsInit + && db->flags&SQLITE_NullCallback)) ){ + if( !callbackIsInit ){ + azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1); if( azCols==0 ){ - azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1); - if( azCols==0 ){ - goto exec_out; - } + goto exec_out; } for(i=0; i