From: drh Date: Fri, 13 Feb 2004 16:30:09 +0000 (+0000) Subject: Begin the process over converting sqlite_exec() over to use sqlite_compile() X-Git-Tag: version-3.6.10~4831 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e72daeb0ac517fa4656e47a4a6f5f08b67e2a8b2;p=thirdparty%2Fsqlite.git Begin the process over converting sqlite_exec() over to use sqlite_compile() and sqlite_step(). The new sqlite_exec() is still commented out. (CVS 1237) FossilOrigin-Name: b8f2ba7880b761e380b95ae63d8ab721f018443e --- diff --git a/manifest b/manifest index 535ec83417..62dd9b195c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sthe\squery\sflattener\swhen\strying\sto\sfind\sthe\sdatatype\sof\sthe\nrowid\sof\sa\sview.\s\sAlso\sfix\sa\sproblem\swith\ssqlite_compile()\sand\sauthorization\nfailures.\s(CVS\s1236) -D 2004-02-13T16:22:23 +C Begin\sthe\sprocess\sover\sconverting\ssqlite_exec()\sover\sto\suse\ssqlite_compile()\nand\ssqlite_step().\s\sThe\snew\ssqlite_exec()\sis\sstill\scommented\sout.\s(CVS\s1237) +D 2004-02-13T16:30:10 F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -36,7 +36,7 @@ F src/func.c cbc5edd10c82a5193b9ca0726873328be445e6c1 F src/hash.c 9b56ef3b291e25168f630d5643a4264ec011c70e F src/hash.h 3247573ab95b9dd90bcca0307a75d9a16da1ccc7 F src/insert.c 01f66866f35c986eab4a57373ca689a3255ef2df -F src/main.c 3230d9e31e7dd0800d5bd5c9bd59e58a73fdb776 +F src/main.c cfe8ca913219dbfb45990a5bdac01ad63361a3f3 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565 F src/os.c f5fc4954725b2fcd852979f2746085fe8ca27710 F src/os.h 250a3789be609adfee5c5aa20137ce8683276f24 @@ -184,7 +184,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 9f149fdc1c6af1c663b91c878ed1903f82f80245 -R 0a1abd4879d35c7c70d8d469ebb2575b +P aa0490ccd4a820a707dfb4905e67c01ffb4f758b +R 3d4312db1b01209de5e7a503534ee386 U drh -Z ccb3ee1ecce4c81620c08fbe0b8c5332 +Z 4885952f027f0f0cf39c7f995fa7e947 diff --git a/manifest.uuid b/manifest.uuid index cc79ba63e5..131eeb05ea 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -aa0490ccd4a820a707dfb4905e67c01ffb4f758b \ No newline at end of file +b8f2ba7880b761e380b95ae63d8ab721f018443e \ No newline at end of file diff --git a/src/main.c b/src/main.c index 0bf23f5ded..718b071984 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.150 2004/02/12 19:01:05 drh Exp $ +** $Id: main.c,v 1.151 2004/02/13 16:30:10 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -681,9 +681,61 @@ int sqlite_exec( void *pArg, /* First argument to xCallback() */ char **pzErrMsg /* Write error messages here */ ){ +#if 1 return sqliteMain(db, zSql, xCallback, pArg, 0, 0, pzErrMsg); +#else + int rc; + const char *zLeftover; + sqlite_vm *pVm; + + if( zSql==0 ) return SQLITE_OK; + while( zSql[0] ){ + int nBusy = 0; + rc = sqlite_compile(db, zSql, &zLeftover, &pVm, pzErrMsg); + if( rc!=SQLITE_OK ){ + /* sqlite_finalize(pVm, 0); */ + return rc; + } + while(1){ + int nArg; + char **azArg, **azCol; + rc = sqlite_step(pVm, &nArg, &azArg, &azCol); + if( rc==SQLITE_ROW ){ + if( xCallback(pArg, nArg, azArg, azCol) ){ + sqlite_finalize(pVm, 0); + return SQLITE_ABORT; + } +#if 0 + }else if( rc==SQLITE_BUSY ){ + if( db->xBusyCallback==0 + || db->xBusyCallback(db->pBusyArg, "", nBusy++)==0 ){ + sqlite_finalize(pVm, 0); + return SQLITE_BUSY; + } +#endif + }else if( rc==SQLITE_SCHEMA ){ + sqlite_finalize(pVm, 0); + break; + }else{ + rc = sqlite_finalize(pVm, pzErrMsg); + if( rc==SQLITE_SCHEMA ){ + sqliteResetInternalSchema(db, 0); + /* break; */ + } + if( rc!=SQLITE_OK ){ + return rc; + } + zSql = zLeftover; + while( isspace(zSql[0]) ) zSql++; + break; + } + } + } + return SQLITE_OK; +#endif } + /* ** Compile a single statement of SQL into a virtual machine. Return one ** of the SQLITE_ success/failure codes. Also write an error message into