** 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);
-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
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
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
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
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
-ff69f823f23e6fb6e8b2857c4576d9c0732d9572
\ No newline at end of file
+abdd70ae0424ccadb7edaf16e970c78b5257d23c
\ No newline at end of file
** [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
/*
** 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 *);
+
/*
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]
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');
}
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