From: drh Date: Mon, 19 May 2008 23:51:55 +0000 (+0000) Subject: Improvements to API documentation. The sqlite3_exec() function now X-Git-Tag: version-3.6.10~1033 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f50bebf0ec1872f5d86601558328def483f4a14b;p=thirdparty%2Fsqlite.git Improvements to API documentation. The sqlite3_exec() function now sets the result returned by sqlite3_errcode() when it receives an SQLITE_ABORT. (CVS 5144) FossilOrigin-Name: f1df19ca17a09ab8d85a4a7eb04f3ce95a6722da --- diff --git a/manifest b/manifest index db035d1e26..3981a597a4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C SQLite\sstores\snative\sfile\snames\sand\spaths\sfor\sthe\sdatabase\sfile.\s\sUnder\sWindows,\s(file\snormalize\stest.db)\sis\sexpanded\susing\sUNIX\stype\spath\sseparators\swhich\sTCL\srecognizes\sinterchangeably.\s\s\sHowever,\sthis\smeans\sthat\sthe\spath\sreported\sby\ssqlite3_shared_cache_report\sdoesn't\smatch\swhich\scauses\sthe\stest\scase\sto\sfail.\s\sMade\sminor\schange\sto\stest\scase\sto\shopefully\scorrect\sthis\son\sall\splatforms.\s(CVS\s5143) -D 2008-05-19T20:11:40 +C Improvements\sto\sAPI\sdocumentation.\s\sThe\ssqlite3_exec()\sfunction\snow\nsets\sthe\sresult\sreturned\sby\ssqlite3_errcode()\swhen\sit\sreceives\san\sSQLITE_ABORT.\s(CVS\s5144) +D 2008-05-19T23:51:55 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 79aeba12300a54903f1b1257c1e7c190234045dd F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -100,7 +100,7 @@ F src/hash.c fd8cb06fb54c2fe7d48c9195792059a2e5be8b70 F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53 F src/insert.c 77f0829b3e2edd19e9238195c56b0d56ab000f17 F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e -F src/legacy.c 8267890e6a0a71f13b680794520999c642299081 +F src/legacy.c 4568e4762272cd671722f0b054eb05801aab2af2 F src/loadext.c eac6c61810a3b531808774bec7f3d238cfe261f3 F src/main.c 2d1cf908a2e874f9bad7e8bff6b93c057dff6ba7 F src/malloc.c 12c1ae98ef1eff34b13c9eb526e0b7b479e1e820 @@ -130,7 +130,7 @@ F src/printf.c f2d4f6c5b0ec24b643e85fe60258adad8b1f6acc F src/random.c 2b2db2de4ab491f5a14d3480466f8f4b5a5db74a F src/select.c da43ce3080112aa77863e9c570c1df19a892acb8 F src/shell.c a12ea645271b7876c8f080146f48e20b00d367ec -F src/sqlite.h.in 5fafd7849e3e74625533144ce0ab9d495c0320da +F src/sqlite.h.in f1d8355483f2688ab385522bd95edaecc55b1f2a F src/sqlite3ext.h faacd0e6a81aabee0861c6d7883c9172e74ef5b3 F src/sqliteInt.h 70a2b0bf856bbdb86b10d994ea863f6591ab7144 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 @@ -636,7 +636,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P bc90787583dd2dadff72d516de9720d4a36e7fd2 -R 22f0e32263f04f1c10de732563542a44 -U shane -Z 0ed652a054220cb34754df08abc06527 +P 5ef61701398ce75e32cfaea2eacf2c3e80832ca0 +R c6947a62afcdc65fd7adce5253152bd6 +U drh +Z 7051c7ad739f94ff57939cd3c56414aa diff --git a/manifest.uuid b/manifest.uuid index a9036a6fb0..ec9ec16965 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5ef61701398ce75e32cfaea2eacf2c3e80832ca0 \ No newline at end of file +f1df19ca17a09ab8d85a4a7eb04f3ce95a6722da \ No newline at end of file diff --git a/src/legacy.c b/src/legacy.c index 6e4f4e4ced..ea12e80741 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.24 2008/03/21 18:01:14 drh Exp $ +** $Id: legacy.c,v 1.25 2008/05/19 23:51:55 drh Exp $ */ #include "sqliteInt.h" @@ -102,6 +102,9 @@ int sqlite3_exec( } if( xCallback(pArg, nCol, azVals, azCols) ){ rc = SQLITE_ABORT; + sqlite3_finalize(pStmt); + pStmt = 0; + sqlite3Error(db, SQLITE_ABORT, 0); goto exec_out; } } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 6d4062c407..47d8cf6c08 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite.h.in,v 1.312 2008/05/12 12:39:56 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.313 2008/05/19 23:51:55 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -278,27 +278,32 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** ** INVARIANTS: ** -** {F12101} The [sqlite3_exec()] interface evaluates zero or more UTF-8 -** encoded, semicolon-separated, SQL statements in the -** zero-terminated string of its 2nd parameter within the -** context of the [sqlite3] object given in the 1st parameter. +** {F12101} A successful invocation of [sqlite3_exec(D,S,C,A,E)] +** shall evaluate all of the UTF-8 encoded, semicolon-separated, +** SQL statements in the zero-terminated string S within the +** context of the D [database connection]. ** -** {F12104} The return value of [sqlite3_exec()] is SQLITE_OK if all -** SQL statements run successfully. +** {F12102} When the S argment to [sqlite3_exec(D,S,C,A,E)] is an empty string +** then the [sqlite3_exec()] call shall be a no-op. ** -** {F12105} The return value of [sqlite3_exec()] is an appropriate +** {F12104} The return value of [sqlite3_exec()] shall be SQLITE_OK if all +** SQL statements run successfully and to completion. +** +** {F12105} The return value of [sqlite3_exec()] shall be an appropriate ** non-zero error code if any SQL statement fails. ** ** {F12107} If one or more of the SQL statements handed to [sqlite3_exec()] ** return results and the 3rd parameter is not NULL, then -** the callback function specified by the 3rd parameter is +** the callback function specified by the 3rd parameter shall be ** invoked once for each row of result. ** ** {F12110} If the callback returns a non-zero value then [sqlite3_exec()] -** will aborted the SQL statement it is currently evaluating, +** shall aborted the SQL statement it is currently evaluating, ** skip all subsequent SQL statements, and return [SQLITE_ABORT]. -** What happens to *errmsg here? Does the result code for -** sqlite3_errcode() get set? +** +** {F12111} Following a call to [sqlite3_exec()] where the callback returns +** non-zero, the [sqlite3_errcode()], [sqlite3_errmsg()], and +** [sqlite3_errmsg16()] routines shall return no error. ** ** {F12113} The [sqlite3_exec()] routine will pass its 4th parameter through ** as the 1st parameter of the callback. @@ -325,18 +330,24 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** return an [error code] other than [SQLITE_OK]. ** ** {F12131} If an error occurs while parsing or evaluating any of the SQL -** handed to [sqlite3_exec()] and if the 5th parameter (errmsg) -** to [sqlite3_exec()] is not NULL, then an error message is -** allocated using the equivalent of [sqlite3_mprintf()] and -** *errmsg is made to point to that message. +** handed in the S parameter of [sqlite3_exec(D,S,C,A,E)] and if +** the E parameter is not NULL, then sqlit3_exec shall store in *E +** an appropriate error message written into memory obtained +** from [sqlite3_malloc()]. ** -** {F12134} The [sqlite3_exec()] routine does not change the value of -** *errmsg if errmsg is NULL or if there are no errors. +** {F12134} The [sqlite3_exec(D,S,C,A,E)] routine does not change the value of +** *E if E is NULL or if there are no errors. ** ** {F12137} The [sqlite3_exec()] function sets the error code and message ** accessible via [sqlite3_errcode()], [sqlite3_errmsg()], and ** [sqlite3_errmsg16()]. ** +** {F12138} If the S parameter to [sqlite3_exec(D,S,C,A,E)] is not an empty +** string but contains nothing other than whitespace, comments, and/or +** semicolons, then results of [sqlite3_errcode()], +** [sqlite3_errmsg()], and [sqlite3_errmsg16()] +** shall reset to indicate no errors. +** ** LIMITATIONS: ** ** {U12141} The first parameter to [sqlite3_exec()] must be an valid and open