]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add documentation for the newly introduced sqlite3_vtab_config() and on_conflict...
authordan <dan@noemail.net>
Wed, 27 Apr 2011 16:02:46 +0000 (16:02 +0000)
committerdan <dan@noemail.net>
Wed, 27 Apr 2011 16:02:46 +0000 (16:02 +0000)
FossilOrigin-Name: abdd70ae0424ccadb7edaf16e970c78b5257d23c

ext/fts3/fts3_write.c
manifest
manifest.uuid
src/sqlite.h.in
test/fts3conf.test

index 425010a3d0527e7c9a15e8a64179af9a89ad64d0..d42d4b3f261c25d6d6aeafdc2dedf20a703b668a 100644 (file)
@@ -2734,7 +2734,9 @@ int sqlite3Fts3UpdateMethod(
       ** This branch may also run if pNewRowid contains a value that cannot
       ** be losslessly converted to an integer. In this case, the eventual 
       ** call to fts3InsertData() (either just below or further on in this
-      ** function) will return SQLITE_MISMATCH.
+      ** function) will return SQLITE_MISMATCH. If fts3DeleteByRowid is 
+      ** invoked, it will delete zero rows (since no row will have
+      ** docid=$pNewRowid if $pNewRowid is not an integer value).
       */
       if( sqlite3_vtab_on_conflict(p->db)==SQLITE_REPLACE ){
         rc = fts3DeleteByRowid(p, pNewRowid, &nChng, aSzDel);
index 525bcf35db1e6745988036efa6c6f0637e468095..86233879ca834ff368a7f9de851dbb733048ff34 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sproblems\srelated\sto\ssavepoint\srollback\sand\sfts3.
-D 2011-04-27T12:08:04.566
+C Add\sdocumentation\sfor\sthe\snewly\sintroduced\ssqlite3_vtab_config()\sand\son_conflict()\sAPI\sfunctions.\sTest\sthat\sencountering\san\sSQLITE_MISMATCH\sin\sfts3\sdoes\snot\scorrupt\sthe\sfull\stext\sindex.
+D 2011-04-27T16:02:46.459
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -75,7 +75,7 @@ F ext/fts3/fts3_term.c c1dbc904ab1c2d687b97643c671795456228ab22
 F ext/fts3/fts3_tokenizer.c 055f3dc7369585350b28db1ee0f3b214dca6724d
 F ext/fts3/fts3_tokenizer.h 13ffd9fcb397fec32a05ef5cd9e0fa659bf3dbd3
 F ext/fts3/fts3_tokenizer1.c 6e5cbaa588924ac578263a598e4fb9f5c9bb179d
-F ext/fts3/fts3_write.c b4dfd76d61adb183b87c56573a1bdd0e1d1501da
+F ext/fts3/fts3_write.c 21ddcc47906807fb9481a0cc161db73469645d68
 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
 F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9
@@ -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 3dc514ef85adfdb6377abee4fb780b420fc43f5e
+F src/sqlite.h.in 5d25d06b8ae0d624179dba9bebb7cce48ce831f0
 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
 F src/sqliteInt.h e70a03bb66d209e279b3edeb57d4fdc42a1d9fda
 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
@@ -456,7 +456,7 @@ F test/fts3aux1.test 0b02743955d56fc0d4d66236a26177bd1b726de0
 F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
 F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
 F test/fts3comp1.test a0f5b16a2df44dd0b15751787130af2183167c0c
-F test/fts3conf.test 7b71b8a5f21481dfae43b9f7a26f2506fc2f9e70
+F test/fts3conf.test 600b366bb658842d78ed72e05476d14c2409d539
 F test/fts3corrupt.test 7890cc202406858386ddf390a879dcf80bc10abf
 F test/fts3corrupt2.test 6d96efae2f8a6af3eeaf283aba437e6d0e5447ba
 F test/fts3cov.test e0fb00d8b715ddae4a94c305992dfc3ef70353d7
@@ -932,7 +932,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P fb4a355871d9482ccb28b6ba03b842b3cc87b696
-R 7aaab6bc74b8e2e016b6645549f49c48
+P ff69f823f23e6fb6e8b2857c4576d9c0732d9572
+R da0922898dc0b07ed5b043ad92b8294b
 U dan
-Z e77f5258c98bca31cf26e41c03abebcf
+Z fc25e1a6e640452f4b097e45b1091129
index c29bc677d91a103489774ca00b35b452a3372115..d439dc7406d17885e797d83ab7029bfbd98f0382 100644 (file)
@@ -1 +1 @@
-ff69f823f23e6fb6e8b2857c4576d9c0732d9572
\ No newline at end of file
+abdd70ae0424ccadb7edaf16e970c78b5257d23c
\ No newline at end of file
index 0f18c07b405a6d1579bd516b5743ad30aafc76a4..c93922f9dfde0fb7ee425b6b9502ce3b765ffff4 100644 (file)
@@ -6389,6 +6389,9 @@ int sqlite3_wal_checkpoint_v2(
 ** [sqlite3_wal_checkpoint_v2()].  See the [sqlite3_wal_checkpoint_v2()]
 ** documentation for additional information about the meaning and use of
 ** each of these values.
+**
+** <dt>SQLITE_CONFIG_GETMUTEX</dt>
+** <dd> ^(This option takes a single argument which is a pointer to an
 */
 #define SQLITE_CHECKPOINT_PASSIVE 0
 #define SQLITE_CHECKPOINT_FULL    1
@@ -6396,23 +6399,64 @@ int sqlite3_wal_checkpoint_v2(
 
 /*
 ** CAPI3REF: Virtual Table Interface Configuration
+**
+** This function is called by a virtual table implementation to configure
+** various facets of the virtual table interface. At present, there is only
+** one option that may be configured using this function. Further options
+** may be added in the future.
+**
+** <dl>
+**   <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT
+**   <dd>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.
+**
+**       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.
+**
+**       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.
+** </dl>
+** 
 */
+#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
 int sqlite3_vtab_config(sqlite3*, int op, ...);
 
 /*
 ** CAPI3REF: Determine The Virtual Table Conflict Policy
-*/
-#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
-int sqlite3_vtab_on_conflict(sqlite3 *);
-
-/*
-** CAPI3REF: Virtual Table Conflict Policies
+**
+** This function may only be called from within a call to the xUpdate method
+** of a virtual table implementation for an INSERT or UPDATE operation. The
+** value returned is one of SQLITE_ROLLBACK, SQLITE_IGNORE, SQLITE_FAIL,
+** SQLITE_ABORT or SQLITE_REPLACE, according to the [ON CONFLICT] mode of the 
+** SQL statement that triggered the callback.
 */
 #define SQLITE_ROLLBACK 1
 /* #define SQLITE_IGNORE 2 */
 #define SQLITE_FAIL     3
 /* #define SQLITE_ABORT 4 */
 #define SQLITE_REPLACE  5
+int sqlite3_vtab_on_conflict(sqlite3 *);
+
 
 
 /*
index 7557e963232f200cc69a8004daf8c4e595fad6cc..4f5478c06405fd1f25d908ec12fc1a47d1d3a22b 100644 (file)
@@ -56,6 +56,9 @@ proc fts3_integrity {tn db tbl} {
   uplevel [list do_test $tn [list set {} $m1] $m2]
 }
 
+# Return true if the SQL statement passed as the second argument uses a
+# statement transaction.
+#
 proc sql_uses_stmt {db sql} {
   set stmt [sqlite3_prepare db $sql -1 dummy]
   set uses [uses_stmt_journal $stmt]
@@ -63,9 +66,6 @@ proc sql_uses_stmt {db sql} {
   return $uses
 }
 
-
-
-
 do_execsql_test 1.0.1 {
   CREATE VIRTUAL TABLE t1 USING fts3(x);
   INSERT INTO t1(rowid, x) VALUES(1, 'a b c d');
@@ -135,5 +135,15 @@ do_execsql_test 2.1.1 {
 }
 fts3_integrity 2.1.2 db t1
 
+do_catchsql_test 2.2.1 {
+  DELETE FROM t1;
+  BEGIN;
+    INSERT INTO t1(docid, x) VALUES(0, 'a b c');
+    INSERT INTO t1(docid, x) VALUES(1, 'a b c');
+    REPLACE INTO t1(docid, x) VALUES('zero', 'd e f');
+} {1 {datatype mismatch}}
+do_execsql_test 2.2.2 { COMMIT }
+do_execsql_test 2.2.3 { SELECT * FROM t1 } {{a b c} {a b c}}
+fts3_integrity 2.2.4 db t1
 
 finish_test