--- /dev/null
+# 2014 August 30
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+
+set testdir [file join [file dirname $argv0] .. .. test]
+source $testdir/tester.tcl
+set ::testprefix ota3
+
+
+# Run the OTA in file $ota on target database $target until completion.
+#
+proc run_ota {target ota} {
+ sqlite3ota ota $target $ota
+ while { [ota step]=="SQLITE_OK" } {}
+ ota close
+}
+
+forcedelete test.db-oal ota.db
+
+#--------------------------------------------------------------------
+# Test that for an OTA to be applied, no corruption results if the
+# affinities on the source and target table do not match.
+#
+do_execsql_test 1.0 {
+ CREATE TABLE x1(a INTEGER PRIMARY KEY, b TEXT, c REAL);
+ CREATE INDEX i1 ON x1(b, c);
+} {}
+
+do_test 1.1 {
+ sqlite3 db2 ota.db
+ db2 eval {
+ CREATE TABLE data_x1(a, b, c, ota_control);
+ INSERT INTO data_x1 VALUES(1, '123', '123', 0);
+ INSERT INTO data_x1 VALUES(2, 123, 123, 0);
+ }
+ db2 close
+ run_ota test.db ota.db
+} {SQLITE_DONE}
+
+do_execsql_test 1.2 {
+ PRAGMA integrity_check;
+} {ok}
+
+
+
+finish_test
-C Add\ssupport\sfor\supdate\sstatements\sto\ssqlite3ota.c.
-D 2014-09-08T17:50:35.158
+C Add\sOP_Affinity\sopcodes\sto\sthe\sVMs\sgenerated\sby\ssqlite3_index_writer().
+D 2014-09-15T10:44:24.271
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F ext/ota/ota.c d37097e92a005d3915883adefbb93019ea6f8841
F ext/ota/ota1.test fe0bb8acf0caef6c19937b84c6547b788342610d
F ext/ota/ota2.test 13f76922446c62ed96192e938b8e625ebf0142fa
+F ext/ota/ota3.test 9e3e42c6083e92909c408f1fe62aa07b0c9f905c
F ext/ota/sqlite3ota.c 3697f6db2d51d5f7c0f0306fe94514785361e521
F ext/ota/sqlite3ota.h 545f0008b5f02f2595899cb9841caddada5c17c0
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F src/vdbeInt.h cdc8e421f85beb1ac9b4669ec5beadab6faa15e0
F src/vdbeapi.c 09677a53dd8c71bcd670b0bd073bb9aefa02b441
F src/vdbeaux.c cef5d34a64ae3a65b56d96d3fd663246ec8e1c36
-F src/vdbeblob.c b1b8b2cd86617db009f027f116b335f86e95b617
+F src/vdbeblob.c 7a28ade0cae13bd99f5c4c8f008f68e942c23115
F src/vdbemem.c 921d5468a68ac06f369810992e84ca22cc730a62
F src/vdbesort.c 7c45bfcd823f30d172bbbc1b9f51ef4402fbfe8d
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P f988234ba54d7c667f7deef1d04beed4e7fe6182
-R c23b09bc3993f39690d272fa85636507
+P e109b27e4d66b83e1a804e7556d9c91aa37fea28
+R 75f9e5319b2343a328ed4364426b7add
U dan
-Z 28e28dd83293020abb0c0fb47ae5ab2c
+Z c56c0b8cb355334f7ef68c91cc8c371e
-e109b27e4d66b83e1a804e7556d9c91aa37fea28
\ No newline at end of file
+b9b38cb8e21826ddfb4c87a1f166ad33c3c7b6eb
\ No newline at end of file
Vdbe *v = 0;
int regRec; /* Register to assemble record in */
int *aiCol = 0;
+ const char *zAffinity = 0; /* Affinity string for the current index */
sqlite3_mutex_enter(db->mutex);
sqlite3BtreeEnterAll(db);
goto index_writer_out;
}
pTab = pIdx->pTable;
+ zAffinity = sqlite3IndexAffinityStr(v, pIdx);
/* Populate the two output variables, *pnCol and *pnAiCol. */
*pnCol = pIdx->nColumn;
regRec = ++pParse->nMem;
if( bDelete==0 ){
- sqlite3VdbeAddOp3(v, OP_MakeRecord, 1, pIdx->nColumn, regRec);
+ sqlite3VdbeAddOp4(v, OP_MakeRecord, 1, pIdx->nColumn, regRec, zAffinity, 0);
/* If this is a UNIQUE index, check the constraint. */
if( pIdx->onError ){
sqlite3VdbeAddOp2(v, OP_IdxInsert, 0, regRec);
}else{
/* Code the IdxDelete to remove the entry from the b-tree index. */
+ sqlite3VdbeAddOp4(v, OP_Affinity, 0, pIdx->nColumn, 0, zAffinity, 0);
sqlite3VdbeAddOp3(v, OP_IdxDelete, 0, 1, pIdx->nColumn);
}
sqlite3FinishCoding(pParse);