From 367e84d0899f1226d1201c5800e53060b672d9cc Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 5 May 2011 23:07:43 +0000 Subject: [PATCH] Fix an incorrect assert() in sqlite3_value_config(). Updates to the sqlite3_value_config() documentation. FossilOrigin-Name: 22cbc01a2600c6100112315d9afb5f2d8f80b3df --- manifest | 14 ++++++------- manifest.uuid | 2 +- src/sqlite.h.in | 55 ++++++++++++++++++++++++------------------------- src/vtab.c | 2 +- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/manifest b/manifest index e38d1ab9ba..990f957862 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssqlite3_vtab_on_conflict()\sto\sreturn\sthe\scorrect\svalues\sfor\nABORT,\sFAIL,\sand\sIGNORE. -D 2011-05-05T17:41:58.205 +C Fix\san\sincorrect\sassert()\sin\ssqlite3_value_config().\s\sUpdates\sto\sthe\nsqlite3_value_config()\sdocumentation. +D 2011-05-05T23:07:43.483 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -179,7 +179,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c d9d440809025a58547e39f4f268c2a296bfb56ff F src/shell.c 72e7e176bf46d5c6518d15ac4ad6847c4bb5df79 -F src/sqlite.h.in 9bf19a5dcf6317b0f091c255edaed0b1fc01dcd0 +F src/sqlite.h.in 7f5ec849936098c5932b43fea2b1c5a4e1ec87b7 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 F src/sqliteInt.h e70a03bb66d209e279b3edeb57d4fdc42a1d9fda F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d @@ -244,7 +244,7 @@ F src/vdbeaux.c 25aa5ba7d46b4fe7c8f33dc132d474242d5f9726 F src/vdbeblob.c c3ccb7c8732858c680f442932e66ad06bb036562 F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114 -F src/vtab.c 5e17098829cb1533ae85aa46de98aa175f65eb83 +F src/vtab.c bfd252c7d699ccb1287bea3e5ca49eac2222beb0 F src/wal.c 7334009b396285b658a95a3b6bc6d2b016a1f794 F src/wal.h 7a5fbb00114b7f2cd40c7e1003d4c41ce9d26840 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f @@ -933,7 +933,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 8ba456ae0b3d0c0b6f72f98bd0bc28f72dfa4ff5 -R e350890a304deaff131b57483c8e478b +P f0617d619dc6654f6d27543999c0aad724a0d967 +R 31cf9f23f5ca6aefc15da38ca5caec3a U drh -Z 6b45c0a2e4c7eb15d8acfe532af4cf91 +Z 536ce71311e8f997eb3d277fca3551df diff --git a/manifest.uuid b/manifest.uuid index 89a83c1a8b..c09f6aed82 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f0617d619dc6654f6d27543999c0aad724a0d967 \ No newline at end of file +22cbc01a2600c6100112315d9afb5f2d8f80b3df \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 19b418b439..dfd794cf08 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -6425,37 +6425,36 @@ int sqlite3_vtab_config(sqlite3*, int op, ...); ** can use to customize and optimize their behavior. ** **
-**
SQLITE_VTAB_CONSTRAINT_SUPPORT -**
If the second argument to [sqlite3_vtab_config()] is -** SQLITE_VTAB_CONSTRAINT_SUPPORT, then SQLite expects this function to -** have been called with three arguments, the third of which being of -** type 'int'. If the third argument is zero, then the virtual table -** is indicating that it does not support constraints. In this case if -** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], the entire -** statement is rolled back as if [ON CONFLICT | OR ABORT] had been -** specified as part of the users SQL statement, regardless of the actual -** ON CONFLICT mode specified. +**
SQLITE_VTAB_CONSTRAINT_SUPPORT +**
Calls of the form +** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, +** where X is an integer. If X is zero, then the [virtual table] whose +** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not +** support constraints. In this configuration (which is the default) if +** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire +** statement is rolled back as if [ON CONFLICT | OR ABORT] had been +** specified as part of the users SQL statement, regardless of the actual +** ON CONFLICT mode specified. ** -** If the third argument passed is non-zero, then the virtual table -** implementation must guarantee that if [xUpdate] returns -** [SQLITE_CONSTRAINT], it does so before any modifications to internal -** or persistent data structures have been made. If the [ON CONFLICT] -** mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite is able to roll back -** a statement or database transaction, and abandon or continue processing -** the current SQL statement as appropriate. If the ON CONFLICT mode is -** REPLACE and the [xUpdate] method returns [SQLITE_CONSTRAINT], SQLite -** handles this as if the ON CONFLICT mode had been ABORT. +** If X is non-zero, then the virtual table implementation guarantees +** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before +** any modifications to internal or persistent data structures have been made. +** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite +** is able to roll back a statement or database transaction, and abandon +** or continue processing the current SQL statement as appropriate. +** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns +** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode +** had been ABORT. ** -** Virtual table implementations that are required to handle OR REPLACE -** must do so within the xUpdate method. If a call to the -** [sqlite3_vtab_on_conflict()] function indicates that the current ON -** CONFLICT policy is REPLACE, the virtual table implementation should -** silently replace the appropriate rows within the xUpdate callback and -** return SQLITE_OK. Or, if this is not possible, it may return -** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT -** constraint handling. +** Virtual table implementations that are required to handle OR REPLACE +** must do so within the [xUpdate] method. If a call to the +** [sqlite3_vtab_on_conflict()] function indicates that the current ON +** CONFLICT policy is REPLACE, the virtual table implementation should +** silently replace the appropriate rows within the xUpdate callback and +** return SQLITE_OK. Or, if this is not possible, it may return +** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT +** constraint handling. **
-** */ #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 diff --git a/src/vtab.c b/src/vtab.c index ce48c932f9..e7f7287da8 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -1027,7 +1027,7 @@ int sqlite3_vtab_config(sqlite3 *db, int op, ...){ if( !p ){ rc = SQLITE_MISUSE_BKPT; }else{ - assert( (p->pTab->tabFlags & TF_Virtual)!=0 ); + assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 ); p->pVTable->bConstraint = (u8)va_arg(ap, int); } break;