mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Change the name of the OTA extension to RBU: Resumable Bulk Update.
FossilOrigin-Name: 017c5019e1ce042025d4f327e50ec50af49f9fa4
This commit is contained in:
@ -345,8 +345,8 @@ SRC += \
|
|||||||
$(TOP)/ext/rtree/rtree.h \
|
$(TOP)/ext/rtree/rtree.h \
|
||||||
$(TOP)/ext/rtree/rtree.c
|
$(TOP)/ext/rtree/rtree.c
|
||||||
SRC += \
|
SRC += \
|
||||||
$(TOP)/ext/ota/sqlite3ota.h \
|
$(TOP)/ext/rbu/sqlite3rbu.h \
|
||||||
$(TOP)/ext/ota/sqlite3ota.c
|
$(TOP)/ext/rbu/sqlite3rbu.c
|
||||||
|
|
||||||
|
|
||||||
# Generated source code files
|
# Generated source code files
|
||||||
@ -404,7 +404,7 @@ TESTSRC = \
|
|||||||
$(TOP)/src/test_wsd.c \
|
$(TOP)/src/test_wsd.c \
|
||||||
$(TOP)/ext/fts3/fts3_term.c \
|
$(TOP)/ext/fts3/fts3_term.c \
|
||||||
$(TOP)/ext/fts3/fts3_test.c \
|
$(TOP)/ext/fts3/fts3_test.c \
|
||||||
$(TOP)/ext/ota/test_ota.c
|
$(TOP)/ext/rbu/test_rbu.c
|
||||||
|
|
||||||
# Statically linked extensions
|
# Statically linked extensions
|
||||||
#
|
#
|
||||||
|
@ -1007,8 +1007,8 @@ SRC4 = \
|
|||||||
$(TOP)\ext\icu\icu.c \
|
$(TOP)\ext\icu\icu.c \
|
||||||
$(TOP)\ext\rtree\rtree.h \
|
$(TOP)\ext\rtree\rtree.h \
|
||||||
$(TOP)\ext\rtree\rtree.c \
|
$(TOP)\ext\rtree\rtree.c \
|
||||||
$(TOP)\ext\ota\sqlite3ota.h \
|
$(TOP)\ext\rbu\sqlite3rbu.h \
|
||||||
$(TOP)\ext\ota\sqlite3ota.c
|
$(TOP)\ext\rbu\sqlite3rbu.c
|
||||||
|
|
||||||
|
|
||||||
# Generated source code files
|
# Generated source code files
|
||||||
@ -1069,7 +1069,7 @@ TESTSRC = \
|
|||||||
$(TOP)\src\test_wsd.c \
|
$(TOP)\src\test_wsd.c \
|
||||||
$(TOP)\ext\fts3\fts3_term.c \
|
$(TOP)\ext\fts3\fts3_term.c \
|
||||||
$(TOP)\ext\fts3\fts3_test.c \
|
$(TOP)\ext\fts3\fts3_test.c \
|
||||||
$(TOP)\ext\ota\test_ota.c
|
$(TOP)\ext\rbu\test_rbu.c
|
||||||
|
|
||||||
# Statically linked extensions
|
# Statically linked extensions
|
||||||
#
|
#
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
**
|
**
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
**
|
**
|
||||||
** This file contains a command-line application that uses the OTA
|
** This file contains a command-line application that uses the RBU
|
||||||
** extension. See the usage() function below for an explanation.
|
** extension. See the usage() function below for an explanation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sqlite3ota.h"
|
#include "sqlite3rbu.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -24,18 +24,18 @@
|
|||||||
*/
|
*/
|
||||||
void usage(const char *zArgv0){
|
void usage(const char *zArgv0){
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s [-step NSTEP] TARGET-DB OTA-DB\n"
|
"Usage: %s [-step NSTEP] TARGET-DB RBU-DB\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Argument OTA-DB must be an OTA database containing an update suitable for\n"
|
" Argument RBU-DB must be an RBU database containing an update suitable for\n"
|
||||||
" target database TARGET-DB. If NSTEP is set to less than or equal to zero\n"
|
" target database TARGET-DB. If NSTEP is set to less than or equal to zero\n"
|
||||||
" (the default value), this program attempts to apply the entire update to\n"
|
" (the default value), this program attempts to apply the entire update to\n"
|
||||||
" the target database.\n"
|
" the target database.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" If NSTEP is greater than zero, then a maximum of NSTEP calls are made\n"
|
" If NSTEP is greater than zero, then a maximum of NSTEP calls are made\n"
|
||||||
" to sqlite3ota_step(). If the OTA update has not been completely applied\n"
|
" to sqlite3rbu_step(). If the RBU update has not been completely applied\n"
|
||||||
" after the NSTEP'th call is made, the state is saved in the database OTA-DB\n"
|
" after the NSTEP'th call is made, the state is saved in the database RBU-DB\n"
|
||||||
" and the program exits. Subsequent invocations of this (or any other OTA)\n"
|
" and the program exits. Subsequent invocations of this (or any other RBU)\n"
|
||||||
" application will use this state to resume applying the OTA update to the\n"
|
" application will use this state to resume applying the RBU update to the\n"
|
||||||
" target db.\n"
|
" target db.\n"
|
||||||
"\n"
|
"\n"
|
||||||
, zArgv0);
|
, zArgv0);
|
||||||
@ -47,8 +47,8 @@ void report_default_vfs(){
|
|||||||
fprintf(stdout, "default vfs is \"%s\"\n", pVfs->zName);
|
fprintf(stdout, "default vfs is \"%s\"\n", pVfs->zName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void report_ota_vfs(sqlite3ota *pOta){
|
void report_rbu_vfs(sqlite3rbu *pRbu){
|
||||||
sqlite3 *db = sqlite3ota_db(pOta, 0);
|
sqlite3 *db = sqlite3rbu_db(pRbu, 0);
|
||||||
if( db ){
|
if( db ){
|
||||||
char *zName = 0;
|
char *zName = 0;
|
||||||
sqlite3_file_control(db, "main", SQLITE_FCNTL_VFSNAME, &zName);
|
sqlite3_file_control(db, "main", SQLITE_FCNTL_VFSNAME, &zName);
|
||||||
@ -63,16 +63,16 @@ void report_ota_vfs(sqlite3ota *pOta){
|
|||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
int i;
|
int i;
|
||||||
const char *zTarget; /* Target database to apply OTA to */
|
const char *zTarget; /* Target database to apply RBU to */
|
||||||
const char *zOta; /* Database containing OTA */
|
const char *zRbu; /* Database containing RBU */
|
||||||
char *zErrmsg; /* Error message, if any */
|
char *zErrmsg; /* Error message, if any */
|
||||||
sqlite3ota *pOta; /* OTA handle */
|
sqlite3rbu *pRbu; /* RBU handle */
|
||||||
int nStep = 0; /* Maximum number of step() calls */
|
int nStep = 0; /* Maximum number of step() calls */
|
||||||
int rc;
|
int rc;
|
||||||
sqlite3_int64 nProgress = 0;
|
sqlite3_int64 nProgress = 0;
|
||||||
|
|
||||||
/* Process command line arguments. Following this block local variables
|
/* Process command line arguments. Following this block local variables
|
||||||
** zTarget, zOta and nStep are all set. */
|
** zTarget, zRbu and nStep are all set. */
|
||||||
if( argc==5 ){
|
if( argc==5 ){
|
||||||
int nArg1 = strlen(argv[1]);
|
int nArg1 = strlen(argv[1]);
|
||||||
if( nArg1>5 || nArg1<2 || memcmp("-step", argv[1], nArg1) ) usage(argv[0]);
|
if( nArg1>5 || nArg1<2 || memcmp("-step", argv[1], nArg1) ) usage(argv[0]);
|
||||||
@ -81,32 +81,32 @@ int main(int argc, char **argv){
|
|||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
}
|
}
|
||||||
zTarget = argv[argc-2];
|
zTarget = argv[argc-2];
|
||||||
zOta = argv[argc-1];
|
zRbu = argv[argc-1];
|
||||||
|
|
||||||
report_default_vfs();
|
report_default_vfs();
|
||||||
|
|
||||||
/* Open an OTA handle. If nStep is less than or equal to zero, call
|
/* Open an RBU handle. If nStep is less than or equal to zero, call
|
||||||
** sqlite3ota_step() until either the OTA has been completely applied
|
** sqlite3rbu_step() until either the RBU has been completely applied
|
||||||
** or an error occurs. Or, if nStep is greater than zero, call
|
** or an error occurs. Or, if nStep is greater than zero, call
|
||||||
** sqlite3ota_step() a maximum of nStep times. */
|
** sqlite3rbu_step() a maximum of nStep times. */
|
||||||
pOta = sqlite3ota_open(zTarget, zOta, 0);
|
pRbu = sqlite3rbu_open(zTarget, zRbu, 0);
|
||||||
report_ota_vfs(pOta);
|
report_rbu_vfs(pRbu);
|
||||||
for(i=0; (nStep<=0 || i<nStep) && sqlite3ota_step(pOta)==SQLITE_OK; i++);
|
for(i=0; (nStep<=0 || i<nStep) && sqlite3rbu_step(pRbu)==SQLITE_OK; i++);
|
||||||
nProgress = sqlite3ota_progress(pOta);
|
nProgress = sqlite3rbu_progress(pRbu);
|
||||||
rc = sqlite3ota_close(pOta, &zErrmsg);
|
rc = sqlite3rbu_close(pRbu, &zErrmsg);
|
||||||
|
|
||||||
/* Let the user know what happened. */
|
/* Let the user know what happened. */
|
||||||
switch( rc ){
|
switch( rc ){
|
||||||
case SQLITE_OK:
|
case SQLITE_OK:
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"SQLITE_OK: ota update incomplete (%lld operations so far)\n",
|
"SQLITE_OK: rbu update incomplete (%lld operations so far)\n",
|
||||||
nProgress
|
nProgress
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQLITE_DONE:
|
case SQLITE_DONE:
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"SQLITE_DONE: ota update completed (%lld operations)\n",
|
"SQLITE_DONE: rbu update completed (%lld operations)\n",
|
||||||
nProgress
|
nProgress
|
||||||
);
|
);
|
||||||
break;
|
break;
|
@ -14,128 +14,128 @@ if {![info exists testdir]} {
|
|||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota1
|
set ::testprefix rbu1
|
||||||
|
|
||||||
db close
|
db close
|
||||||
sqlite3_shutdown
|
sqlite3_shutdown
|
||||||
sqlite3_config_uri 1
|
sqlite3_config_uri 1
|
||||||
|
|
||||||
# Create a simple OTA database. That expects to write to a table:
|
# Create a simple RBU database. That expects to write to a table:
|
||||||
#
|
#
|
||||||
# CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
# CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
||||||
#
|
#
|
||||||
proc create_ota1 {filename} {
|
proc create_rbu1 {filename} {
|
||||||
forcedelete $filename
|
forcedelete $filename
|
||||||
sqlite3 ota1 $filename
|
sqlite3 rbu1 $filename
|
||||||
ota1 eval {
|
rbu1 eval {
|
||||||
CREATE TABLE data_t1(a, b, c, ota_control);
|
CREATE TABLE data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
||||||
INSERT INTO data_t1 VALUES(2, 'two', 'three', 0);
|
INSERT INTO data_t1 VALUES(2, 'two', 'three', 0);
|
||||||
INSERT INTO data_t1 VALUES(3, NULL, 8.2, 0);
|
INSERT INTO data_t1 VALUES(3, NULL, 8.2, 0);
|
||||||
}
|
}
|
||||||
ota1 close
|
rbu1 close
|
||||||
return $filename
|
return $filename
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a simple OTA database. That expects to write to a table:
|
# Create a simple RBU database. That expects to write to a table:
|
||||||
#
|
#
|
||||||
# CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
# CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
||||||
#
|
#
|
||||||
# This OTA includes both insert and delete operations.
|
# This RBU includes both insert and delete operations.
|
||||||
#
|
#
|
||||||
proc create_ota4 {filename} {
|
proc create_rbu4 {filename} {
|
||||||
forcedelete $filename
|
forcedelete $filename
|
||||||
sqlite3 ota1 $filename
|
sqlite3 rbu1 $filename
|
||||||
ota1 eval {
|
rbu1 eval {
|
||||||
CREATE TABLE data_t1(a, b, c, ota_control);
|
CREATE TABLE data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
||||||
INSERT INTO data_t1 VALUES(2, NULL, 5, 1);
|
INSERT INTO data_t1 VALUES(2, NULL, 5, 1);
|
||||||
INSERT INTO data_t1 VALUES(3, 8, 9, 0);
|
INSERT INTO data_t1 VALUES(3, 8, 9, 0);
|
||||||
INSERT INTO data_t1 VALUES(4, NULL, 11, 1);
|
INSERT INTO data_t1 VALUES(4, NULL, 11, 1);
|
||||||
}
|
}
|
||||||
ota1 close
|
rbu1 close
|
||||||
return $filename
|
return $filename
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# Create a simple OTA database. That expects to write to a table:
|
# Create a simple RBU database. That expects to write to a table:
|
||||||
#
|
#
|
||||||
# CREATE TABLE t1(c, b, '(a)' INTEGER PRIMARY KEY);
|
# CREATE TABLE t1(c, b, '(a)' INTEGER PRIMARY KEY);
|
||||||
#
|
#
|
||||||
# This OTA includes both insert and delete operations.
|
# This RBU includes both insert and delete operations.
|
||||||
#
|
#
|
||||||
proc create_ota4b {filename} {
|
proc create_rbu4b {filename} {
|
||||||
forcedelete $filename
|
forcedelete $filename
|
||||||
sqlite3 ota1 $filename
|
sqlite3 rbu1 $filename
|
||||||
ota1 eval {
|
rbu1 eval {
|
||||||
CREATE TABLE data_t1(c, b, '(a)', ota_control);
|
CREATE TABLE data_t1(c, b, '(a)', rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(3, 2, 1, 0);
|
INSERT INTO data_t1 VALUES(3, 2, 1, 0);
|
||||||
INSERT INTO data_t1 VALUES(5, NULL, 2, 1);
|
INSERT INTO data_t1 VALUES(5, NULL, 2, 1);
|
||||||
INSERT INTO data_t1 VALUES(9, 8, 3, 0);
|
INSERT INTO data_t1 VALUES(9, 8, 3, 0);
|
||||||
INSERT INTO data_t1 VALUES(11, NULL, 4, 1);
|
INSERT INTO data_t1 VALUES(11, NULL, 4, 1);
|
||||||
}
|
}
|
||||||
ota1 close
|
rbu1 close
|
||||||
return $filename
|
return $filename
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a simple OTA database. That expects to write to a table:
|
# Create a simple RBU database. That expects to write to a table:
|
||||||
#
|
#
|
||||||
# CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, d);
|
# CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, d);
|
||||||
#
|
#
|
||||||
# This OTA includes update statements.
|
# This RBU includes update statements.
|
||||||
#
|
#
|
||||||
proc create_ota5 {filename} {
|
proc create_rbu5 {filename} {
|
||||||
forcedelete $filename
|
forcedelete $filename
|
||||||
sqlite3 ota5 $filename
|
sqlite3 rbu5 $filename
|
||||||
ota5 eval {
|
rbu5 eval {
|
||||||
CREATE TABLE data_t1(a, b, c, d, ota_control);
|
CREATE TABLE data_t1(a, b, c, d, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, NULL, NULL, 5, '...x'); -- SET d = 5
|
INSERT INTO data_t1 VALUES(1, NULL, NULL, 5, '...x'); -- SET d = 5
|
||||||
INSERT INTO data_t1 VALUES(2, NULL, 10, 5, '..xx'); -- SET c=10, d = 5
|
INSERT INTO data_t1 VALUES(2, NULL, 10, 5, '..xx'); -- SET c=10, d = 5
|
||||||
INSERT INTO data_t1 VALUES(3, 11, NULL, NULL, '.x..'); -- SET b=11
|
INSERT INTO data_t1 VALUES(3, 11, NULL, NULL, '.x..'); -- SET b=11
|
||||||
}
|
}
|
||||||
ota5 close
|
rbu5 close
|
||||||
return $filename
|
return $filename
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run the OTA in file $ota on target database $target until completion.
|
# Run the RBU in file $rbu on target database $target until completion.
|
||||||
#
|
#
|
||||||
proc run_ota {target ota} {
|
proc run_rbu {target rbu} {
|
||||||
sqlite3ota ota $target $ota
|
sqlite3rbu rbu $target $rbu
|
||||||
while 1 {
|
while 1 {
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
if {$rc!="SQLITE_OK"} break
|
if {$rc!="SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
|
|
||||||
proc step_ota {target ota} {
|
proc step_rbu {target rbu} {
|
||||||
while 1 {
|
while 1 {
|
||||||
sqlite3ota ota $target $ota
|
sqlite3rbu rbu $target $rbu
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
ota close
|
rbu close
|
||||||
if {$rc != "SQLITE_OK"} break
|
if {$rc != "SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
set rc
|
set rc
|
||||||
}
|
}
|
||||||
|
|
||||||
# Same as [step_ota], except using a URI to open the target db.
|
# Same as [step_rbu], except using a URI to open the target db.
|
||||||
#
|
#
|
||||||
proc step_ota_uri {target ota} {
|
proc step_rbu_uri {target rbu} {
|
||||||
while 1 {
|
while 1 {
|
||||||
sqlite3ota ota file:$target?xyz=&abc=123 $ota
|
sqlite3rbu rbu file:$target?xyz=&abc=123 $rbu
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
ota close
|
rbu close
|
||||||
if {$rc != "SQLITE_OK"} break
|
if {$rc != "SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
set rc
|
set rc
|
||||||
}
|
}
|
||||||
|
|
||||||
# Same as [step_ota], except using an external state database - "state.db"
|
# Same as [step_rbu], except using an external state database - "state.db"
|
||||||
#
|
#
|
||||||
proc step_ota_state {target ota} {
|
proc step_rbu_state {target rbu} {
|
||||||
while 1 {
|
while 1 {
|
||||||
sqlite3ota ota $target $ota state.db
|
sqlite3rbu rbu $target $rbu state.db
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
ota close
|
rbu close
|
||||||
if {$rc != "SQLITE_OK"} break
|
if {$rc != "SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
set rc
|
set rc
|
||||||
@ -151,17 +151,17 @@ proc dbfilecksum {file} {
|
|||||||
foreach {tn3 create_vfs destroy_vfs} {
|
foreach {tn3 create_vfs destroy_vfs} {
|
||||||
1 {} {}
|
1 {} {}
|
||||||
2 {
|
2 {
|
||||||
sqlite3ota_create_vfs -default myota ""
|
sqlite3rbu_create_vfs -default myrbu ""
|
||||||
} {
|
} {
|
||||||
sqlite3ota_destroy_vfs myota
|
sqlite3rbu_destroy_vfs myrbu
|
||||||
}
|
}
|
||||||
} {
|
} {
|
||||||
|
|
||||||
eval $create_vfs
|
eval $create_vfs
|
||||||
|
|
||||||
foreach {tn2 cmd} {
|
foreach {tn2 cmd} {
|
||||||
1 run_ota
|
1 run_rbu
|
||||||
2 step_ota 3 step_ota_uri 4 step_ota_state
|
2 step_rbu 3 step_rbu_uri 4 step_rbu_state
|
||||||
} {
|
} {
|
||||||
foreach {tn schema} {
|
foreach {tn schema} {
|
||||||
1 {
|
1 {
|
||||||
@ -240,12 +240,12 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
} {
|
} {
|
||||||
reset_db
|
reset_db
|
||||||
execsql $schema
|
execsql $schema
|
||||||
create_ota1 ota.db
|
create_rbu1 rbu.db
|
||||||
set check [dbfilecksum ota.db]
|
set check [dbfilecksum rbu.db]
|
||||||
forcedelete state.db
|
forcedelete state.db
|
||||||
|
|
||||||
do_test $tn3.1.$tn2.$tn.1 {
|
do_test $tn3.1.$tn2.$tn.1 {
|
||||||
$cmd test.db ota.db
|
$cmd test.db rbu.db
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test $tn3.1.$tn2.$tn.2 { SELECT * FROM t1 ORDER BY a ASC } {
|
do_execsql_test $tn3.1.$tn2.$tn.2 { SELECT * FROM t1 ORDER BY a ASC } {
|
||||||
@ -266,51 +266,51 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
|
|
||||||
do_execsql_test $tn3.1.$tn2.$tn.5 { PRAGMA integrity_check } ok
|
do_execsql_test $tn3.1.$tn2.$tn.5 { PRAGMA integrity_check } ok
|
||||||
|
|
||||||
if {$cmd=="step_ota_state"} {
|
if {$cmd=="step_rbu_state"} {
|
||||||
do_test $tn3.1.$tn2.$tn.6 { file exists state.db } 1
|
do_test $tn3.1.$tn2.$tn.6 { file exists state.db } 1
|
||||||
do_test $tn3.1.$tn2.$tn.7 { expr {$check == [dbfilecksum ota.db]} } 1
|
do_test $tn3.1.$tn2.$tn.7 { expr {$check == [dbfilecksum rbu.db]} } 1
|
||||||
} else {
|
} else {
|
||||||
do_test $tn3.1.$tn2.$tn.8 { file exists state.db } 0
|
do_test $tn3.1.$tn2.$tn.8 { file exists state.db } 0
|
||||||
do_test $tn3.1.$tn2.$tn.9 { expr {$check == [dbfilecksum ota.db]} } 0
|
do_test $tn3.1.$tn2.$tn.9 { expr {$check == [dbfilecksum rbu.db]} } 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Check that an OTA cannot be applied to a table that has no PK.
|
# Check that an RBU cannot be applied to a table that has no PK.
|
||||||
#
|
#
|
||||||
# UPDATE: At one point OTA required that all tables featured either
|
# UPDATE: At one point RBU required that all tables featured either
|
||||||
# explicit IPK columns or were declared WITHOUT ROWID. This has been
|
# explicit IPK columns or were declared WITHOUT ROWID. This has been
|
||||||
# relaxed so that external PRIMARY KEYs on tables with automatic rowids
|
# relaxed so that external PRIMARY KEYs on tables with automatic rowids
|
||||||
# are now allowed.
|
# are now allowed.
|
||||||
#
|
#
|
||||||
# UPDATE 2: Tables without any PRIMARY KEY declaration are now allowed.
|
# UPDATE 2: Tables without any PRIMARY KEY declaration are now allowed.
|
||||||
# However the input table must feature an "ota_rowid" column.
|
# However the input table must feature an "rbu_rowid" column.
|
||||||
#
|
#
|
||||||
reset_db
|
reset_db
|
||||||
create_ota1 ota.db
|
create_rbu1 rbu.db
|
||||||
do_execsql_test $tn3.2.1 { CREATE TABLE t1(a, b, c) }
|
do_execsql_test $tn3.2.1 { CREATE TABLE t1(a, b, c) }
|
||||||
do_test $tn3.2.2 {
|
do_test $tn3.2.2 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_ERROR}
|
} {SQLITE_ERROR}
|
||||||
do_test $tn3.2.3 {
|
do_test $tn3.2.3 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 {SQLITE_ERROR - table data_t1 requires ota_rowid column}}
|
} {1 {SQLITE_ERROR - table data_t1 requires rbu_rowid column}}
|
||||||
reset_db
|
reset_db
|
||||||
do_execsql_test $tn3.2.4 { CREATE TABLE t1(a PRIMARY KEY, b, c) }
|
do_execsql_test $tn3.2.4 { CREATE TABLE t1(a PRIMARY KEY, b, c) }
|
||||||
do_test $tn3.2.5 {
|
do_test $tn3.2.5 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_OK}
|
} {SQLITE_OK}
|
||||||
do_test $tn3.2.6 {
|
do_test $tn3.2.6 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {0 SQLITE_OK}
|
} {0 SQLITE_OK}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Check that if a UNIQUE constraint is violated the current and all
|
# Check that if a UNIQUE constraint is violated the current and all
|
||||||
# subsequent [ota step] calls return SQLITE_CONSTRAINT. And that the OTA
|
# subsequent [rbu step] calls return SQLITE_CONSTRAINT. And that the RBU
|
||||||
# transaction is rolled back by the [ota close] that deletes the ota
|
# transaction is rolled back by the [rbu close] that deletes the rbu
|
||||||
# handle.
|
# handle.
|
||||||
#
|
#
|
||||||
foreach {tn errcode errmsg schema} {
|
foreach {tn errcode errmsg schema} {
|
||||||
@ -340,16 +340,16 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
set cksum [dbcksum db main]
|
set cksum [dbcksum db main]
|
||||||
|
|
||||||
do_test $tn3.3.$tn.1 {
|
do_test $tn3.3.$tn.1 {
|
||||||
create_ota1 ota.db
|
create_rbu1 rbu.db
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while {[set res [ota step]]=="SQLITE_OK"} {}
|
while {[set res [rbu step]]=="SQLITE_OK"} {}
|
||||||
set res
|
set res
|
||||||
} $errcode
|
} $errcode
|
||||||
|
|
||||||
do_test $tn3.3.$tn.2 { ota step } $errcode
|
do_test $tn3.3.$tn.2 { rbu step } $errcode
|
||||||
|
|
||||||
do_test $tn3.3.$tn.3 {
|
do_test $tn3.3.$tn.3 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} [list 1 "$errcode - $errmsg"]
|
} [list 1 "$errcode - $errmsg"]
|
||||||
|
|
||||||
do_test $tn3.3.$tn.4 { dbcksum db main } $cksum
|
do_test $tn3.3.$tn.4 { dbcksum db main } $cksum
|
||||||
@ -357,7 +357,7 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
foreach {tn2 cmd} {1 run_ota 2 step_ota 3 step_ota_state } {
|
foreach {tn2 cmd} {1 run_rbu 2 step_rbu 3 step_rbu_state } {
|
||||||
foreach {tn schema} {
|
foreach {tn schema} {
|
||||||
1 {
|
1 {
|
||||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
||||||
@ -406,12 +406,12 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
INSERT INTO t1 VALUES(6, 'hello', 'xyz');
|
INSERT INTO t1 VALUES(6, 'hello', 'xyz');
|
||||||
}
|
}
|
||||||
|
|
||||||
create_ota4 ota.db
|
create_rbu4 rbu.db
|
||||||
set check [dbfilecksum ota.db]
|
set check [dbfilecksum rbu.db]
|
||||||
forcedelete state.db
|
forcedelete state.db
|
||||||
|
|
||||||
do_test $tn3.4.$tn2.$tn.1 {
|
do_test $tn3.4.$tn2.$tn.1 {
|
||||||
$cmd test.db ota.db
|
$cmd test.db rbu.db
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test $tn3.4.$tn2.$tn.2 {
|
do_execsql_test $tn3.4.$tn2.$tn.2 {
|
||||||
@ -424,17 +424,17 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
|
|
||||||
do_execsql_test $tn3.4.$tn2.$tn.3 { PRAGMA integrity_check } ok
|
do_execsql_test $tn3.4.$tn2.$tn.3 { PRAGMA integrity_check } ok
|
||||||
|
|
||||||
if {$cmd=="step_ota_state"} {
|
if {$cmd=="step_rbu_state"} {
|
||||||
do_test $tn3.4.$tn2.$tn.4 { file exists state.db } 1
|
do_test $tn3.4.$tn2.$tn.4 { file exists state.db } 1
|
||||||
do_test $tn3.4.$tn2.$tn.5 { expr {$check == [dbfilecksum ota.db]} } 1
|
do_test $tn3.4.$tn2.$tn.5 { expr {$check == [dbfilecksum rbu.db]} } 1
|
||||||
} else {
|
} else {
|
||||||
do_test $tn3.4.$tn2.$tn.6 { file exists state.db } 0
|
do_test $tn3.4.$tn2.$tn.6 { file exists state.db } 0
|
||||||
do_test $tn3.4.$tn2.$tn.7 { expr {$check == [dbfilecksum ota.db]} } 0
|
do_test $tn3.4.$tn2.$tn.7 { expr {$check == [dbfilecksum rbu.db]} } 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach {tn2 cmd} {1 run_ota 2 step_ota 3 step_ota_state} {
|
foreach {tn2 cmd} {1 run_rbu 2 step_rbu 3 step_rbu_state} {
|
||||||
foreach {tn schema} {
|
foreach {tn schema} {
|
||||||
1 {
|
1 {
|
||||||
CREATE TABLE t1(c, b, '(a)' INTEGER PRIMARY KEY);
|
CREATE TABLE t1(c, b, '(a)' INTEGER PRIMARY KEY);
|
||||||
@ -455,12 +455,12 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
INSERT INTO t1('(a)', b, c) VALUES(6, 'hello', 'xyz');
|
INSERT INTO t1('(a)', b, c) VALUES(6, 'hello', 'xyz');
|
||||||
}
|
}
|
||||||
|
|
||||||
create_ota4b ota.db
|
create_rbu4b rbu.db
|
||||||
set check [dbfilecksum ota.db]
|
set check [dbfilecksum rbu.db]
|
||||||
forcedelete state.db
|
forcedelete state.db
|
||||||
|
|
||||||
do_test $tn3.5.$tn2.$tn.1 {
|
do_test $tn3.5.$tn2.$tn.1 {
|
||||||
$cmd test.db ota.db
|
$cmd test.db rbu.db
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test $tn3.5.$tn2.$tn.2 {
|
do_execsql_test $tn3.5.$tn2.$tn.2 {
|
||||||
@ -473,19 +473,19 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
|
|
||||||
do_execsql_test $tn3.4.$tn2.$tn.3 { PRAGMA integrity_check } ok
|
do_execsql_test $tn3.4.$tn2.$tn.3 { PRAGMA integrity_check } ok
|
||||||
|
|
||||||
if {$cmd=="step_ota_state"} {
|
if {$cmd=="step_rbu_state"} {
|
||||||
do_test $tn3.5.$tn2.$tn.4 { file exists state.db } 1
|
do_test $tn3.5.$tn2.$tn.4 { file exists state.db } 1
|
||||||
do_test $tn3.5.$tn2.$tn.5 { expr {$check == [dbfilecksum ota.db]} } 1
|
do_test $tn3.5.$tn2.$tn.5 { expr {$check == [dbfilecksum rbu.db]} } 1
|
||||||
} else {
|
} else {
|
||||||
do_test $tn3.5.$tn2.$tn.6 { file exists state.db } 0
|
do_test $tn3.5.$tn2.$tn.6 { file exists state.db } 0
|
||||||
do_test $tn3.5.$tn2.$tn.7 { expr {$check == [dbfilecksum ota.db]} } 0
|
do_test $tn3.5.$tn2.$tn.7 { expr {$check == [dbfilecksum rbu.db]} } 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
foreach {tn2 cmd} {1 run_ota 2 step_ota 3 step_ota_state} {
|
foreach {tn2 cmd} {1 run_rbu 2 step_rbu 3 step_rbu_state} {
|
||||||
foreach {tn schema} {
|
foreach {tn schema} {
|
||||||
1 {
|
1 {
|
||||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, d);
|
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, d);
|
||||||
@ -526,12 +526,12 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
INSERT INTO t1 VALUES(3, 8, 9, 10);
|
INSERT INTO t1 VALUES(3, 8, 9, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
create_ota5 ota.db
|
create_rbu5 rbu.db
|
||||||
set check [dbfilecksum ota.db]
|
set check [dbfilecksum rbu.db]
|
||||||
forcedelete state.db
|
forcedelete state.db
|
||||||
|
|
||||||
do_test $tn3.5.$tn2.$tn.1 {
|
do_test $tn3.5.$tn2.$tn.1 {
|
||||||
$cmd test.db ota.db
|
$cmd test.db rbu.db
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test $tn3.5.$tn2.$tn.2 {
|
do_execsql_test $tn3.5.$tn2.$tn.2 {
|
||||||
@ -544,12 +544,12 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
|
|
||||||
do_execsql_test $tn3.6.$tn2.$tn.3 { PRAGMA integrity_check } ok
|
do_execsql_test $tn3.6.$tn2.$tn.3 { PRAGMA integrity_check } ok
|
||||||
|
|
||||||
if {$cmd=="step_ota_state"} {
|
if {$cmd=="step_rbu_state"} {
|
||||||
do_test $tn3.6.$tn2.$tn.4 { file exists state.db } 1
|
do_test $tn3.6.$tn2.$tn.4 { file exists state.db } 1
|
||||||
do_test $tn3.6.$tn2.$tn.5 { expr {$check == [dbfilecksum ota.db]} } 1
|
do_test $tn3.6.$tn2.$tn.5 { expr {$check == [dbfilecksum rbu.db]} } 1
|
||||||
} else {
|
} else {
|
||||||
do_test $tn3.6.$tn2.$tn.6 { file exists state.db } 0
|
do_test $tn3.6.$tn2.$tn.6 { file exists state.db } 0
|
||||||
do_test $tn3.6.$tn2.$tn.7 { expr {$check == [dbfilecksum ota.db]} } 0
|
do_test $tn3.6.$tn2.$tn.7 { expr {$check == [dbfilecksum rbu.db]} } 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,9 +557,9 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Test some error cases:
|
# Test some error cases:
|
||||||
#
|
#
|
||||||
# * A virtual table with no ota_rowid column.
|
# * A virtual table with no rbu_rowid column.
|
||||||
# * A no-PK table with no ota_rowid column.
|
# * A no-PK table with no rbu_rowid column.
|
||||||
# * A PK table with an ota_rowid column.
|
# * A PK table with an rbu_rowid column.
|
||||||
#
|
#
|
||||||
# 6: An update string of the wrong length
|
# 6: An update string of the wrong length
|
||||||
#
|
#
|
||||||
@ -567,88 +567,88 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
foreach {tn schema error} {
|
foreach {tn schema error} {
|
||||||
1 {
|
1 {
|
||||||
CREATE TABLE t1(a, b);
|
CREATE TABLE t1(a, b);
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_control);
|
||||||
} {SQLITE_ERROR - table data_t1 requires ota_rowid column}
|
} {SQLITE_ERROR - table data_t1 requires rbu_rowid column}
|
||||||
|
|
||||||
2 {
|
2 {
|
||||||
CREATE VIRTUAL TABLE t1 USING fts4(a, b);
|
CREATE VIRTUAL TABLE t1 USING fts4(a, b);
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_control);
|
||||||
} {SQLITE_ERROR - table data_t1 requires ota_rowid column}
|
} {SQLITE_ERROR - table data_t1 requires rbu_rowid column}
|
||||||
|
|
||||||
3 {
|
3 {
|
||||||
CREATE TABLE t1(a PRIMARY KEY, b);
|
CREATE TABLE t1(a PRIMARY KEY, b);
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_rowid, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_rowid, rbu_control);
|
||||||
} {SQLITE_ERROR - table data_t1 may not have ota_rowid column}
|
} {SQLITE_ERROR - table data_t1 may not have rbu_rowid column}
|
||||||
|
|
||||||
4 {
|
4 {
|
||||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_rowid, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_rowid, rbu_control);
|
||||||
} {SQLITE_ERROR - table data_t1 may not have ota_rowid column}
|
} {SQLITE_ERROR - table data_t1 may not have rbu_rowid column}
|
||||||
|
|
||||||
5 {
|
5 {
|
||||||
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_rowid, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_rowid, rbu_control);
|
||||||
} {SQLITE_ERROR - table data_t1 may not have ota_rowid column}
|
} {SQLITE_ERROR - table data_t1 may not have rbu_rowid column}
|
||||||
|
|
||||||
6 {
|
6 {
|
||||||
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_control);
|
||||||
INSERT INTO ota.data_t1 VALUES(1, 2, 'x.x');
|
INSERT INTO rbu.data_t1 VALUES(1, 2, 'x.x');
|
||||||
} {SQLITE_ERROR - invalid ota_control value}
|
} {SQLITE_ERROR - invalid rbu_control value}
|
||||||
|
|
||||||
7 {
|
7 {
|
||||||
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_control);
|
||||||
INSERT INTO ota.data_t1 VALUES(1, 2, NULL);
|
INSERT INTO rbu.data_t1 VALUES(1, 2, NULL);
|
||||||
} {SQLITE_ERROR - invalid ota_control value}
|
} {SQLITE_ERROR - invalid rbu_control value}
|
||||||
|
|
||||||
8 {
|
8 {
|
||||||
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_control);
|
||||||
INSERT INTO ota.data_t1 VALUES(1, 2, 4);
|
INSERT INTO rbu.data_t1 VALUES(1, 2, 4);
|
||||||
} {SQLITE_ERROR - invalid ota_control value}
|
} {SQLITE_ERROR - invalid rbu_control value}
|
||||||
|
|
||||||
9 {
|
9 {
|
||||||
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
CREATE TABLE t1(a, b PRIMARY KEY) WITHOUT ROWID;
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_control);
|
||||||
INSERT INTO ota.data_t1 VALUES(1, 2, 2);
|
INSERT INTO rbu.data_t1 VALUES(1, 2, 2);
|
||||||
} {SQLITE_ERROR - invalid ota_control value}
|
} {SQLITE_ERROR - invalid rbu_control value}
|
||||||
|
|
||||||
10 {
|
10 {
|
||||||
CREATE TABLE t2(a, b);
|
CREATE TABLE t2(a, b);
|
||||||
CREATE TABLE ota.data_t1(a, b, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, rbu_control);
|
||||||
INSERT INTO ota.data_t1 VALUES(1, 2, 2);
|
INSERT INTO rbu.data_t1 VALUES(1, 2, 2);
|
||||||
} {SQLITE_ERROR - no such table: t1}
|
} {SQLITE_ERROR - no such table: t1}
|
||||||
|
|
||||||
11 {
|
11 {
|
||||||
CREATE TABLE ota.data_t2(a, b, ota_control);
|
CREATE TABLE rbu.data_t2(a, b, rbu_control);
|
||||||
INSERT INTO ota.data_t2 VALUES(1, 2, 2);
|
INSERT INTO rbu.data_t2 VALUES(1, 2, 2);
|
||||||
} {SQLITE_ERROR - no such table: t2}
|
} {SQLITE_ERROR - no such table: t2}
|
||||||
|
|
||||||
} {
|
} {
|
||||||
reset_db
|
reset_db
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
execsql { ATTACH 'ota.db' AS ota }
|
execsql { ATTACH 'rbu.db' AS rbu }
|
||||||
execsql $schema
|
execsql $schema
|
||||||
|
|
||||||
do_test $tn3.7.$tn {
|
do_test $tn3.7.$tn {
|
||||||
list [catch { run_ota test.db ota.db } msg] $msg
|
list [catch { run_rbu test.db rbu.db } msg] $msg
|
||||||
} [list 1 $error]
|
} [list 1 $error]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test that an OTA database containing no input tables is handled
|
# Test that an RBU database containing no input tables is handled
|
||||||
# correctly.
|
# correctly.
|
||||||
reset_db
|
reset_db
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
do_test $tn3.8 {
|
do_test $tn3.8 {
|
||||||
list [catch { run_ota test.db ota.db } msg] $msg
|
list [catch { run_rbu test.db rbu.db } msg] $msg
|
||||||
} {0 SQLITE_DONE}
|
} {0 SQLITE_DONE}
|
||||||
|
|
||||||
# Test that OTA can update indexes containing NULL values.
|
# Test that RBU can update indexes containing NULL values.
|
||||||
#
|
#
|
||||||
reset_db
|
reset_db
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
do_execsql_test $tn3.9.1 {
|
do_execsql_test $tn3.9.1 {
|
||||||
CREATE TABLE t1(a PRIMARY KEY, b, c);
|
CREATE TABLE t1(a PRIMARY KEY, b, c);
|
||||||
CREATE INDEX i1 ON t1(b, c);
|
CREATE INDEX i1 ON t1(b, c);
|
||||||
@ -656,14 +656,14 @@ foreach {tn3 create_vfs destroy_vfs} {
|
|||||||
INSERT INTO t1 VALUES(2, NULL, 2);
|
INSERT INTO t1 VALUES(2, NULL, 2);
|
||||||
INSERT INTO t1 VALUES(3, NULL, NULL);
|
INSERT INTO t1 VALUES(3, NULL, NULL);
|
||||||
|
|
||||||
ATTACH 'ota.db' AS ota;
|
ATTACH 'rbu.db' AS rbu;
|
||||||
CREATE TABLE ota.data_t1(a, b, c, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, NULL, NULL, 1);
|
INSERT INTO data_t1 VALUES(1, NULL, NULL, 1);
|
||||||
INSERT INTO data_t1 VALUES(3, NULL, NULL, 1);
|
INSERT INTO data_t1 VALUES(3, NULL, NULL, 1);
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test $tn3.9.2 {
|
do_test $tn3.9.2 {
|
||||||
list [catch { run_ota test.db ota.db } msg] $msg
|
list [catch { run_rbu test.db rbu.db } msg] $msg
|
||||||
} {0 SQLITE_DONE}
|
} {0 SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test $tn3.9.3 {
|
do_execsql_test $tn3.9.3 {
|
@ -14,7 +14,7 @@ if {![info exists testdir]} {
|
|||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota10
|
set ::testprefix rbu10
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@ -26,19 +26,19 @@ do_execsql_test 1.0 {
|
|||||||
INSERT INTO t1 VALUES(1, 'b', 'c');
|
INSERT INTO t1 VALUES(1, 'b', 'c');
|
||||||
}
|
}
|
||||||
|
|
||||||
proc apply_ota {sql} {
|
proc apply_rbu {sql} {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval $sql
|
db2 eval $sql
|
||||||
db2 close
|
db2 close
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while { [ota step]=="SQLITE_OK" } {}
|
while { [rbu step]=="SQLITE_OK" } {}
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
apply_ota {
|
apply_rbu {
|
||||||
CREATE TABLE data_t1(a, c, b, ota_control);
|
CREATE TABLE data_t1(a, c, b, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, 'xxx', NULL, '.x.');
|
INSERT INTO data_t1 VALUES(1, 'xxx', NULL, '.x.');
|
||||||
}
|
}
|
||||||
db eval { SELECT * FROM t1 }
|
db eval { SELECT * FROM t1 }
|
||||||
@ -53,8 +53,8 @@ ifcapable fts3 {
|
|||||||
CREATE VIRTUAL TABLE ft USING fts4(a, b, languageid='langid');
|
CREATE VIRTUAL TABLE ft USING fts4(a, b, languageid='langid');
|
||||||
}
|
}
|
||||||
do_test 2.1 {
|
do_test 2.1 {
|
||||||
apply_ota {
|
apply_rbu {
|
||||||
CREATE TABLE data_ft(a, b, ota_rowid, langid, ota_control);
|
CREATE TABLE data_ft(a, b, rbu_rowid, langid, rbu_control);
|
||||||
INSERT INTO data_ft VALUES('a', 'b', 22, 1, 0); -- insert
|
INSERT INTO data_ft VALUES('a', 'b', 22, 1, 0); -- insert
|
||||||
INSERT INTO data_ft VALUES('a', 'b', 23, 10, 0); -- insert
|
INSERT INTO data_ft VALUES('a', 'b', 23, 10, 0); -- insert
|
||||||
INSERT INTO data_ft VALUES('a', 'b', 24, 100, 0); -- insert
|
INSERT INTO data_ft VALUES('a', 'b', 24, 100, 0); -- insert
|
||||||
@ -70,8 +70,8 @@ ifcapable fts3 {
|
|||||||
# defaults to 0.
|
# defaults to 0.
|
||||||
#
|
#
|
||||||
do_test 2.2 {
|
do_test 2.2 {
|
||||||
apply_ota {
|
apply_rbu {
|
||||||
CREATE TABLE data_ft(a, b, ota_rowid, ota_control);
|
CREATE TABLE data_ft(a, b, rbu_rowid, rbu_control);
|
||||||
INSERT INTO data_ft VALUES('a', 'b', 25, 0); -- insert
|
INSERT INTO data_ft VALUES('a', 'b', 25, 0); -- insert
|
||||||
}
|
}
|
||||||
db eval { SELECT a, b, rowid, langid FROM ft }
|
db eval { SELECT a, b, rowid, langid FROM ft }
|
||||||
@ -85,8 +85,8 @@ ifcapable fts3 {
|
|||||||
# Update langid.
|
# Update langid.
|
||||||
#
|
#
|
||||||
do_test 2.3 {
|
do_test 2.3 {
|
||||||
apply_ota {
|
apply_rbu {
|
||||||
CREATE TABLE data_ft(a, b, ota_rowid, langid, ota_control);
|
CREATE TABLE data_ft(a, b, rbu_rowid, langid, rbu_control);
|
||||||
INSERT INTO data_ft VALUES(NULL, NULL, 23, 50, '..x');
|
INSERT INTO data_ft VALUES(NULL, NULL, 23, 50, '..x');
|
||||||
INSERT INTO data_ft VALUES(NULL, NULL, 25, 500, '..x');
|
INSERT INTO data_ft VALUES(NULL, NULL, 25, 500, '..x');
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ ifcapable fts3 {
|
|||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Test that if writing a hidden virtual table column is an error,
|
# Test that if writing a hidden virtual table column is an error,
|
||||||
# attempting to do so via ota is also an error.
|
# attempting to do so via rbu is also an error.
|
||||||
#
|
#
|
||||||
ifcapable fts3 {
|
ifcapable fts3 {
|
||||||
do_execsql_test 3.0 {
|
do_execsql_test 3.0 {
|
||||||
@ -109,8 +109,8 @@ ifcapable fts3 {
|
|||||||
}
|
}
|
||||||
do_test 3.1 {
|
do_test 3.1 {
|
||||||
list [catch {
|
list [catch {
|
||||||
apply_ota {
|
apply_rbu {
|
||||||
CREATE TABLE data_xt(a, xt, ota_rowid, ota_control);
|
CREATE TABLE data_xt(a, xt, rbu_rowid, rbu_control);
|
||||||
INSERT INTO data_xt VALUES('a', 'b', 1, 0);
|
INSERT INTO data_xt VALUES('a', 'b', 1, 0);
|
||||||
}
|
}
|
||||||
} msg] $msg
|
} msg] $msg
|
||||||
@ -119,7 +119,7 @@ ifcapable fts3 {
|
|||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Test that it is not possible to violate a NOT NULL constraint by
|
# Test that it is not possible to violate a NOT NULL constraint by
|
||||||
# applying an OTA update.
|
# applying an RBU update.
|
||||||
#
|
#
|
||||||
do_execsql_test 4.1 {
|
do_execsql_test 4.1 {
|
||||||
CREATE TABLE t2(a INTEGER NOT NULL, b TEXT NOT NULL, c PRIMARY KEY);
|
CREATE TABLE t2(a INTEGER NOT NULL, b TEXT NOT NULL, c PRIMARY KEY);
|
||||||
@ -131,7 +131,7 @@ do_execsql_test 4.1 {
|
|||||||
INSERT INTO t4 VALUES(10, 10);
|
INSERT INTO t4 VALUES(10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach {tn error ota} {
|
foreach {tn error rbu} {
|
||||||
2 {SQLITE_CONSTRAINT - NOT NULL constraint failed: t2.a} {
|
2 {SQLITE_CONSTRAINT - NOT NULL constraint failed: t2.a} {
|
||||||
INSERT INTO data_t2 VALUES(NULL, 'abc', 1, 0);
|
INSERT INTO data_t2 VALUES(NULL, 'abc', 1, 0);
|
||||||
}
|
}
|
||||||
@ -163,24 +163,24 @@ foreach {tn error ota} {
|
|||||||
INSERT INTO data_t3 VALUES(1, 'abc', 'text', 0);
|
INSERT INTO data_t3 VALUES(1, 'abc', 'text', 0);
|
||||||
}
|
}
|
||||||
} {
|
} {
|
||||||
set ota "
|
set rbu "
|
||||||
CREATE TABLE data_t2(a, b, c, ota_control);
|
CREATE TABLE data_t2(a, b, c, rbu_control);
|
||||||
CREATE TABLE data_t3(a, b, c, ota_control);
|
CREATE TABLE data_t3(a, b, c, rbu_control);
|
||||||
CREATE TABLE data_t4(a, b, ota_control);
|
CREATE TABLE data_t4(a, b, rbu_control);
|
||||||
$ota
|
$rbu
|
||||||
"
|
"
|
||||||
do_test 4.2.$tn {
|
do_test 4.2.$tn {
|
||||||
list [catch { apply_ota $ota } msg] $msg
|
list [catch { apply_rbu $rbu } msg] $msg
|
||||||
} [list 1 $error]
|
} [list 1 $error]
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test 4.3 {
|
do_test 4.3 {
|
||||||
set ota {
|
set rbu {
|
||||||
CREATE TABLE data_t3(a, b, c, ota_control);
|
CREATE TABLE data_t3(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t3 VALUES(1, 'abc', '5', 0);
|
INSERT INTO data_t3 VALUES(1, 'abc', '5', 0);
|
||||||
INSERT INTO data_t3 VALUES(1, 'abc', '-6.0', 0);
|
INSERT INTO data_t3 VALUES(1, 'abc', '-6.0', 0);
|
||||||
}
|
}
|
||||||
list [catch { apply_ota $ota } msg] $msg
|
list [catch { apply_rbu $rbu } msg] $msg
|
||||||
} {0 SQLITE_DONE}
|
} {0 SQLITE_DONE}
|
||||||
|
|
||||||
|
|
@ -14,17 +14,17 @@ if {![info exists testdir]} {
|
|||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota11
|
set ::testprefix rbu11
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Test that the xAccess() method of an ota vfs handles queries other
|
# Test that the xAccess() method of an rbu vfs handles queries other
|
||||||
# than SQLITE_ACCESS_EXISTS correctly. The test code below causes
|
# than SQLITE_ACCESS_EXISTS correctly. The test code below causes
|
||||||
# SQLite to call xAccess(SQLITE_ACCESS_READWRITE) on the directory
|
# SQLite to call xAccess(SQLITE_ACCESS_READWRITE) on the directory
|
||||||
# path argument passed to "PRAGMA temp_store_directory".
|
# path argument passed to "PRAGMA temp_store_directory".
|
||||||
#
|
#
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
sqlite3ota_create_vfs -default ota ""
|
sqlite3rbu_create_vfs -default rbu ""
|
||||||
reset_db
|
reset_db
|
||||||
catchsql { PRAGMA temp_store_directory = '/no/such/directory' }
|
catchsql { PRAGMA temp_store_directory = '/no/such/directory' }
|
||||||
} {1 {not a writable directory}}
|
} {1 {not a writable directory}}
|
||||||
@ -39,11 +39,11 @@ do_test 1.3 {
|
|||||||
|
|
||||||
do_test 1.4 {
|
do_test 1.4 {
|
||||||
db close
|
db close
|
||||||
sqlite3ota_destroy_vfs ota
|
sqlite3rbu_destroy_vfs rbu
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Try to trick ota into operating on a database opened in wal mode.
|
# Try to trick rbu into operating on a database opened in wal mode.
|
||||||
#
|
#
|
||||||
reset_db
|
reset_db
|
||||||
do_execsql_test 2.1 {
|
do_execsql_test 2.1 {
|
||||||
@ -57,10 +57,10 @@ do_test 2.2 {
|
|||||||
db_save
|
db_save
|
||||||
db close
|
db close
|
||||||
|
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval {
|
dbo eval {
|
||||||
CREATE TABLE data_t1(a, b, c, ota_control);
|
CREATE TABLE data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(4, 5, 6, 0);
|
INSERT INTO data_t1 VALUES(4, 5, 6, 0);
|
||||||
INSERT INTO data_t1 VALUES(7, 8, 9, 0);
|
INSERT INTO data_t1 VALUES(7, 8, 9, 0);
|
||||||
}
|
}
|
||||||
@ -72,12 +72,12 @@ do_test 2.2 {
|
|||||||
} {1}
|
} {1}
|
||||||
|
|
||||||
do_test 2.3 {
|
do_test 2.3 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_ERROR}
|
} {SQLITE_ERROR}
|
||||||
|
|
||||||
do_test 2.4 {
|
do_test 2.4 {
|
||||||
list [catch {ota close} msg] $msg
|
list [catch {rbu close} msg] $msg
|
||||||
} {1 {SQLITE_ERROR - cannot update wal mode database}}
|
} {1 {SQLITE_ERROR - cannot update wal mode database}}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@ -94,26 +94,26 @@ do_execsql_test 3.1 {
|
|||||||
db close
|
db close
|
||||||
|
|
||||||
do_test 3.2 {
|
do_test 3.2 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval {
|
dbo eval {
|
||||||
CREATE TABLE "data_(t1)"(a, b, c, ota_control);
|
CREATE TABLE "data_(t1)"(a, b, c, rbu_control);
|
||||||
INSERT INTO "data_(t1)" VALUES(4, 8, 9, 0);
|
INSERT INTO "data_(t1)" VALUES(4, 8, 9, 0);
|
||||||
}
|
}
|
||||||
dbo close
|
dbo close
|
||||||
|
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_CONSTRAINT}
|
} {SQLITE_CONSTRAINT}
|
||||||
|
|
||||||
do_test 3.3 {
|
do_test 3.3 {
|
||||||
list [catch {ota close} msg] $msg
|
list [catch {rbu close} msg] $msg
|
||||||
} {1 {SQLITE_CONSTRAINT - UNIQUE constraint failed: (t1).a}}
|
} {1 {SQLITE_CONSTRAINT - UNIQUE constraint failed: (t1).a}}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Check that once an OTA update has been applied, attempting to apply
|
# Check that once an RBU update has been applied, attempting to apply
|
||||||
# it a second time is a no-op (as the state stored in the OTA database is
|
# it a second time is a no-op (as the state stored in the RBU database is
|
||||||
# "all steps completed").
|
# "all steps completed").
|
||||||
#
|
#
|
||||||
reset_db
|
reset_db
|
||||||
@ -125,74 +125,74 @@ do_execsql_test 4.1 {
|
|||||||
db close
|
db close
|
||||||
|
|
||||||
do_test 4.2 {
|
do_test 4.2 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval {
|
dbo eval {
|
||||||
CREATE TABLE "data_(t1)"(a, b, c, ota_control);
|
CREATE TABLE "data_(t1)"(a, b, c, rbu_control);
|
||||||
INSERT INTO "data_(t1)" VALUES(7, 8, 9, 0);
|
INSERT INTO "data_(t1)" VALUES(7, 8, 9, 0);
|
||||||
INSERT INTO "data_(t1)" VALUES(1, 2, 3, 1);
|
INSERT INTO "data_(t1)" VALUES(1, 2, 3, 1);
|
||||||
}
|
}
|
||||||
dbo close
|
dbo close
|
||||||
|
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while {[ota step]=="SQLITE_OK"} { }
|
while {[rbu step]=="SQLITE_OK"} { }
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_test 4.3 {
|
do_test 4.3 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_test 4.4 {
|
do_test 4.4 {
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_test 4.5.1 {
|
do_test 4.5.1 {
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval { INSERT INTO ota_state VALUES(100, 100) }
|
dbo eval { INSERT INTO rbu_state VALUES(100, 100) }
|
||||||
dbo close
|
dbo close
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_CORRUPT}
|
} {SQLITE_CORRUPT}
|
||||||
do_test 4.5.2 {
|
do_test 4.5.2 {
|
||||||
list [catch {ota close} msg] $msg
|
list [catch {rbu close} msg] $msg
|
||||||
} {1 SQLITE_CORRUPT}
|
} {1 SQLITE_CORRUPT}
|
||||||
do_test 4.5.3 {
|
do_test 4.5.3 {
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval { DELETE FROM ota_state WHERE k = 100 }
|
dbo eval { DELETE FROM rbu_state WHERE k = 100 }
|
||||||
dbo close
|
dbo close
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
# Also, check that an invalid state value in the ota_state table is
|
# Also, check that an invalid state value in the rbu_state table is
|
||||||
# detected and reported as corruption.
|
# detected and reported as corruption.
|
||||||
do_test 4.6.1 {
|
do_test 4.6.1 {
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval { UPDATE ota_state SET v = v*-1 WHERE k = 1 }
|
dbo eval { UPDATE rbu_state SET v = v*-1 WHERE k = 1 }
|
||||||
dbo close
|
dbo close
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_CORRUPT}
|
} {SQLITE_CORRUPT}
|
||||||
do_test 4.6.2 {
|
do_test 4.6.2 {
|
||||||
list [catch {ota close} msg] $msg
|
list [catch {rbu close} msg] $msg
|
||||||
} {1 SQLITE_CORRUPT}
|
} {1 SQLITE_CORRUPT}
|
||||||
do_test 4.6.3 {
|
do_test 4.6.3 {
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval { UPDATE ota_state SET v = v*-1 WHERE k = 1 }
|
dbo eval { UPDATE rbu_state SET v = v*-1 WHERE k = 1 }
|
||||||
dbo close
|
dbo close
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 4.7.1 {
|
do_test 4.7.1 {
|
||||||
sqlite3 dbo ota.db
|
sqlite3 dbo rbu.db
|
||||||
dbo eval { UPDATE ota_state SET v = 1 WHERE k = 1 }
|
dbo eval { UPDATE rbu_state SET v = 1 WHERE k = 1 }
|
||||||
dbo eval { UPDATE ota_state SET v = 'nosuchtable' WHERE k = 2 }
|
dbo eval { UPDATE rbu_state SET v = 'nosuchtable' WHERE k = 2 }
|
||||||
dbo close
|
dbo close
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_ERROR}
|
} {SQLITE_ERROR}
|
||||||
do_test 4.7.2 {
|
do_test 4.7.2 {
|
||||||
list [catch {ota close} msg] $msg
|
list [catch {rbu close} msg] $msg
|
||||||
} {1 {SQLITE_ERROR - ota_state mismatch error}}
|
} {1 {SQLITE_ERROR - rbu_state mismatch error}}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
@ -15,7 +15,7 @@ if {![info exists testdir]} {
|
|||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
source $testdir/lock_common.tcl
|
source $testdir/lock_common.tcl
|
||||||
set ::testprefix ota12
|
set ::testprefix rbu12
|
||||||
|
|
||||||
set setup_sql {
|
set setup_sql {
|
||||||
DROP TABLE IF EXISTS xx;
|
DROP TABLE IF EXISTS xx;
|
||||||
@ -24,34 +24,34 @@ set setup_sql {
|
|||||||
INSERT INTO xx VALUES(1, 2, 3);
|
INSERT INTO xx VALUES(1, 2, 3);
|
||||||
CREATE TABLE xy(a, b, c PRIMARY KEY);
|
CREATE TABLE xy(a, b, c PRIMARY KEY);
|
||||||
|
|
||||||
ATTACH 'ota.db' AS ota;
|
ATTACH 'rbu.db' AS rbu;
|
||||||
DROP TABLE IF EXISTS data_xx;
|
DROP TABLE IF EXISTS data_xx;
|
||||||
CREATE TABLE ota.data_xx(a, b, c, ota_control);
|
CREATE TABLE rbu.data_xx(a, b, c, rbu_control);
|
||||||
INSERT INTO data_xx VALUES(4, 5, 6, 0);
|
INSERT INTO data_xx VALUES(4, 5, 6, 0);
|
||||||
INSERT INTO data_xx VALUES(7, 8, 9, 0);
|
INSERT INTO data_xx VALUES(7, 8, 9, 0);
|
||||||
CREATE TABLE ota.data_xy(a, b, c, ota_control);
|
CREATE TABLE rbu.data_xy(a, b, c, rbu_control);
|
||||||
INSERT INTO data_xy VALUES(10, 11, 12, 0);
|
INSERT INTO data_xy VALUES(10, 11, 12, 0);
|
||||||
DETACH ota;
|
DETACH rbu;
|
||||||
}
|
}
|
||||||
|
|
||||||
do_multiclient_test tn {
|
do_multiclient_test tn {
|
||||||
|
|
||||||
# Initialize a target (test.db) and ota (ota.db) database.
|
# Initialize a target (test.db) and rbu (rbu.db) database.
|
||||||
#
|
#
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sql1 $setup_sql
|
sql1 $setup_sql
|
||||||
|
|
||||||
# Using connection 2, open a read transaction on the target database.
|
# Using connection 2, open a read transaction on the target database.
|
||||||
# OTA will still be able to generate "test.db-oal", but it will not be
|
# RBU will still be able to generate "test.db-oal", but it will not be
|
||||||
# able to rename it to "test.db-wal".
|
# able to rename it to "test.db-wal".
|
||||||
#
|
#
|
||||||
do_test 1.$tn.1 {
|
do_test 1.$tn.1 {
|
||||||
sql2 { BEGIN; SELECT * FROM xx; }
|
sql2 { BEGIN; SELECT * FROM xx; }
|
||||||
} {1 2 3}
|
} {1 2 3}
|
||||||
do_test 1.$tn.2 {
|
do_test 1.$tn.2 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while 1 {
|
while 1 {
|
||||||
set res [ota step]
|
set res [rbu step]
|
||||||
if {$res!="SQLITE_OK"} break
|
if {$res!="SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
set res
|
set res
|
||||||
@ -64,119 +64,119 @@ do_multiclient_test tn {
|
|||||||
} {0 1}
|
} {0 1}
|
||||||
do_test 1.$tn.6 { sql2 COMMIT } {}
|
do_test 1.$tn.6 { sql2 COMMIT } {}
|
||||||
|
|
||||||
# The ota object that hit the SQLITE_BUSY error above cannot be reused.
|
# The rbu object that hit the SQLITE_BUSY error above cannot be reused.
|
||||||
# It is stuck in a permanent SQLITE_BUSY state at this point.
|
# It is stuck in a permanent SQLITE_BUSY state at this point.
|
||||||
#
|
#
|
||||||
do_test 1.$tn.7 { ota step } {SQLITE_BUSY}
|
do_test 1.$tn.7 { rbu step } {SQLITE_BUSY}
|
||||||
do_test 1.$tn.8 {
|
do_test 1.$tn.8 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 SQLITE_BUSY}
|
} {1 SQLITE_BUSY}
|
||||||
|
|
||||||
do_test 1.$tn.9.1 { sql2 { BEGIN EXCLUSIVE } } {}
|
do_test 1.$tn.9.1 { sql2 { BEGIN EXCLUSIVE } } {}
|
||||||
do_test 1.$tn.9.2 {
|
do_test 1.$tn.9.2 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_BUSY}
|
} {SQLITE_BUSY}
|
||||||
do_test 1.$tn.9.3 {
|
do_test 1.$tn.9.3 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 {SQLITE_BUSY - database is locked}}
|
} {1 {SQLITE_BUSY - database is locked}}
|
||||||
do_test 1.$tn.9.4 { sql2 COMMIT } {}
|
do_test 1.$tn.9.4 { sql2 COMMIT } {}
|
||||||
|
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
do_test 1.$tn.10.1 { sql2 { BEGIN EXCLUSIVE } } {}
|
do_test 1.$tn.10.1 { sql2 { BEGIN EXCLUSIVE } } {}
|
||||||
do_test 1.$tn.10.2 {
|
do_test 1.$tn.10.2 {
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_BUSY}
|
} {SQLITE_BUSY}
|
||||||
do_test 1.$tn.10.3 {
|
do_test 1.$tn.10.3 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 SQLITE_BUSY}
|
} {1 SQLITE_BUSY}
|
||||||
do_test 1.$tn.10.4 { sql2 COMMIT } {}
|
do_test 1.$tn.10.4 { sql2 COMMIT } {}
|
||||||
|
|
||||||
# A new ota object can finish the work though.
|
# A new rbu object can finish the work though.
|
||||||
#
|
#
|
||||||
do_test 1.$tn.11 {
|
do_test 1.$tn.11 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_OK}
|
} {SQLITE_OK}
|
||||||
do_test 1.$tn.12 {
|
do_test 1.$tn.12 {
|
||||||
list [file exists test.db-wal] [file exists test.db-oal]
|
list [file exists test.db-wal] [file exists test.db-oal]
|
||||||
} {1 0}
|
} {1 0}
|
||||||
do_test 1.$tn.13 {
|
do_test 1.$tn.13 {
|
||||||
while 1 {
|
while 1 {
|
||||||
set res [ota step]
|
set res [rbu step]
|
||||||
if {$res!="SQLITE_OK"} break
|
if {$res!="SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
set res
|
set res
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_test 1.$tn.14 {
|
do_test 1.$tn.14 {
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
}
|
}
|
||||||
|
|
||||||
do_multiclient_test tn {
|
do_multiclient_test tn {
|
||||||
|
|
||||||
# Initialize a target (test.db) and ota (ota.db) database.
|
# Initialize a target (test.db) and rbu (rbu.db) database.
|
||||||
#
|
#
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sql1 $setup_sql
|
sql1 $setup_sql
|
||||||
|
|
||||||
do_test 2.$tn.1 {
|
do_test 2.$tn.1 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while {[file exists test.db-wal]==0} {
|
while {[file exists test.db-wal]==0} {
|
||||||
if {[ota step]!="SQLITE_OK"} {error "problem here...."}
|
if {[rbu step]!="SQLITE_OK"} {error "problem here...."}
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_OK}
|
} {SQLITE_OK}
|
||||||
|
|
||||||
|
|
||||||
do_test 2.$tn.2 { sql2 { BEGIN IMMEDIATE } } {}
|
do_test 2.$tn.2 { sql2 { BEGIN IMMEDIATE } } {}
|
||||||
|
|
||||||
do_test 2.$tn.3 {
|
do_test 2.$tn.3 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_BUSY}
|
} {SQLITE_BUSY}
|
||||||
|
|
||||||
do_test 2.$tn.4 { list [catch { ota close } msg] $msg } {1 SQLITE_BUSY}
|
do_test 2.$tn.4 { list [catch { rbu close } msg] $msg } {1 SQLITE_BUSY}
|
||||||
|
|
||||||
do_test 2.$tn.5 {
|
do_test 2.$tn.5 {
|
||||||
sql2 { SELECT * FROM xx ; COMMIT }
|
sql2 { SELECT * FROM xx ; COMMIT }
|
||||||
} {1 2 3 4 5 6 7 8 9}
|
} {1 2 3 4 5 6 7 8 9}
|
||||||
|
|
||||||
do_test 2.$tn.6 {
|
do_test 2.$tn.6 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_OK}
|
} {SQLITE_OK}
|
||||||
|
|
||||||
do_test 2.$tn.7 { sql2 { BEGIN EXCLUSIVE } } {}
|
do_test 2.$tn.7 { sql2 { BEGIN EXCLUSIVE } } {}
|
||||||
|
|
||||||
do_test 2.$tn.8 {
|
do_test 2.$tn.8 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_BUSY}
|
} {SQLITE_BUSY}
|
||||||
do_test 2.$tn.9 { list [catch { ota close } msg] $msg } {1 SQLITE_BUSY}
|
do_test 2.$tn.9 { list [catch { rbu close } msg] $msg } {1 SQLITE_BUSY}
|
||||||
do_test 2.$tn.10 {
|
do_test 2.$tn.10 {
|
||||||
sql2 { SELECT * FROM xx ; COMMIT }
|
sql2 { SELECT * FROM xx ; COMMIT }
|
||||||
} {1 2 3 4 5 6 7 8 9}
|
} {1 2 3 4 5 6 7 8 9}
|
||||||
|
|
||||||
do_test 2.$tn.11 {
|
do_test 2.$tn.11 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while {[ota step]=="SQLITE_OK"} {}
|
while {[rbu step]=="SQLITE_OK"} {}
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Test that "PRAGMA data_version" works when an OTA client writes the
|
# Test that "PRAGMA data_version" works when an RBU client writes the
|
||||||
# database.
|
# database.
|
||||||
#
|
#
|
||||||
do_multiclient_test tn {
|
do_multiclient_test tn {
|
||||||
|
|
||||||
# Initialize a target (test.db) and ota (ota.db) database.
|
# Initialize a target (test.db) and rbu (rbu.db) database.
|
||||||
#
|
#
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sql1 $setup_sql
|
sql1 $setup_sql
|
||||||
|
|
||||||
# Check the initial database contains table "xx" with a single row.
|
# Check the initial database contains table "xx" with a single row.
|
||||||
@ -195,17 +195,17 @@ do_multiclient_test tn {
|
|||||||
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
||||||
} [list $V1 $V2]
|
} [list $V1 $V2]
|
||||||
|
|
||||||
# Start stepping the OTA. From the point of view of [db1] and [db2], the
|
# Start stepping the RBU. From the point of view of [db1] and [db2], the
|
||||||
# data-version values remain unchanged until the database contents are
|
# data-version values remain unchanged until the database contents are
|
||||||
# modified. At which point the values are incremented.
|
# modified. At which point the values are incremented.
|
||||||
#
|
#
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
set x 0
|
set x 0
|
||||||
while {[db one {SELECT count(*) FROM xx}]==1} {
|
while {[db one {SELECT count(*) FROM xx}]==1} {
|
||||||
do_test 2.$tn.3.[incr x] {
|
do_test 2.$tn.3.[incr x] {
|
||||||
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
||||||
} [list $V1 $V2]
|
} [list $V1 $V2]
|
||||||
ota step
|
rbu step
|
||||||
}
|
}
|
||||||
do_test 2.$tn.5.1 { expr {$V1 < [sql1 {PRAGMA data_version}]} } 1
|
do_test 2.$tn.5.1 { expr {$V1 < [sql1 {PRAGMA data_version}]} } 1
|
||||||
do_test 2.$tn.5.2 { expr {$V2 < [sql2 {PRAGMA data_version}]} } 1
|
do_test 2.$tn.5.2 { expr {$V2 < [sql2 {PRAGMA data_version}]} } 1
|
||||||
@ -219,11 +219,11 @@ do_multiclient_test tn {
|
|||||||
set V1 [sql1 {PRAGMA data_version}]
|
set V1 [sql1 {PRAGMA data_version}]
|
||||||
set V2 [sql2 {PRAGMA data_version}]
|
set V2 [sql2 {PRAGMA data_version}]
|
||||||
|
|
||||||
# Finish applying the OTA (i.e. do the incremental checkpoint). Check that
|
# Finish applying the RBU (i.e. do the incremental checkpoint). Check that
|
||||||
# this does not cause the data-version values to change.
|
# this does not cause the data-version values to change.
|
||||||
#
|
#
|
||||||
while {[ota step]=="SQLITE_OK"} { }
|
while {[rbu step]=="SQLITE_OK"} { }
|
||||||
ota close
|
rbu close
|
||||||
|
|
||||||
do_test 2.$tn.6 {
|
do_test 2.$tn.6 {
|
||||||
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
@ -9,8 +9,8 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# Test an OTA update that features lots of different ota_control strings
|
# Test an RBU update that features lots of different rbu_control strings
|
||||||
# for UPDATE statements. This tests OTA's internal UPDATE statement cache.
|
# for UPDATE statements. This tests RBU's internal UPDATE statement cache.
|
||||||
#
|
#
|
||||||
|
|
||||||
if {![info exists testdir]} {
|
if {![info exists testdir]} {
|
||||||
@ -18,7 +18,7 @@ if {![info exists testdir]} {
|
|||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
source $testdir/lock_common.tcl
|
source $testdir/lock_common.tcl
|
||||||
set ::testprefix ota13
|
set ::testprefix rbu13
|
||||||
|
|
||||||
do_execsql_test 1.0 {
|
do_execsql_test 1.0 {
|
||||||
CREATE TABLE t1(a PRIMARY KEY, b, c, d, e, f, g, h);
|
CREATE TABLE t1(a PRIMARY KEY, b, c, d, e, f, g, h);
|
||||||
@ -26,10 +26,10 @@ do_execsql_test 1.0 {
|
|||||||
INSERT INTO t1 SELECT i, 0, 0, 0, 0, 0, 0, 0 FROM ii;
|
INSERT INTO t1 SELECT i, 0, 0, 0, 0, 0, 0, 0 FROM ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
do_execsql_test 1.1 {
|
do_execsql_test 1.1 {
|
||||||
ATTACH 'ota.db' AS ota;
|
ATTACH 'rbu.db' AS rbu;
|
||||||
CREATE TABLE ota.data_t1(a, b, c, d, e, f, g, h, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, c, d, e, f, g, h, rbu_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test 1.2 {
|
do_test 1.2 {
|
||||||
@ -47,12 +47,12 @@ do_test 1.2 {
|
|||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 1.3 {
|
do_test 1.3 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while 1 {
|
while 1 {
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
if {$rc!="SQLITE_OK"} break
|
if {$rc!="SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test 1.4 {
|
do_execsql_test 1.4 {
|
@ -14,25 +14,25 @@ if {![info exists testdir]} {
|
|||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota3
|
set ::testprefix rbu3
|
||||||
|
|
||||||
|
|
||||||
# Run the OTA in file $ota on target database $target until completion.
|
# Run the RBU in file $rbu on target database $target until completion.
|
||||||
#
|
#
|
||||||
proc run_ota {target ota} {
|
proc run_rbu {target rbu} {
|
||||||
sqlite3ota ota $target $ota
|
sqlite3rbu rbu $target $rbu
|
||||||
while { [ota step]=="SQLITE_OK" } {}
|
while { [rbu step]=="SQLITE_OK" } {}
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
|
|
||||||
forcedelete test.db-oal ota.db
|
forcedelete test.db-oal rbu.db
|
||||||
db close
|
db close
|
||||||
sqlite3_shutdown
|
sqlite3_shutdown
|
||||||
sqlite3_config_uri 1
|
sqlite3_config_uri 1
|
||||||
reset_db
|
reset_db
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Test that for an OTA to be applied, no corruption results if the
|
# Test that for an RBU to be applied, no corruption results if the
|
||||||
# affinities on the source and target table do not match.
|
# affinities on the source and target table do not match.
|
||||||
#
|
#
|
||||||
do_execsql_test 1.0 {
|
do_execsql_test 1.0 {
|
||||||
@ -41,14 +41,14 @@ do_execsql_test 1.0 {
|
|||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval {
|
db2 eval {
|
||||||
CREATE TABLE data_x1(a, b, c, ota_control);
|
CREATE TABLE data_x1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_x1 VALUES(1, '123', '123', 0);
|
INSERT INTO data_x1 VALUES(1, '123', '123', 0);
|
||||||
INSERT INTO data_x1 VALUES(2, 123, 123, 0);
|
INSERT INTO data_x1 VALUES(2, 123, 123, 0);
|
||||||
}
|
}
|
||||||
db2 close
|
db2 close
|
||||||
run_ota test.db ota.db
|
run_rbu test.db rbu.db
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test 1.2 {
|
do_execsql_test 1.2 {
|
||||||
@ -59,7 +59,7 @@ do_execsql_test 1.2 {
|
|||||||
# Test that NULL values may not be inserted into INTEGER PRIMARY KEY
|
# Test that NULL values may not be inserted into INTEGER PRIMARY KEY
|
||||||
# columns.
|
# columns.
|
||||||
#
|
#
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
reset_db
|
reset_db
|
||||||
|
|
||||||
do_execsql_test 2.0 {
|
do_execsql_test 2.0 {
|
||||||
@ -67,23 +67,23 @@ do_execsql_test 2.0 {
|
|||||||
CREATE INDEX i1 ON x1(b, c);
|
CREATE INDEX i1 ON x1(b, c);
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
foreach {tn otadb} {
|
foreach {tn rbudb} {
|
||||||
1 {
|
1 {
|
||||||
CREATE TABLE data_x1(a, b, c, ota_control);
|
CREATE TABLE data_x1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_x1 VALUES(NULL, 'a', 'b', 0);
|
INSERT INTO data_x1 VALUES(NULL, 'a', 'b', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
2 {
|
2 {
|
||||||
CREATE TABLE data_x1(c, b, a, ota_control);
|
CREATE TABLE data_x1(c, b, a, rbu_control);
|
||||||
INSERT INTO data_x1 VALUES('b', 'a', NULL, 0);
|
INSERT INTO data_x1 VALUES('b', 'a', NULL, 0);
|
||||||
}
|
}
|
||||||
} {
|
} {
|
||||||
do_test 2.$tn.1 {
|
do_test 2.$tn.1 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval $otadb
|
db2 eval $rbudb
|
||||||
db2 close
|
db2 close
|
||||||
list [catch { run_ota test.db ota.db } msg] $msg
|
list [catch { run_rbu test.db rbu.db } msg] $msg
|
||||||
} {1 {SQLITE_MISMATCH - datatype mismatch}}
|
} {1 {SQLITE_MISMATCH - datatype mismatch}}
|
||||||
|
|
||||||
do_execsql_test 2.1.2 {
|
do_execsql_test 2.1.2 {
|
||||||
@ -94,7 +94,7 @@ foreach {tn otadb} {
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Test that missing columns are detected.
|
# Test that missing columns are detected.
|
||||||
#
|
#
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
reset_db
|
reset_db
|
||||||
|
|
||||||
do_execsql_test 2.0 {
|
do_execsql_test 2.0 {
|
||||||
@ -103,13 +103,13 @@ do_execsql_test 2.0 {
|
|||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 2.1 {
|
do_test 2.1 {
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval {
|
db2 eval {
|
||||||
CREATE TABLE data_x1(a, b, ota_control);
|
CREATE TABLE data_x1(a, b, rbu_control);
|
||||||
INSERT INTO data_x1 VALUES(1, 'a', 0);
|
INSERT INTO data_x1 VALUES(1, 'a', 0);
|
||||||
}
|
}
|
||||||
db2 close
|
db2 close
|
||||||
list [catch { run_ota test.db ota.db } msg] $msg
|
list [catch { run_rbu test.db rbu.db } msg] $msg
|
||||||
} {1 {SQLITE_ERROR - column missing from data_x1: c}}
|
} {1 {SQLITE_ERROR - column missing from data_x1: c}}
|
||||||
|
|
||||||
do_execsql_test 2.2 {
|
do_execsql_test 2.2 {
|
||||||
@ -124,14 +124,14 @@ do_execsql_test 2.3 {
|
|||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 2.4 {
|
do_test 2.4 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval {
|
db2 eval {
|
||||||
CREATE TABLE data_x2(a, b, c, d, ota_control);
|
CREATE TABLE data_x2(a, b, c, d, rbu_control);
|
||||||
INSERT INTO data_x2 VALUES(1, 'a', 2, 3, 0);
|
INSERT INTO data_x2 VALUES(1, 'a', 2, 3, 0);
|
||||||
}
|
}
|
||||||
db2 close
|
db2 close
|
||||||
list [catch { run_ota test.db ota.db } msg] $msg
|
list [catch { run_rbu test.db rbu.db } msg] $msg
|
||||||
} {1 SQLITE_ERROR}
|
} {1 SQLITE_ERROR}
|
||||||
|
|
||||||
do_execsql_test 2.5 {
|
do_execsql_test 2.5 {
|
||||||
@ -140,48 +140,48 @@ do_execsql_test 2.5 {
|
|||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Test that sqlite3ota_create_vfs() returns an error if the requested
|
# Test that sqlite3rbu_create_vfs() returns an error if the requested
|
||||||
# parent VFS is unknown.
|
# parent VFS is unknown.
|
||||||
#
|
#
|
||||||
# And that nothing disasterous happens if a VFS name passed to
|
# And that nothing disasterous happens if a VFS name passed to
|
||||||
# sqlite3ota_destroy_vfs() is unknown or not an OTA vfs.
|
# sqlite3rbu_destroy_vfs() is unknown or not an RBU vfs.
|
||||||
#
|
#
|
||||||
do_test 3.1 {
|
do_test 3.1 {
|
||||||
list [catch {sqlite3ota_create_vfs xyz nosuchparent} msg] $msg
|
list [catch {sqlite3rbu_create_vfs xyz nosuchparent} msg] $msg
|
||||||
} {1 SQLITE_NOTFOUND}
|
} {1 SQLITE_NOTFOUND}
|
||||||
|
|
||||||
do_test 3.2 {
|
do_test 3.2 {
|
||||||
sqlite3ota_destroy_vfs nosuchvfs
|
sqlite3rbu_destroy_vfs nosuchvfs
|
||||||
sqlite3ota_destroy_vfs unix
|
sqlite3rbu_destroy_vfs unix
|
||||||
sqlite3ota_destroy_vfs win32
|
sqlite3rbu_destroy_vfs win32
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Test that it is an error to specify an explicit VFS that does not
|
# Test that it is an error to specify an explicit VFS that does not
|
||||||
# include ota VFS functionality.
|
# include rbu VFS functionality.
|
||||||
#
|
#
|
||||||
do_test 4.1 {
|
do_test 4.1 {
|
||||||
testvfs tvfs
|
testvfs tvfs
|
||||||
sqlite3ota ota file:test.db?vfs=tvfs ota.db
|
sqlite3rbu rbu file:test.db?vfs=tvfs rbu.db
|
||||||
list [catch { ota step } msg] $msg
|
list [catch { rbu step } msg] $msg
|
||||||
} {0 SQLITE_ERROR}
|
} {0 SQLITE_ERROR}
|
||||||
do_test 4.2 {
|
do_test 4.2 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 {SQLITE_ERROR - ota vfs not found}}
|
} {1 {SQLITE_ERROR - rbu vfs not found}}
|
||||||
tvfs delete
|
tvfs delete
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Test a large ota update to ensure that wal_autocheckpoint does not get
|
# Test a large rbu update to ensure that wal_autocheckpoint does not get
|
||||||
# in the way.
|
# in the way.
|
||||||
#
|
#
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
reset_db
|
reset_db
|
||||||
do_execsql_test 5.1 {
|
do_execsql_test 5.1 {
|
||||||
CREATE TABLE x1(a, b, c, PRIMARY KEY(a)) WITHOUT ROWID;
|
CREATE TABLE x1(a, b, c, PRIMARY KEY(a)) WITHOUT ROWID;
|
||||||
CREATE INDEX i1 ON x1(a);
|
CREATE INDEX i1 ON x1(a);
|
||||||
|
|
||||||
ATTACH 'ota.db' AS ota;
|
ATTACH 'rbu.db' AS rbu;
|
||||||
CREATE TABLE ota.data_x1(a, b, c, ota_control);
|
CREATE TABLE rbu.data_x1(a, b, c, rbu_control);
|
||||||
WITH s(a, b, c) AS (
|
WITH s(a, b, c) AS (
|
||||||
SELECT randomblob(300), randomblob(300), 1
|
SELECT randomblob(300), randomblob(300), 1
|
||||||
UNION ALL
|
UNION ALL
|
||||||
@ -191,16 +191,16 @@ do_execsql_test 5.1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_test 5.2 {
|
do_test 5.2 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while {[ota step]=="SQLITE_OK" && [file exists test.db-wal]==0} {}
|
while {[rbu step]=="SQLITE_OK" && [file exists test.db-wal]==0} {}
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_OK}
|
} {SQLITE_OK}
|
||||||
|
|
||||||
do_test 5.3 {
|
do_test 5.3 {
|
||||||
expr {[file size test.db-wal] > (1024 * 1200)}
|
expr {[file size test.db-wal] > (1024 * 1200)}
|
||||||
} 1
|
} 1
|
||||||
|
|
||||||
do_test 6.1 { sqlite3ota_internal_test } {}
|
do_test 6.1 { sqlite3rbu_internal_test } {}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
@ -9,33 +9,33 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# Test some properties of the pager_ota_mode and ota_mode pragmas.
|
# Test some properties of the pager_rbu_mode and rbu_mode pragmas.
|
||||||
#
|
#
|
||||||
|
|
||||||
if {![info exists testdir]} {
|
if {![info exists testdir]} {
|
||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota5
|
set ::testprefix rbu5
|
||||||
|
|
||||||
|
|
||||||
# Run the OTA in file $ota on target database $target until completion.
|
# Run the RBU in file $rbu on target database $target until completion.
|
||||||
#
|
#
|
||||||
proc run_ota {target ota} {
|
proc run_rbu {target rbu} {
|
||||||
sqlite3ota ota $target $ota
|
sqlite3rbu rbu $target $rbu
|
||||||
while { [ota step]=="SQLITE_OK" } {}
|
while { [rbu step]=="SQLITE_OK" } {}
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Run the OTA in file $ota on target database $target one step at a
|
# Run the RBU in file $rbu on target database $target one step at a
|
||||||
# time until completion.
|
# time until completion.
|
||||||
#
|
#
|
||||||
proc step_ota {target ota} {
|
proc step_rbu {target rbu} {
|
||||||
while 1 {
|
while 1 {
|
||||||
sqlite3ota ota $target $ota
|
sqlite3rbu rbu $target $rbu
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
ota close
|
rbu close
|
||||||
if {$rc != "SQLITE_OK"} break
|
if {$rc != "SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
set rc
|
set rc
|
||||||
@ -99,31 +99,31 @@ proc ucontrol {args} {
|
|||||||
|
|
||||||
# Argument $target is the name of an SQLite database file. $sql is an SQL
|
# Argument $target is the name of an SQLite database file. $sql is an SQL
|
||||||
# script containing INSERT, UPDATE and DELETE statements to execute against
|
# script containing INSERT, UPDATE and DELETE statements to execute against
|
||||||
# it. This command creates an OTA update database in file $ota that has
|
# it. This command creates an RBU update database in file $rbu that has
|
||||||
# the same effect as the script. The target database is not modified by
|
# the same effect as the script. The target database is not modified by
|
||||||
# this command.
|
# this command.
|
||||||
#
|
#
|
||||||
proc generate_ota_db {target ota sql} {
|
proc generate_rbu_db {target rbu sql} {
|
||||||
|
|
||||||
forcedelete $ota
|
forcedelete $rbu
|
||||||
forcecopy $target copy.db
|
forcecopy $target copy.db
|
||||||
|
|
||||||
# Evaluate the SQL script to modify the contents of copy.db.
|
# Evaluate the SQL script to modify the contents of copy.db.
|
||||||
#
|
#
|
||||||
sqlite3 dbOta copy.db
|
sqlite3 dbRbu copy.db
|
||||||
dbOta eval $sql
|
dbRbu eval $sql
|
||||||
|
|
||||||
dbOta function ucontrol ucontrol
|
dbRbu function ucontrol ucontrol
|
||||||
|
|
||||||
# Evaluate the SQL script to modify the contents of copy.db.
|
# Evaluate the SQL script to modify the contents of copy.db.
|
||||||
set ret [datacksum dbOta]
|
set ret [datacksum dbRbu]
|
||||||
|
|
||||||
dbOta eval { ATTACH $ota AS ota }
|
dbRbu eval { ATTACH $rbu AS rbu }
|
||||||
dbOta eval { ATTACH $target AS orig }
|
dbRbu eval { ATTACH $target AS orig }
|
||||||
|
|
||||||
dbOta eval { SELECT name AS tbl FROM sqlite_master WHERE type = 'table' } {
|
dbRbu eval { SELECT name AS tbl FROM sqlite_master WHERE type = 'table' } {
|
||||||
set pk [pkcols dbOta $tbl]
|
set pk [pkcols dbRbu $tbl]
|
||||||
set cols [allcols dbOta $tbl]
|
set cols [allcols dbRbu $tbl]
|
||||||
|
|
||||||
# A WHERE clause to test that the PK columns match.
|
# A WHERE clause to test that the PK columns match.
|
||||||
#
|
#
|
||||||
@ -138,25 +138,25 @@ proc generate_ota_db {target ota sql} {
|
|||||||
set ucontrol "ucontrol([join $where2 ,])"
|
set ucontrol "ucontrol([join $where2 ,])"
|
||||||
set where2 [join $where2 " AND "]
|
set where2 [join $where2 " AND "]
|
||||||
|
|
||||||
# Create a data_xxx table in the OTA update database.
|
# Create a data_xxx table in the RBU update database.
|
||||||
dbOta eval "
|
dbRbu eval "
|
||||||
CREATE TABLE ota.data_$tbl AS SELECT *, '' AS ota_control
|
CREATE TABLE rbu.data_$tbl AS SELECT *, '' AS rbu_control
|
||||||
FROM main.$tbl LIMIT 0
|
FROM main.$tbl LIMIT 0
|
||||||
"
|
"
|
||||||
|
|
||||||
# Find all new rows INSERTed by the script.
|
# Find all new rows INSERTed by the script.
|
||||||
dbOta eval "
|
dbRbu eval "
|
||||||
INSERT INTO ota.data_$tbl
|
INSERT INTO rbu.data_$tbl
|
||||||
SELECT *, 0 AS ota_control FROM main.$tbl
|
SELECT *, 0 AS rbu_control FROM main.$tbl
|
||||||
WHERE NOT EXISTS (
|
WHERE NOT EXISTS (
|
||||||
SELECT 1 FROM orig.$tbl WHERE $where
|
SELECT 1 FROM orig.$tbl WHERE $where
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
|
|
||||||
# Find all old rows DELETEd by the script.
|
# Find all old rows DELETEd by the script.
|
||||||
dbOta eval "
|
dbRbu eval "
|
||||||
INSERT INTO ota.data_$tbl
|
INSERT INTO rbu.data_$tbl
|
||||||
SELECT *, 1 AS ota_control FROM orig.$tbl
|
SELECT *, 1 AS rbu_control FROM orig.$tbl
|
||||||
WHERE NOT EXISTS (
|
WHERE NOT EXISTS (
|
||||||
SELECT 1 FROM main.$tbl WHERE $where
|
SELECT 1 FROM main.$tbl WHERE $where
|
||||||
)
|
)
|
||||||
@ -166,16 +166,16 @@ proc generate_ota_db {target ota sql} {
|
|||||||
set origcols [list]
|
set origcols [list]
|
||||||
foreach c $cols { lappend origcols "main.$tbl.$c" }
|
foreach c $cols { lappend origcols "main.$tbl.$c" }
|
||||||
set origcols [join $origcols ,]
|
set origcols [join $origcols ,]
|
||||||
dbOta eval "
|
dbRbu eval "
|
||||||
INSERT INTO ota.data_$tbl
|
INSERT INTO rbu.data_$tbl
|
||||||
SELECT $origcols, $ucontrol AS ota_control
|
SELECT $origcols, $ucontrol AS rbu_control
|
||||||
FROM orig.$tbl, main.$tbl
|
FROM orig.$tbl, main.$tbl
|
||||||
WHERE $where AND NOT ($where2)
|
WHERE $where AND NOT ($where2)
|
||||||
"
|
"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dbOta close
|
dbRbu close
|
||||||
forcedelete copy.db
|
forcedelete copy.db
|
||||||
|
|
||||||
return $ret
|
return $ret
|
||||||
@ -197,7 +197,7 @@ do_execsql_test 1.0 {
|
|||||||
}
|
}
|
||||||
db close
|
db close
|
||||||
|
|
||||||
set cksum [generate_ota_db test.db ota.db {
|
set cksum [generate_rbu_db test.db rbu.db {
|
||||||
INSERT INTO t1 VALUES(4, 8, 12);
|
INSERT INTO t1 VALUES(4, 8, 12);
|
||||||
DELETE FROM t1 WHERE a = 2;
|
DELETE FROM t1 WHERE a = 2;
|
||||||
UPDATE t1 SET c = 15 WHERE a=3;
|
UPDATE t1 SET c = 15 WHERE a=3;
|
||||||
@ -217,13 +217,13 @@ foreach {tn idx} {
|
|||||||
} {
|
} {
|
||||||
foreach cmd {run step} {
|
foreach cmd {run step} {
|
||||||
forcecopy test.db test.db2
|
forcecopy test.db test.db2
|
||||||
forcecopy ota.db ota.db2
|
forcecopy rbu.db rbu.db2
|
||||||
|
|
||||||
sqlite3 db test.db2
|
sqlite3 db test.db2
|
||||||
db eval $idx
|
db eval $idx
|
||||||
|
|
||||||
do_test 1.$tn.$cmd.1 {
|
do_test 1.$tn.$cmd.1 {
|
||||||
${cmd}_ota test.db2 ota.db2
|
${cmd}_rbu test.db2 rbu.db2
|
||||||
datacksum db
|
datacksum db
|
||||||
} $cksum
|
} $cksum
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ do_execsql_test 2.0 {
|
|||||||
}
|
}
|
||||||
db close
|
db close
|
||||||
|
|
||||||
set cksum [generate_ota_db test.db ota.db {
|
set cksum [generate_rbu_db test.db rbu.db {
|
||||||
INSERT INTO t2 VALUES(222916.23,'idh',X'472C517405',X'E3',X'7C4F31824669');
|
INSERT INTO t2 VALUES(222916.23,'idh',X'472C517405',X'E3',X'7C4F31824669');
|
||||||
INSERT INTO t2 VALUES('xcndjwafcoxwxizoktd',-319567.21,NULL,-720906.43,-577170);
|
INSERT INTO t2 VALUES('xcndjwafcoxwxizoktd',-319567.21,NULL,-720906.43,-577170);
|
||||||
INSERT INTO t2 VALUES(376369.99,-536058,'yoaiurfqupdscwc',X'29EC8A2542EC3953E9',-740485.22);
|
INSERT INTO t2 VALUES(376369.99,-536058,'yoaiurfqupdscwc',X'29EC8A2542EC3953E9',-740485.22);
|
||||||
@ -305,13 +305,13 @@ foreach {tn idx} {
|
|||||||
} {
|
} {
|
||||||
foreach cmd {run step} {
|
foreach cmd {run step} {
|
||||||
forcecopy test.db test.db2
|
forcecopy test.db test.db2
|
||||||
forcecopy ota.db ota.db2
|
forcecopy rbu.db rbu.db2
|
||||||
|
|
||||||
sqlite3 db test.db2
|
sqlite3 db test.db2
|
||||||
db eval $idx
|
db eval $idx
|
||||||
|
|
||||||
do_test 2.$tn.$cmd.1 {
|
do_test 2.$tn.$cmd.1 {
|
||||||
${cmd}_ota test.db2 ota.db2
|
${cmd}_rbu test.db2 rbu.db2
|
||||||
datacksum db
|
datacksum db
|
||||||
} $cksum
|
} $cksum
|
||||||
|
|
@ -9,15 +9,15 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# This file contains tests for the OTA module. Specifically, it tests the
|
# This file contains tests for the RBU module. Specifically, it tests the
|
||||||
# outcome of some other client writing to the database while an OTA update
|
# outcome of some other client writing to the database while an RBU update
|
||||||
# is being applied.
|
# is being applied.
|
||||||
|
|
||||||
if {![info exists testdir]} {
|
if {![info exists testdir]} {
|
||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota6
|
set ::testprefix rbu6
|
||||||
|
|
||||||
proc setup_test {} {
|
proc setup_test {} {
|
||||||
reset_db
|
reset_db
|
||||||
@ -28,17 +28,17 @@ proc setup_test {} {
|
|||||||
}
|
}
|
||||||
db close
|
db close
|
||||||
|
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 ota ota.db
|
sqlite3 rbu rbu.db
|
||||||
ota eval {
|
rbu eval {
|
||||||
CREATE TABLE data_t1(a, b, ota_control);
|
CREATE TABLE data_t1(a, b, rbu_control);
|
||||||
CREATE TABLE data_t2(a, b, ota_control);
|
CREATE TABLE data_t2(a, b, rbu_control);
|
||||||
CREATE TABLE data_t3(a, b, ota_control);
|
CREATE TABLE data_t3(a, b, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, 't1', 0);
|
INSERT INTO data_t1 VALUES(1, 't1', 0);
|
||||||
INSERT INTO data_t2 VALUES(2, 't2', 0);
|
INSERT INTO data_t2 VALUES(2, 't2', 0);
|
||||||
INSERT INTO data_t3 VALUES(3, 't3', 0);
|
INSERT INTO data_t3 VALUES(3, 't3', 0);
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test the outcome of some other client writing the db while the *-oal
|
# Test the outcome of some other client writing the db while the *-oal
|
||||||
@ -48,49 +48,49 @@ proc setup_test {} {
|
|||||||
for {set nStep 1} {$nStep < 8} {incr nStep} {
|
for {set nStep 1} {$nStep < 8} {incr nStep} {
|
||||||
do_test 1.$nStep.1 {
|
do_test 1.$nStep.1 {
|
||||||
setup_test
|
setup_test
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
for {set i 0} {$i<$nStep} {incr i} {ota step}
|
for {set i 0} {$i<$nStep} {incr i} {rbu step}
|
||||||
|
|
||||||
ota close
|
rbu close
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
execsql { INSERT INTO t1 VALUES(5, 'hello') }
|
execsql { INSERT INTO t1 VALUES(5, 'hello') }
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_BUSY}
|
} {SQLITE_BUSY}
|
||||||
do_test 1.$nStep.2 {
|
do_test 1.$nStep.2 {
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_BUSY}
|
} {SQLITE_BUSY}
|
||||||
do_test 1.$nStep.3 {
|
do_test 1.$nStep.3 {
|
||||||
list [file exists test.db-oal] [file exists test.db-wal]
|
list [file exists test.db-oal] [file exists test.db-wal]
|
||||||
} {1 0}
|
} {1 0}
|
||||||
do_test 1.$nStep.4 {
|
do_test 1.$nStep.4 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 {SQLITE_BUSY - database modified during ota update}}
|
} {1 {SQLITE_BUSY - database modified during rbu update}}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test the outcome of some other client writing the db after the *-oal
|
# Test the outcome of some other client writing the db after the *-oal
|
||||||
# file has been copied to the *-wal path. Once this has happened, any
|
# file has been copied to the *-wal path. Once this has happened, any
|
||||||
# other client writing to the db causes OTA to consider its job finished.
|
# other client writing to the db causes RBU to consider its job finished.
|
||||||
#
|
#
|
||||||
for {set nStep 8} {$nStep < 20} {incr nStep} {
|
for {set nStep 8} {$nStep < 20} {incr nStep} {
|
||||||
do_test 1.$nStep.1 {
|
do_test 1.$nStep.1 {
|
||||||
setup_test
|
setup_test
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
for {set i 0} {$i<$nStep} {incr i} {ota step}
|
for {set i 0} {$i<$nStep} {incr i} {rbu step}
|
||||||
ota close
|
rbu close
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
execsql { INSERT INTO t1 VALUES(5, 'hello') }
|
execsql { INSERT INTO t1 VALUES(5, 'hello') }
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
do_test 1.$nStep.2 {
|
do_test 1.$nStep.2 {
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
do_test 1.$nStep.3 {
|
do_test 1.$nStep.3 {
|
||||||
file exists test.db-oal
|
file exists test.db-oal
|
||||||
} {0}
|
} {0}
|
||||||
do_test 1.$nStep.4 {
|
do_test 1.$nStep.4 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {0 SQLITE_DONE}
|
} {0 SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test 1.$nStep.5 {
|
do_execsql_test 1.$nStep.5 {
|
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# This file contains tests for the OTA module.
|
# This file contains tests for the RBU module.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@ -17,12 +17,12 @@ if {![info exists testdir]} {
|
|||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota7
|
set ::testprefix rbu7
|
||||||
|
|
||||||
# Test index:
|
# Test index:
|
||||||
#
|
#
|
||||||
# 1.*: That affinities are correctly applied to values within the
|
# 1.*: That affinities are correctly applied to values within the
|
||||||
# OTA database.
|
# RBU database.
|
||||||
#
|
#
|
||||||
# 2.*: Tests for multi-column primary keys.
|
# 2.*: Tests for multi-column primary keys.
|
||||||
#
|
#
|
||||||
@ -34,19 +34,19 @@ do_test 1.0 {
|
|||||||
INSERT INTO t1 VALUES(2, 'def');
|
INSERT INTO t1 VALUES(2, 'def');
|
||||||
}
|
}
|
||||||
|
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 ota ota.db
|
sqlite3 rbu rbu.db
|
||||||
ota eval {
|
rbu eval {
|
||||||
CREATE TABLE data_t1(a, b, ota_control);
|
CREATE TABLE data_t1(a, b, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES('1', NULL, 1);
|
INSERT INTO data_t1 VALUES('1', NULL, 1);
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while { [ota step]=="SQLITE_OK" } {}
|
while { [rbu step]=="SQLITE_OK" } {}
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
@ -72,24 +72,24 @@ foreach {tn tbl} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_test 2.$tn.2 {
|
do_test 2.$tn.2 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 ota ota.db
|
sqlite3 rbu rbu.db
|
||||||
execsql {
|
execsql {
|
||||||
CREATE TABLE data_t1(a, b, c, ota_control);
|
CREATE TABLE data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(3, 1, 'e', 0);
|
INSERT INTO data_t1 VALUES(3, 1, 'e', 0);
|
||||||
INSERT INTO data_t1 VALUES(3, 2, 'f', 0);
|
INSERT INTO data_t1 VALUES(3, 2, 'f', 0);
|
||||||
INSERT INTO data_t1 VALUES(1, 2, NULL, 1);
|
INSERT INTO data_t1 VALUES(1, 2, NULL, 1);
|
||||||
INSERT INTO data_t1 VALUES(2, 1, 'X', '..x');
|
INSERT INTO data_t1 VALUES(2, 1, 'X', '..x');
|
||||||
} ota
|
} rbu
|
||||||
ota close
|
rbu close
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 2.$tn.3 {
|
do_test 2.$tn.3 {
|
||||||
set rc "SQLITE_OK"
|
set rc "SQLITE_OK"
|
||||||
while {$rc == "SQLITE_OK"} {
|
while {$rc == "SQLITE_OK"} {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
set rc [ota close]
|
set rc [rbu close]
|
||||||
}
|
}
|
||||||
set rc
|
set rc
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
@ -9,14 +9,14 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# Test the ota_delta() feature.
|
# Test the rbu_delta() feature.
|
||||||
#
|
#
|
||||||
|
|
||||||
if {![info exists testdir]} {
|
if {![info exists testdir]} {
|
||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota8
|
set ::testprefix rbu8
|
||||||
|
|
||||||
do_execsql_test 1.0 {
|
do_execsql_test 1.0 {
|
||||||
CREATE TABLE t1(x, y PRIMARY KEY, z);
|
CREATE TABLE t1(x, y PRIMARY KEY, z);
|
||||||
@ -27,10 +27,10 @@ do_execsql_test 1.0 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval {
|
db2 eval {
|
||||||
CREATE TABLE data_t1(x, y, z, ota_control);
|
CREATE TABLE data_t1(x, y, z, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES('a', 1, '_i' , 'x.d');
|
INSERT INTO data_t1 VALUES('a', 1, '_i' , 'x.d');
|
||||||
INSERT INTO data_t1 VALUES('b', 2, 2 , '..x');
|
INSERT INTO data_t1 VALUES('b', 2, 2 , '..x');
|
||||||
INSERT INTO data_t1 VALUES('_iii', 3, '-III' , 'd.d');
|
INSERT INTO data_t1 VALUES('_iii', 3, '-III' , 'd.d');
|
||||||
@ -39,26 +39,26 @@ do_test 1.1 {
|
|||||||
} {}
|
} {}
|
||||||
|
|
||||||
do_test 1.2.1 {
|
do_test 1.2.1 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_ERROR}
|
} {SQLITE_ERROR}
|
||||||
do_test 1.2.2 {
|
do_test 1.2.2 {
|
||||||
list [catch {ota close} msg] $msg
|
list [catch {rbu close} msg] $msg
|
||||||
} {1 {SQLITE_ERROR - no such function: ota_delta}}
|
} {1 {SQLITE_ERROR - no such function: rbu_delta}}
|
||||||
|
|
||||||
proc ota_delta {orig new} {
|
proc rbu_delta {orig new} {
|
||||||
return "${orig}${new}"
|
return "${orig}${new}"
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test 1.3.1 {
|
do_test 1.3.1 {
|
||||||
while 1 {
|
while 1 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota create_ota_delta
|
rbu create_rbu_delta
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
if {$rc != "SQLITE_OK"} break
|
if {$rc != "SQLITE_OK"} break
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test 1.3.2 {
|
do_execsql_test 1.3.2 {
|
@ -9,14 +9,14 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# Test OTA with virtual tables. And tables with no PRIMARY KEY declarations.
|
# Test RBU with virtual tables. And tables with no PRIMARY KEY declarations.
|
||||||
#
|
#
|
||||||
|
|
||||||
if {![info exists testdir]} {
|
if {![info exists testdir]} {
|
||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix ota9
|
set ::testprefix rbu9
|
||||||
|
|
||||||
ifcapable !fts3 {
|
ifcapable !fts3 {
|
||||||
finish_test
|
finish_test
|
||||||
@ -31,10 +31,10 @@ do_execsql_test 1.1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval {
|
db2 eval {
|
||||||
CREATE TABLE data_f1(ota_rowid, a, b, c, ota_control);
|
CREATE TABLE data_f1(rbu_rowid, a, b, c, rbu_control);
|
||||||
INSERT INTO data_f1 VALUES(14, 'x', 'y', 'z', 0); -- INSERT
|
INSERT INTO data_f1 VALUES(14, 'x', 'y', 'z', 0); -- INSERT
|
||||||
INSERT INTO data_f1 VALUES(11, NULL, NULL, NULL, 1); -- DELETE
|
INSERT INTO data_f1 VALUES(11, NULL, NULL, NULL, 1); -- DELETE
|
||||||
INSERT INTO data_f1 VALUES(13, NULL, NULL, 'X', '..x'); -- UPDATE
|
INSERT INTO data_f1 VALUES(13, NULL, NULL, 'X', '..x'); -- UPDATE
|
||||||
@ -44,12 +44,12 @@ do_test 1.1 {
|
|||||||
|
|
||||||
do_test 1.2.1 {
|
do_test 1.2.1 {
|
||||||
while 1 {
|
while 1 {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
set rc [ota step]
|
set rc [rbu step]
|
||||||
if {$rc != "SQLITE_OK"} break
|
if {$rc != "SQLITE_OK"} break
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
|
|
||||||
do_execsql_test 1.2.2 { SELECT rowid, * FROM f1 } {
|
do_execsql_test 1.2.2 { SELECT rowid, * FROM f1 } {
|
||||||
@ -64,12 +64,12 @@ integrity_check 1.2.4
|
|||||||
# Tables with no PK declaration.
|
# Tables with no PK declaration.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Run the OTA in file $ota on target database $target until completion.
|
# Run the RBU in file $rbu on target database $target until completion.
|
||||||
#
|
#
|
||||||
proc run_ota {target ota} {
|
proc run_rbu {target rbu} {
|
||||||
sqlite3ota ota $target $ota
|
sqlite3rbu rbu $target $rbu
|
||||||
while { [ota step]=="SQLITE_OK" } {}
|
while { [rbu step]=="SQLITE_OK" } {}
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach {tn idx} {
|
foreach {tn idx} {
|
||||||
@ -96,10 +96,10 @@ foreach {tn idx} {
|
|||||||
db eval $idx
|
db eval $idx
|
||||||
|
|
||||||
do_test 2.$tn.2 {
|
do_test 2.$tn.2 {
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
sqlite3 db2 ota.db
|
sqlite3 db2 rbu.db
|
||||||
db2 eval {
|
db2 eval {
|
||||||
CREATE TABLE data_t1(ota_rowid, a, b, c, ota_control);
|
CREATE TABLE data_t1(rbu_rowid, a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(3, 'x', 'y', 'z', 0);
|
INSERT INTO data_t1 VALUES(3, 'x', 'y', 'z', 0);
|
||||||
INSERT INTO data_t1 VALUES(NULL, 'X', 'Y', 'Z', 0);
|
INSERT INTO data_t1 VALUES(NULL, 'X', 'Y', 'Z', 0);
|
||||||
INSERT INTO data_t1 VALUES('1', NULL, NULL, NULL, 1);
|
INSERT INTO data_t1 VALUES('1', NULL, NULL, NULL, 1);
|
||||||
@ -108,7 +108,7 @@ foreach {tn idx} {
|
|||||||
db2 close
|
db2 close
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
run_ota test.db ota.db
|
run_rbu test.db rbu.db
|
||||||
|
|
||||||
do_execsql_test 2.$tn.3 {
|
do_execsql_test 2.$tn.3 {
|
||||||
SELECT rowid, a, b, c FROM t1 ORDER BY rowid;
|
SELECT rowid, a, b, c FROM t1 ORDER BY rowid;
|
@ -9,22 +9,22 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# This file contains tests for the OTA module. More specifically, it
|
# This file contains tests for the RBU module. More specifically, it
|
||||||
# contains tests to ensure that it is an error to attempt to update
|
# contains tests to ensure that it is an error to attempt to update
|
||||||
# a wal mode database via OTA.
|
# a wal mode database via RBU.
|
||||||
#
|
#
|
||||||
|
|
||||||
if {![info exists testdir]} {
|
if {![info exists testdir]} {
|
||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix otaA
|
set ::testprefix rbuA
|
||||||
|
|
||||||
set db_sql {
|
set db_sql {
|
||||||
CREATE TABLE t1(a PRIMARY KEY, b, c);
|
CREATE TABLE t1(a PRIMARY KEY, b, c);
|
||||||
}
|
}
|
||||||
set ota_sql {
|
set rbu_sql {
|
||||||
CREATE TABLE data_t1(a, b, c, ota_control);
|
CREATE TABLE data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
||||||
INSERT INTO data_t1 VALUES(4, 5, 6, 0);
|
INSERT INTO data_t1 VALUES(4, 5, 6, 0);
|
||||||
INSERT INTO data_t1 VALUES(7, 8, 9, 0);
|
INSERT INTO data_t1 VALUES(7, 8, 9, 0);
|
||||||
@ -32,38 +32,38 @@ set ota_sql {
|
|||||||
|
|
||||||
do_test 1.0 {
|
do_test 1.0 {
|
||||||
db close
|
db close
|
||||||
forcedelete test.db ota.db
|
forcedelete test.db rbu.db
|
||||||
|
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
db eval $db_sql
|
db eval $db_sql
|
||||||
db eval { PRAGMA journal_mode = wal }
|
db eval { PRAGMA journal_mode = wal }
|
||||||
db close
|
db close
|
||||||
|
|
||||||
sqlite3 db ota.db
|
sqlite3 db rbu.db
|
||||||
db eval $ota_sql
|
db eval $rbu_sql
|
||||||
db close
|
db close
|
||||||
|
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_ERROR}
|
} {SQLITE_ERROR}
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 {SQLITE_ERROR - cannot update wal mode database}}
|
} {1 {SQLITE_ERROR - cannot update wal mode database}}
|
||||||
|
|
||||||
do_test 2.0 {
|
do_test 2.0 {
|
||||||
forcedelete test.db ota.db
|
forcedelete test.db rbu.db
|
||||||
|
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
db eval $db_sql
|
db eval $db_sql
|
||||||
db close
|
db close
|
||||||
|
|
||||||
sqlite3 db ota.db
|
sqlite3 db rbu.db
|
||||||
db eval $ota_sql
|
db eval $rbu_sql
|
||||||
db close
|
db close
|
||||||
|
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_OK}
|
} {SQLITE_OK}
|
||||||
|
|
||||||
do_test 2.1 {
|
do_test 2.1 {
|
||||||
@ -71,12 +71,12 @@ do_test 2.1 {
|
|||||||
db eval {PRAGMA journal_mode = wal}
|
db eval {PRAGMA journal_mode = wal}
|
||||||
db close
|
db close
|
||||||
breakpoint
|
breakpoint
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
} {SQLITE_ERROR}
|
} {SQLITE_ERROR}
|
||||||
|
|
||||||
do_test 2.2 {
|
do_test 2.2 {
|
||||||
list [catch { ota close } msg] $msg
|
list [catch { rbu close } msg] $msg
|
||||||
} {1 {SQLITE_ERROR - cannot update wal mode database}}
|
} {1 {SQLITE_ERROR - cannot update wal mode database}}
|
||||||
|
|
||||||
|
|
@ -14,16 +14,16 @@ if {![info exists testdir]} {
|
|||||||
set testdir [file join [file dirname [info script]] .. .. test]
|
set testdir [file join [file dirname [info script]] .. .. test]
|
||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
set ::testprefix otacrash
|
set ::testprefix rbucrash
|
||||||
|
|
||||||
db close
|
db close
|
||||||
forcedelete test.db-oal ota.db
|
forcedelete test.db-oal rbu.db
|
||||||
sqlite3_shutdown
|
sqlite3_shutdown
|
||||||
sqlite3_config_uri 1
|
sqlite3_config_uri 1
|
||||||
reset_db
|
reset_db
|
||||||
|
|
||||||
# Set up a target database and an ota update database. The target
|
# Set up a target database and an rbu update database. The target
|
||||||
# db is the usual "test.db", the ota db is "test.db2".
|
# db is the usual "test.db", the rbu db is "test.db2".
|
||||||
#
|
#
|
||||||
forcedelete test.db2
|
forcedelete test.db2
|
||||||
do_execsql_test 1.0 {
|
do_execsql_test 1.0 {
|
||||||
@ -32,8 +32,8 @@ do_execsql_test 1.0 {
|
|||||||
INSERT INTO t1 VALUES(4, 5, 6);
|
INSERT INTO t1 VALUES(4, 5, 6);
|
||||||
INSERT INTO t1 VALUES(7, 8, 9);
|
INSERT INTO t1 VALUES(7, 8, 9);
|
||||||
|
|
||||||
ATTACH 'test.db2' AS ota;
|
ATTACH 'test.db2' AS rbu;
|
||||||
CREATE TABLE ota.data_t1(a, b, c, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(10, 11, 12, 0);
|
INSERT INTO data_t1 VALUES(10, 11, 12, 0);
|
||||||
INSERT INTO data_t1 VALUES(13, 14, 15, 0);
|
INSERT INTO data_t1 VALUES(13, 14, 15, 0);
|
||||||
INSERT INTO data_t1 VALUES(4, NULL, NULL, 1);
|
INSERT INTO data_t1 VALUES(4, NULL, NULL, 1);
|
||||||
@ -42,63 +42,63 @@ do_execsql_test 1.0 {
|
|||||||
db_save_and_close
|
db_save_and_close
|
||||||
|
|
||||||
|
|
||||||
# Determine the number of steps in applying the ota update to the test
|
# Determine the number of steps in applying the rbu update to the test
|
||||||
# target database created above. Set $::ota_num_steps accordingly
|
# target database created above. Set $::rbu_num_steps accordingly
|
||||||
#
|
#
|
||||||
# Check that the same number of steps are required to apply the ota
|
# Check that the same number of steps are required to apply the rbu
|
||||||
# update using many calls to sqlite3ota_step() on a single ota handle
|
# update using many calls to sqlite3rbu_step() on a single rbu handle
|
||||||
# as required to apply it using a series of ota handles, on each of
|
# as required to apply it using a series of rbu handles, on each of
|
||||||
# which sqlite3ota_step() is called once.
|
# which sqlite3rbu_step() is called once.
|
||||||
#
|
#
|
||||||
do_test 1.1 {
|
do_test 1.1 {
|
||||||
db_restore
|
db_restore
|
||||||
sqlite3ota ota test.db test.db2
|
sqlite3rbu rbu test.db test.db2
|
||||||
breakpoint
|
breakpoint
|
||||||
set nStep 0
|
set nStep 0
|
||||||
while {[ota step]=="SQLITE_OK"} { incr nStep }
|
while {[rbu step]=="SQLITE_OK"} { incr nStep }
|
||||||
ota close
|
rbu close
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
set ota_num_steps $nStep
|
set rbu_num_steps $nStep
|
||||||
do_test 1.2 {
|
do_test 1.2 {
|
||||||
db_restore
|
db_restore
|
||||||
set nStep 0
|
set nStep 0
|
||||||
while {1} {
|
while {1} {
|
||||||
sqlite3ota ota test.db test.db2
|
sqlite3rbu rbu test.db test.db2
|
||||||
ota step
|
rbu step
|
||||||
if {[ota close]=="SQLITE_DONE"} break
|
if {[rbu close]=="SQLITE_DONE"} break
|
||||||
incr nStep
|
incr nStep
|
||||||
}
|
}
|
||||||
set nStep
|
set nStep
|
||||||
} $ota_num_steps
|
} $rbu_num_steps
|
||||||
|
|
||||||
|
|
||||||
# Run one or more tests using the target (test.db) and ota (test.db2)
|
# Run one or more tests using the target (test.db) and rbu (test.db2)
|
||||||
# databases created above. As follows:
|
# databases created above. As follows:
|
||||||
#
|
#
|
||||||
# 1. This process starts the ota update and calls sqlite3ota_step()
|
# 1. This process starts the rbu update and calls sqlite3rbu_step()
|
||||||
# $nPre times. Then closes the ota update handle.
|
# $nPre times. Then closes the rbu update handle.
|
||||||
#
|
#
|
||||||
# 2. A second process resumes the ota update and attempts to call
|
# 2. A second process resumes the rbu update and attempts to call
|
||||||
# sqlite3ota_step() $nStep times before closing the handle. A
|
# sqlite3rbu_step() $nStep times before closing the handle. A
|
||||||
# crash is simulated during each xSync() of file test.db2.
|
# crash is simulated during each xSync() of file test.db2.
|
||||||
#
|
#
|
||||||
# 3. This process attempts to resume the ota update from whatever
|
# 3. This process attempts to resume the rbu update from whatever
|
||||||
# state it was left in by step (2). Test that it is successful
|
# state it was left in by step (2). Test that it is successful
|
||||||
# in doing so and that the final target database is as expected.
|
# in doing so and that the final target database is as expected.
|
||||||
#
|
#
|
||||||
# In total (nSync+1) tests are run, where nSync is the number of times
|
# In total (nSync+1) tests are run, where nSync is the number of times
|
||||||
# xSync() is called on test.db2.
|
# xSync() is called on test.db2.
|
||||||
#
|
#
|
||||||
proc do_ota_crash_test {tn nPre nStep} {
|
proc do_rbu_crash_test {tn nPre nStep} {
|
||||||
|
|
||||||
set script [subst -nocommands {
|
set script [subst -nocommands {
|
||||||
sqlite3ota ota test.db file:test.db2?vfs=crash
|
sqlite3rbu rbu test.db file:test.db2?vfs=crash
|
||||||
set i 0
|
set i 0
|
||||||
while {[set i] < $nStep} {
|
while {[set i] < $nStep} {
|
||||||
if {[ota step]!="SQLITE_OK"} break
|
if {[rbu step]!="SQLITE_OK"} break
|
||||||
incr i
|
incr i
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
}]
|
}]
|
||||||
|
|
||||||
set bDone 0
|
set bDone 0
|
||||||
@ -107,12 +107,12 @@ proc do_ota_crash_test {tn nPre nStep} {
|
|||||||
db_restore
|
db_restore
|
||||||
|
|
||||||
if {$nPre>0} {
|
if {$nPre>0} {
|
||||||
sqlite3ota ota test.db file:test.db2
|
sqlite3rbu rbu test.db file:test.db2
|
||||||
set i 0
|
set i 0
|
||||||
for {set i 0} {$i < $nPre} {incr i} {
|
for {set i 0} {$i < $nPre} {incr i} {
|
||||||
if {[ota step]!="SQLITE_OK"} break
|
if {[rbu step]!="SQLITE_OK"} break
|
||||||
}
|
}
|
||||||
ota close
|
rbu close
|
||||||
}
|
}
|
||||||
|
|
||||||
set res [
|
set res [
|
||||||
@ -126,9 +126,9 @@ proc do_ota_crash_test {tn nPre nStep} {
|
|||||||
error "unexected catchsql result: $res"
|
error "unexected catchsql result: $res"
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3ota ota test.db test.db2
|
sqlite3rbu rbu test.db test.db2
|
||||||
while {[ota step]=="SQLITE_OK"} {}
|
while {[rbu step]=="SQLITE_OK"} {}
|
||||||
ota close
|
rbu close
|
||||||
|
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
do_execsql_test $tn.delay=$iDelay {
|
do_execsql_test $tn.delay=$iDelay {
|
||||||
@ -139,9 +139,9 @@ proc do_ota_crash_test {tn nPre nStep} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for {set nPre 0} {$nPre < $ota_num_steps} {incr nPre} {
|
for {set nPre 0} {$nPre < $rbu_num_steps} {incr nPre} {
|
||||||
for {set is 1} {$is <= ($ota_num_steps - $nPre)} {incr is} {
|
for {set is 1} {$is <= ($rbu_num_steps - $nPre)} {incr is} {
|
||||||
do_ota_crash_test 2.pre=$nPre.step=$is $nPre $is
|
do_rbu_crash_test 2.pre=$nPre.step=$is $nPre $is
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ if {![info exists testdir]} {
|
|||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
source $testdir/malloc_common.tcl
|
source $testdir/malloc_common.tcl
|
||||||
set ::testprefix otafault
|
set ::testprefix rbufault
|
||||||
|
|
||||||
proc copy_if_exists {src target} {
|
proc copy_if_exists {src target} {
|
||||||
if {[file exists $src]} {
|
if {[file exists $src]} {
|
||||||
@ -33,7 +33,7 @@ foreach {tn2 setup sql expect} {
|
|||||||
INSERT INTO t1 VALUES(2, 2, 2);
|
INSERT INTO t1 VALUES(2, 2, 2);
|
||||||
INSERT INTO t1 VALUES(3, 3, 3);
|
INSERT INTO t1 VALUES(3, 3, 3);
|
||||||
|
|
||||||
CREATE TABLE ota.data_t1(a, b, c, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(2, NULL, NULL, 1);
|
INSERT INTO data_t1 VALUES(2, NULL, NULL, 1);
|
||||||
INSERT INTO data_t1 VALUES(3, 'three', NULL, '.x.');
|
INSERT INTO data_t1 VALUES(3, 'three', NULL, '.x.');
|
||||||
INSERT INTO data_t1 VALUES(4, 4, 4, 0);
|
INSERT INTO data_t1 VALUES(4, 4, 4, 0);
|
||||||
@ -48,7 +48,7 @@ foreach {tn2 setup sql expect} {
|
|||||||
INSERT INTO t2 VALUES('b', 'b', 'b');
|
INSERT INTO t2 VALUES('b', 'b', 'b');
|
||||||
INSERT INTO t2 VALUES('c', 'c', 'c');
|
INSERT INTO t2 VALUES('c', 'c', 'c');
|
||||||
|
|
||||||
CREATE TABLE ota.data_t2(a, b, c, ota_control);
|
CREATE TABLE rbu.data_t2(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t2 VALUES('b', NULL, NULL, 1);
|
INSERT INTO data_t2 VALUES('b', NULL, NULL, 1);
|
||||||
INSERT INTO data_t2 VALUES('c', 'see', NULL, '.x.');
|
INSERT INTO data_t2 VALUES('c', 'see', NULL, '.x.');
|
||||||
INSERT INTO data_t2 VALUES('d', 'd', 'd', 0);
|
INSERT INTO data_t2 VALUES('d', 'd', 'd', 0);
|
||||||
@ -62,8 +62,8 @@ foreach {tn2 setup sql expect} {
|
|||||||
CREATE INDEX t1cb ON t1(c, b);
|
CREATE INDEX t1cb ON t1(c, b);
|
||||||
CREATE INDEX t2cb ON t2(c, b);
|
CREATE INDEX t2cb ON t2(c, b);
|
||||||
|
|
||||||
CREATE TABLE ota.data_t1(a, b, c, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, c, rbu_control);
|
||||||
CREATE TABLE ota.data_t2(a, b, c, ota_control);
|
CREATE TABLE rbu.data_t2(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
INSERT INTO data_t1 VALUES(1, 2, 3, 0);
|
||||||
INSERT INTO data_t2 VALUES(4, 5, 6, 0);
|
INSERT INTO data_t2 VALUES(4, 5, 6, 0);
|
||||||
} {
|
} {
|
||||||
@ -76,7 +76,7 @@ foreach {tn2 setup sql expect} {
|
|||||||
INSERT INTO t1 VALUES('A', 'B', 'C');
|
INSERT INTO t1 VALUES('A', 'B', 'C');
|
||||||
INSERT INTO t1 VALUES('D', 'E', 'F');
|
INSERT INTO t1 VALUES('D', 'E', 'F');
|
||||||
|
|
||||||
CREATE TABLE ota.data_t1(a, b, c, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, c, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES('D', NULL, NULL, 1);
|
INSERT INTO data_t1 VALUES('D', NULL, NULL, 1);
|
||||||
INSERT INTO data_t1 VALUES('A', 'Z', NULL, '.x.');
|
INSERT INTO data_t1 VALUES('A', 'Z', NULL, '.x.');
|
||||||
INSERT INTO data_t1 VALUES('G', 'H', 'I', 0);
|
INSERT INTO data_t1 VALUES('G', 'H', 'I', 0);
|
||||||
@ -88,7 +88,7 @@ foreach {tn2 setup sql expect} {
|
|||||||
CREATE TABLE t1(a, b, c);
|
CREATE TABLE t1(a, b, c);
|
||||||
CREATE INDEX t1c ON t1(c, b);
|
CREATE INDEX t1c ON t1(c, b);
|
||||||
|
|
||||||
CREATE TABLE ota.data_t1(a, b, c, ota_rowid, ota_control);
|
CREATE TABLE rbu.data_t1(a, b, c, rbu_rowid, rbu_control);
|
||||||
INSERT INTO data_t1 VALUES('a', 'b', 'c', 1, 0);
|
INSERT INTO data_t1 VALUES('a', 'b', 'c', 1, 0);
|
||||||
INSERT INTO data_t1 VALUES('d', 'e', 'f', '2', 0);
|
INSERT INTO data_t1 VALUES('d', 'e', 'f', '2', 0);
|
||||||
} {
|
} {
|
||||||
@ -97,17 +97,17 @@ foreach {tn2 setup sql expect} {
|
|||||||
|
|
||||||
} {
|
} {
|
||||||
catch {db close}
|
catch {db close}
|
||||||
forcedelete ota.db test.db
|
forcedelete rbu.db test.db
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
execsql {
|
execsql {
|
||||||
PRAGMA encoding = utf16;
|
PRAGMA encoding = utf16;
|
||||||
ATTACH 'ota.db' AS ota;
|
ATTACH 'rbu.db' AS rbu;
|
||||||
}
|
}
|
||||||
execsql $setup
|
execsql $setup
|
||||||
db close
|
db close
|
||||||
|
|
||||||
forcecopy test.db test.db.bak
|
forcecopy test.db test.db.bak
|
||||||
forcecopy ota.db ota.db.bak
|
forcecopy rbu.db rbu.db.bak
|
||||||
|
|
||||||
foreach {tn f reslist} {
|
foreach {tn f reslist} {
|
||||||
1 oom-tra* {
|
1 oom-tra* {
|
||||||
@ -126,8 +126,8 @@ foreach {tn2 setup sql expect} {
|
|||||||
{1 SQLITE_IOERR_READ}
|
{1 SQLITE_IOERR_READ}
|
||||||
{1 SQLITE_IOERR_FSYNC}
|
{1 SQLITE_IOERR_FSYNC}
|
||||||
{1 {SQLITE_ERROR - SQL logic error or missing database}}
|
{1 {SQLITE_ERROR - SQL logic error or missing database}}
|
||||||
{1 {SQLITE_ERROR - unable to open database: ota.db}}
|
{1 {SQLITE_ERROR - unable to open database: rbu.db}}
|
||||||
{1 {SQLITE_IOERR - unable to open database: ota.db}}
|
{1 {SQLITE_IOERR - unable to open database: rbu.db}}
|
||||||
}
|
}
|
||||||
|
|
||||||
3 shmerr-* {
|
3 shmerr-* {
|
||||||
@ -145,13 +145,13 @@ foreach {tn2 setup sql expect} {
|
|||||||
|
|
||||||
do_faultsim_test 2.$tn2 -faults $::f -prep {
|
do_faultsim_test 2.$tn2 -faults $::f -prep {
|
||||||
catch { db close }
|
catch { db close }
|
||||||
forcedelete test.db-journal test.db-wal ota.db-journal ota.db-wal
|
forcedelete test.db-journal test.db-wal rbu.db-journal rbu.db-wal
|
||||||
forcecopy test.db.bak test.db
|
forcecopy test.db.bak test.db
|
||||||
forcecopy ota.db.bak ota.db
|
forcecopy rbu.db.bak rbu.db
|
||||||
} -body {
|
} -body {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while {[ota step]=="SQLITE_OK"} {}
|
while {[rbu step]=="SQLITE_OK"} {}
|
||||||
ota close
|
rbu close
|
||||||
} -test {
|
} -test {
|
||||||
faultsim_test_result {*}$::reslist
|
faultsim_test_result {*}$::reslist
|
||||||
if {$testrc==0} {
|
if {$testrc==0} {
|
||||||
@ -176,46 +176,46 @@ foreach {tn2 setup sql expect} {
|
|||||||
|
|
||||||
for {set iStep 0} {$iStep<=21} {incr iStep} {
|
for {set iStep 0} {$iStep<=21} {incr iStep} {
|
||||||
|
|
||||||
forcedelete test.db-journal test.db-wal ota.db-journal ota.db-wal
|
forcedelete test.db-journal test.db-wal rbu.db-journal rbu.db-wal
|
||||||
|
|
||||||
copy_if_exists test.db.bak test.db
|
copy_if_exists test.db.bak test.db
|
||||||
copy_if_exists ota.db.bak ota.db
|
copy_if_exists rbu.db.bak rbu.db
|
||||||
|
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
for {set x 0} {$x < $::iStep} {incr x} { ota step }
|
for {set x 0} {$x < $::iStep} {incr x} { rbu step }
|
||||||
ota close
|
rbu close
|
||||||
|
|
||||||
# sqlite3 x ota.db ; puts "XYZ [x eval { SELECT * FROM ota_state } ]" ; x close
|
# sqlite3 x rbu.db ; puts "XYZ [x eval { SELECT * FROM rbu_state } ]" ; x close
|
||||||
|
|
||||||
copy_if_exists test.db test.db.bak.2
|
copy_if_exists test.db test.db.bak.2
|
||||||
copy_if_exists test.db-wal test.db.bak.2-wal
|
copy_if_exists test.db-wal test.db.bak.2-wal
|
||||||
copy_if_exists test.db-oal test.db.bak.2-oal
|
copy_if_exists test.db-oal test.db.bak.2-oal
|
||||||
copy_if_exists ota.db ota.db.bak.2
|
copy_if_exists rbu.db rbu.db.bak.2
|
||||||
|
|
||||||
do_faultsim_test 3.$tn.$iStep -faults $::f -prep {
|
do_faultsim_test 3.$tn.$iStep -faults $::f -prep {
|
||||||
catch { db close }
|
catch { db close }
|
||||||
forcedelete test.db-journal test.db-wal ota.db-journal ota.db-wal
|
forcedelete test.db-journal test.db-wal rbu.db-journal rbu.db-wal
|
||||||
copy_if_exists test.db.bak.2 test.db
|
copy_if_exists test.db.bak.2 test.db
|
||||||
copy_if_exists test.db.bak.2-wal test.db-wal
|
copy_if_exists test.db.bak.2-wal test.db-wal
|
||||||
copy_if_exists test.db.bak.2-oal test.db-oal
|
copy_if_exists test.db.bak.2-oal test.db-oal
|
||||||
copy_if_exists ota.db.bak.2 ota.db
|
copy_if_exists rbu.db.bak.2 rbu.db
|
||||||
} -body {
|
} -body {
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
ota step
|
rbu step
|
||||||
ota close
|
rbu close
|
||||||
} -test {
|
} -test {
|
||||||
|
|
||||||
if {$testresult=="SQLITE_OK"} {set testresult "SQLITE_DONE"}
|
if {$testresult=="SQLITE_OK"} {set testresult "SQLITE_DONE"}
|
||||||
faultsim_test_result {*}$::reslist
|
faultsim_test_result {*}$::reslist
|
||||||
|
|
||||||
if {$testrc==0} {
|
if {$testrc==0} {
|
||||||
# No error occurred. If the OTA has not already been fully applied,
|
# No error occurred. If the RBU has not already been fully applied,
|
||||||
# apply the rest of it now. Then ensure that the final state of the
|
# apply the rest of it now. Then ensure that the final state of the
|
||||||
# target db is as expected. And that "PRAGMA integrity_check"
|
# target db is as expected. And that "PRAGMA integrity_check"
|
||||||
# passes.
|
# passes.
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
while {[ota step] == "SQLITE_OK"} {}
|
while {[rbu step] == "SQLITE_OK"} {}
|
||||||
ota close
|
rbu close
|
||||||
|
|
||||||
sqlite3 db test.db
|
sqlite3 db test.db
|
||||||
faultsim_integrity_check
|
faultsim_integrity_check
|
@ -15,33 +15,33 @@ if {![info exists testdir]} {
|
|||||||
}
|
}
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
source $testdir/malloc_common.tcl
|
source $testdir/malloc_common.tcl
|
||||||
set ::testprefix otafault2
|
set ::testprefix rbufault2
|
||||||
|
|
||||||
forcedelete ota.db
|
forcedelete rbu.db
|
||||||
do_execsql_test 1.0 {
|
do_execsql_test 1.0 {
|
||||||
CREATE TABLE target(x UNIQUE, y, z, PRIMARY KEY(y));
|
CREATE TABLE target(x UNIQUE, y, z, PRIMARY KEY(y));
|
||||||
INSERT INTO target VALUES(1, 2, 3);
|
INSERT INTO target VALUES(1, 2, 3);
|
||||||
INSERT INTO target VALUES(4, 5, 6);
|
INSERT INTO target VALUES(4, 5, 6);
|
||||||
|
|
||||||
ATTACH 'ota.db' AS ota;
|
ATTACH 'rbu.db' AS rbu;
|
||||||
CREATE TABLE ota.data_target(x, y, z, ota_control);
|
CREATE TABLE rbu.data_target(x, y, z, rbu_control);
|
||||||
INSERT INTO data_target VALUES(7, 8, 9, 0);
|
INSERT INTO data_target VALUES(7, 8, 9, 0);
|
||||||
INSERT INTO data_target VALUES(1, 11, 12, 0);
|
INSERT INTO data_target VALUES(1, 11, 12, 0);
|
||||||
DETACH ota;
|
DETACH rbu;
|
||||||
}
|
}
|
||||||
db close
|
db close
|
||||||
|
|
||||||
forcecopy test.db test.db-bak
|
forcecopy test.db test.db-bak
|
||||||
forcecopy ota.db ota.db-bak
|
forcecopy rbu.db rbu.db-bak
|
||||||
|
|
||||||
do_faultsim_test 1 -faults oom* -prep {
|
do_faultsim_test 1 -faults oom* -prep {
|
||||||
forcecopy test.db-bak test.db
|
forcecopy test.db-bak test.db
|
||||||
forcecopy ota.db-bak ota.db
|
forcecopy rbu.db-bak rbu.db
|
||||||
forcedelete test.db-oal test.db-wal ota.db-journal
|
forcedelete test.db-oal test.db-wal rbu.db-journal
|
||||||
sqlite3ota ota test.db ota.db
|
sqlite3rbu rbu test.db rbu.db
|
||||||
} -body {
|
} -body {
|
||||||
while {[ota step]=="SQLITE_OK"} { }
|
while {[rbu step]=="SQLITE_OK"} { }
|
||||||
ota close
|
rbu close
|
||||||
} -test {
|
} -test {
|
||||||
faultsim_test_result \
|
faultsim_test_result \
|
||||||
{1 {SQLITE_CONSTRAINT - UNIQUE constraint failed: target.x}} \
|
{1 {SQLITE_CONSTRAINT - UNIQUE constraint failed: target.x}} \
|
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@
|
|||||||
**
|
**
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
**
|
**
|
||||||
** This file contains the public interface for the OTA extension.
|
** This file contains the public interface for the RBU extension.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -47,14 +47,14 @@
|
|||||||
** to read from the original database snapshot. In other words, partially
|
** to read from the original database snapshot. In other words, partially
|
||||||
** applied transactions are not visible to other clients.
|
** applied transactions are not visible to other clients.
|
||||||
**
|
**
|
||||||
** "OTA" stands for "Over The Air" update. As in a large database update
|
** "RBU" stands for "Over The Air" update. As in a large database update
|
||||||
** transmitted via a wireless network to a mobile device. A transaction
|
** transmitted via a wireless network to a mobile device. A transaction
|
||||||
** applied using this extension is hence refered to as an "OTA update".
|
** applied using this extension is hence refered to as an "RBU update".
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
** LIMITATIONS
|
** LIMITATIONS
|
||||||
**
|
**
|
||||||
** An "OTA update" transaction is subject to the following limitations:
|
** An "RBU update" transaction is subject to the following limitations:
|
||||||
**
|
**
|
||||||
** * The transaction must consist of INSERT, UPDATE and DELETE operations
|
** * The transaction must consist of INSERT, UPDATE and DELETE operations
|
||||||
** only.
|
** only.
|
||||||
@ -79,41 +79,41 @@
|
|||||||
**
|
**
|
||||||
** PREPARATION
|
** PREPARATION
|
||||||
**
|
**
|
||||||
** An "OTA update" is stored as a separate SQLite database. A database
|
** An "RBU update" is stored as a separate SQLite database. A database
|
||||||
** containing an OTA update is an "OTA database". For each table in the
|
** containing an RBU update is an "RBU database". For each table in the
|
||||||
** target database to be updated, the OTA database should contain a table
|
** target database to be updated, the RBU database should contain a table
|
||||||
** named "data_<target name>" containing the same set of columns as the
|
** named "data_<target name>" containing the same set of columns as the
|
||||||
** target table, and one more - "ota_control". The data_% table should
|
** target table, and one more - "rbu_control". The data_% table should
|
||||||
** have no PRIMARY KEY or UNIQUE constraints, but each column should have
|
** have no PRIMARY KEY or UNIQUE constraints, but each column should have
|
||||||
** the same type as the corresponding column in the target database.
|
** the same type as the corresponding column in the target database.
|
||||||
** The "ota_control" column should have no type at all. For example, if
|
** The "rbu_control" column should have no type at all. For example, if
|
||||||
** the target database contains:
|
** the target database contains:
|
||||||
**
|
**
|
||||||
** CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c UNIQUE);
|
** CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c UNIQUE);
|
||||||
**
|
**
|
||||||
** Then the OTA database should contain:
|
** Then the RBU database should contain:
|
||||||
**
|
**
|
||||||
** CREATE TABLE data_t1(a INTEGER, b TEXT, c, ota_control);
|
** CREATE TABLE data_t1(a INTEGER, b TEXT, c, rbu_control);
|
||||||
**
|
**
|
||||||
** The order of the columns in the data_% table does not matter.
|
** The order of the columns in the data_% table does not matter.
|
||||||
**
|
**
|
||||||
** If the target database table is a virtual table or a table that has no
|
** If the target database table is a virtual table or a table that has no
|
||||||
** PRIMARY KEY declaration, the data_% table must also contain a column
|
** PRIMARY KEY declaration, the data_% table must also contain a column
|
||||||
** named "ota_rowid". This column is mapped to the tables implicit primary
|
** named "rbu_rowid". This column is mapped to the tables implicit primary
|
||||||
** key column - "rowid". Virtual tables for which the "rowid" column does
|
** key column - "rowid". Virtual tables for which the "rowid" column does
|
||||||
** not function like a primary key value cannot be updated using OTA. For
|
** not function like a primary key value cannot be updated using RBU. For
|
||||||
** example, if the target db contains either of the following:
|
** example, if the target db contains either of the following:
|
||||||
**
|
**
|
||||||
** CREATE VIRTUAL TABLE x1 USING fts3(a, b);
|
** CREATE VIRTUAL TABLE x1 USING fts3(a, b);
|
||||||
** CREATE TABLE x1(a, b)
|
** CREATE TABLE x1(a, b)
|
||||||
**
|
**
|
||||||
** then the OTA database should contain:
|
** then the RBU database should contain:
|
||||||
**
|
**
|
||||||
** CREATE TABLE data_x1(a, b, ota_rowid, ota_control);
|
** CREATE TABLE data_x1(a, b, rbu_rowid, rbu_control);
|
||||||
**
|
**
|
||||||
** All non-hidden columns (i.e. all columns matched by "SELECT *") of the
|
** All non-hidden columns (i.e. all columns matched by "SELECT *") of the
|
||||||
** target table must be present in the input table. For virtual tables,
|
** target table must be present in the input table. For virtual tables,
|
||||||
** hidden columns are optional - they are updated by OTA if present in
|
** hidden columns are optional - they are updated by RBU if present in
|
||||||
** the input table, or not otherwise. For example, to write to an fts4
|
** the input table, or not otherwise. For example, to write to an fts4
|
||||||
** table with a hidden languageid column such as:
|
** table with a hidden languageid column such as:
|
||||||
**
|
**
|
||||||
@ -121,12 +121,12 @@
|
|||||||
**
|
**
|
||||||
** Either of the following input table schemas may be used:
|
** Either of the following input table schemas may be used:
|
||||||
**
|
**
|
||||||
** CREATE TABLE data_ft1(a, b, langid, ota_rowid, ota_control);
|
** CREATE TABLE data_ft1(a, b, langid, rbu_rowid, rbu_control);
|
||||||
** CREATE TABLE data_ft1(a, b, ota_rowid, ota_control);
|
** CREATE TABLE data_ft1(a, b, rbu_rowid, rbu_control);
|
||||||
**
|
**
|
||||||
** For each row to INSERT into the target database as part of the OTA
|
** For each row to INSERT into the target database as part of the RBU
|
||||||
** update, the corresponding data_% table should contain a single record
|
** update, the corresponding data_% table should contain a single record
|
||||||
** with the "ota_control" column set to contain integer value 0. The
|
** with the "rbu_control" column set to contain integer value 0. The
|
||||||
** other columns should be set to the values that make up the new record
|
** other columns should be set to the values that make up the new record
|
||||||
** to insert.
|
** to insert.
|
||||||
**
|
**
|
||||||
@ -134,54 +134,54 @@
|
|||||||
** possible to insert a NULL value into the IPK column. Attempting to
|
** possible to insert a NULL value into the IPK column. Attempting to
|
||||||
** do so results in an SQLITE_MISMATCH error.
|
** do so results in an SQLITE_MISMATCH error.
|
||||||
**
|
**
|
||||||
** For each row to DELETE from the target database as part of the OTA
|
** For each row to DELETE from the target database as part of the RBU
|
||||||
** update, the corresponding data_% table should contain a single record
|
** update, the corresponding data_% table should contain a single record
|
||||||
** with the "ota_control" column set to contain integer value 1. The
|
** with the "rbu_control" column set to contain integer value 1. The
|
||||||
** real primary key values of the row to delete should be stored in the
|
** real primary key values of the row to delete should be stored in the
|
||||||
** corresponding columns of the data_% table. The values stored in the
|
** corresponding columns of the data_% table. The values stored in the
|
||||||
** other columns are not used.
|
** other columns are not used.
|
||||||
**
|
**
|
||||||
** For each row to UPDATE from the target database as part of the OTA
|
** For each row to UPDATE from the target database as part of the RBU
|
||||||
** update, the corresponding data_% table should contain a single record
|
** update, the corresponding data_% table should contain a single record
|
||||||
** with the "ota_control" column set to contain a value of type text.
|
** with the "rbu_control" column set to contain a value of type text.
|
||||||
** The real primary key values identifying the row to update should be
|
** The real primary key values identifying the row to update should be
|
||||||
** stored in the corresponding columns of the data_% table row, as should
|
** stored in the corresponding columns of the data_% table row, as should
|
||||||
** the new values of all columns being update. The text value in the
|
** the new values of all columns being update. The text value in the
|
||||||
** "ota_control" column must contain the same number of characters as
|
** "rbu_control" column must contain the same number of characters as
|
||||||
** there are columns in the target database table, and must consist entirely
|
** there are columns in the target database table, and must consist entirely
|
||||||
** of 'x' and '.' characters (or in some special cases 'd' - see below). For
|
** of 'x' and '.' characters (or in some special cases 'd' - see below). For
|
||||||
** each column that is being updated, the corresponding character is set to
|
** each column that is being updated, the corresponding character is set to
|
||||||
** 'x'. For those that remain as they are, the corresponding character of the
|
** 'x'. For those that remain as they are, the corresponding character of the
|
||||||
** ota_control value should be set to '.'. For example, given the tables
|
** rbu_control value should be set to '.'. For example, given the tables
|
||||||
** above, the update statement:
|
** above, the update statement:
|
||||||
**
|
**
|
||||||
** UPDATE t1 SET c = 'usa' WHERE a = 4;
|
** UPDATE t1 SET c = 'usa' WHERE a = 4;
|
||||||
**
|
**
|
||||||
** is represented by the data_t1 row created by:
|
** is represented by the data_t1 row created by:
|
||||||
**
|
**
|
||||||
** INSERT INTO data_t1(a, b, c, ota_control) VALUES(4, NULL, 'usa', '..x');
|
** INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..x');
|
||||||
**
|
**
|
||||||
** Instead of an 'x' character, characters of the ota_control value specified
|
** Instead of an 'x' character, characters of the rbu_control value specified
|
||||||
** for UPDATEs may also be set to 'd'. In this case, instead of updating the
|
** for UPDATEs may also be set to 'd'. In this case, instead of updating the
|
||||||
** target table with the value stored in the corresponding data_% column, the
|
** target table with the value stored in the corresponding data_% column, the
|
||||||
** user-defined SQL function "ota_delta()" is invoked and the result stored in
|
** user-defined SQL function "rbu_delta()" is invoked and the result stored in
|
||||||
** the target table column. ota_delta() is invoked with two arguments - the
|
** the target table column. rbu_delta() is invoked with two arguments - the
|
||||||
** original value currently stored in the target table column and the
|
** original value currently stored in the target table column and the
|
||||||
** value specified in the data_xxx table.
|
** value specified in the data_xxx table.
|
||||||
**
|
**
|
||||||
** For example, this row:
|
** For example, this row:
|
||||||
**
|
**
|
||||||
** INSERT INTO data_t1(a, b, c, ota_control) VALUES(4, NULL, 'usa', '..d');
|
** INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..d');
|
||||||
**
|
**
|
||||||
** is similar to an UPDATE statement such as:
|
** is similar to an UPDATE statement such as:
|
||||||
**
|
**
|
||||||
** UPDATE t1 SET c = ota_delta(c, 'usa') WHERE a = 4;
|
** UPDATE t1 SET c = rbu_delta(c, 'usa') WHERE a = 4;
|
||||||
**
|
**
|
||||||
** If the target database table is a virtual table or a table with no PRIMARY
|
** If the target database table is a virtual table or a table with no PRIMARY
|
||||||
** KEY, the ota_control value should not include a character corresponding
|
** KEY, the rbu_control value should not include a character corresponding
|
||||||
** to the ota_rowid value. For example, this:
|
** to the rbu_rowid value. For example, this:
|
||||||
**
|
**
|
||||||
** INSERT INTO data_ft1(a, b, ota_rowid, ota_control)
|
** INSERT INTO data_ft1(a, b, rbu_rowid, rbu_control)
|
||||||
** VALUES(NULL, 'usa', 12, '.x');
|
** VALUES(NULL, 'usa', 12, '.x');
|
||||||
**
|
**
|
||||||
** causes a result similar to:
|
** causes a result similar to:
|
||||||
@ -189,7 +189,7 @@
|
|||||||
** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
|
** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
|
||||||
**
|
**
|
||||||
** The data_xxx tables themselves should have no PRIMARY KEY declarations.
|
** The data_xxx tables themselves should have no PRIMARY KEY declarations.
|
||||||
** However, OTA is more efficient if reading the rows in from each data_xxx
|
** However, RBU is more efficient if reading the rows in from each data_xxx
|
||||||
** table in "rowid" order is roughly the same as reading them sorted by
|
** table in "rowid" order is roughly the same as reading them sorted by
|
||||||
** the PRIMARY KEY of the corresponding target database table. In other
|
** the PRIMARY KEY of the corresponding target database table. In other
|
||||||
** words, rows should be sorted using the destination table PRIMARY KEY
|
** words, rows should be sorted using the destination table PRIMARY KEY
|
||||||
@ -197,107 +197,107 @@
|
|||||||
**
|
**
|
||||||
** USAGE
|
** USAGE
|
||||||
**
|
**
|
||||||
** The API declared below allows an application to apply an OTA update
|
** The API declared below allows an application to apply an RBU update
|
||||||
** stored on disk to an existing target database. Essentially, the
|
** stored on disk to an existing target database. Essentially, the
|
||||||
** application:
|
** application:
|
||||||
**
|
**
|
||||||
** 1) Opens an OTA handle using the sqlite3ota_open() function.
|
** 1) Opens an RBU handle using the sqlite3rbu_open() function.
|
||||||
**
|
**
|
||||||
** 2) Registers any required virtual table modules with the database
|
** 2) Registers any required virtual table modules with the database
|
||||||
** handle returned by sqlite3ota_db(). Also, if required, register
|
** handle returned by sqlite3rbu_db(). Also, if required, register
|
||||||
** the ota_delta() implementation.
|
** the rbu_delta() implementation.
|
||||||
**
|
**
|
||||||
** 3) Calls the sqlite3ota_step() function one or more times on
|
** 3) Calls the sqlite3rbu_step() function one or more times on
|
||||||
** the new handle. Each call to sqlite3ota_step() performs a single
|
** the new handle. Each call to sqlite3rbu_step() performs a single
|
||||||
** b-tree operation, so thousands of calls may be required to apply
|
** b-tree operation, so thousands of calls may be required to apply
|
||||||
** a complete update.
|
** a complete update.
|
||||||
**
|
**
|
||||||
** 4) Calls sqlite3ota_close() to close the OTA update handle. If
|
** 4) Calls sqlite3rbu_close() to close the RBU update handle. If
|
||||||
** sqlite3ota_step() has been called enough times to completely
|
** sqlite3rbu_step() has been called enough times to completely
|
||||||
** apply the update to the target database, then the OTA database
|
** apply the update to the target database, then the RBU database
|
||||||
** is marked as fully applied. Otherwise, the state of the OTA
|
** is marked as fully applied. Otherwise, the state of the RBU
|
||||||
** update application is saved in the OTA database for later
|
** update application is saved in the RBU database for later
|
||||||
** resumption.
|
** resumption.
|
||||||
**
|
**
|
||||||
** See comments below for more detail on APIs.
|
** See comments below for more detail on APIs.
|
||||||
**
|
**
|
||||||
** If an update is only partially applied to the target database by the
|
** If an update is only partially applied to the target database by the
|
||||||
** time sqlite3ota_close() is called, various state information is saved
|
** time sqlite3rbu_close() is called, various state information is saved
|
||||||
** within the OTA database. This allows subsequent processes to automatically
|
** within the RBU database. This allows subsequent processes to automatically
|
||||||
** resume the OTA update from where it left off.
|
** resume the RBU update from where it left off.
|
||||||
**
|
**
|
||||||
** To remove all OTA extension state information, returning an OTA database
|
** To remove all RBU extension state information, returning an RBU database
|
||||||
** to its original contents, it is sufficient to drop all tables that begin
|
** to its original contents, it is sufficient to drop all tables that begin
|
||||||
** with the prefix "ota_"
|
** with the prefix "rbu_"
|
||||||
**
|
**
|
||||||
** DATABASE LOCKING
|
** DATABASE LOCKING
|
||||||
**
|
**
|
||||||
** An OTA update may not be applied to a database in WAL mode. Attempting
|
** An RBU update may not be applied to a database in WAL mode. Attempting
|
||||||
** to do so is an error (SQLITE_ERROR).
|
** to do so is an error (SQLITE_ERROR).
|
||||||
**
|
**
|
||||||
** While an OTA handle is open, a SHARED lock may be held on the target
|
** While an RBU handle is open, a SHARED lock may be held on the target
|
||||||
** database file. This means it is possible for other clients to read the
|
** database file. This means it is possible for other clients to read the
|
||||||
** database, but not to write it.
|
** database, but not to write it.
|
||||||
**
|
**
|
||||||
** If an OTA update is started and then suspended before it is completed,
|
** If an RBU update is started and then suspended before it is completed,
|
||||||
** then an external client writes to the database, then attempting to resume
|
** then an external client writes to the database, then attempting to resume
|
||||||
** the suspended OTA update is also an error (SQLITE_BUSY).
|
** the suspended RBU update is also an error (SQLITE_BUSY).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SQLITE3OTA_H
|
#ifndef _SQLITE3RBU_H
|
||||||
#define _SQLITE3OTA_H
|
#define _SQLITE3RBU_H
|
||||||
|
|
||||||
#include "sqlite3.h" /* Required for error code definitions */
|
#include "sqlite3.h" /* Required for error code definitions */
|
||||||
|
|
||||||
typedef struct sqlite3ota sqlite3ota;
|
typedef struct sqlite3rbu sqlite3rbu;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Open an OTA handle.
|
** Open an RBU handle.
|
||||||
**
|
**
|
||||||
** Argument zTarget is the path to the target database. Argument zOta is
|
** Argument zTarget is the path to the target database. Argument zRbu is
|
||||||
** the path to the OTA database. Each call to this function must be matched
|
** the path to the RBU database. Each call to this function must be matched
|
||||||
** by a call to sqlite3ota_close(). When opening the databases, OTA passes
|
** by a call to sqlite3rbu_close(). When opening the databases, RBU passes
|
||||||
** the SQLITE_CONFIG_URI flag to sqlite3_open_v2(). So if either zTarget
|
** the SQLITE_CONFIG_URI flag to sqlite3_open_v2(). So if either zTarget
|
||||||
** or zOta begin with "file:", it will be interpreted as an SQLite
|
** or zRbu begin with "file:", it will be interpreted as an SQLite
|
||||||
** database URI, not a regular file name.
|
** database URI, not a regular file name.
|
||||||
**
|
**
|
||||||
** If the zState argument is passed a NULL value, the OTA extension stores
|
** If the zState argument is passed a NULL value, the RBU extension stores
|
||||||
** the current state of the update (how many rows have been updated, which
|
** the current state of the update (how many rows have been updated, which
|
||||||
** indexes are yet to be updated etc.) within the OTA database itself. This
|
** indexes are yet to be updated etc.) within the RBU database itself. This
|
||||||
** can be convenient, as it means that the OTA application does not need to
|
** can be convenient, as it means that the RBU application does not need to
|
||||||
** organize removing a separate state file after the update is concluded.
|
** organize removing a separate state file after the update is concluded.
|
||||||
** Or, if zState is non-NULL, it must be a path to a database file in which
|
** Or, if zState is non-NULL, it must be a path to a database file in which
|
||||||
** the OTA extension can store the state of the update.
|
** the RBU extension can store the state of the update.
|
||||||
**
|
**
|
||||||
** When resuming an OTA update, the zState argument must be passed the same
|
** When resuming an RBU update, the zState argument must be passed the same
|
||||||
** value as when the OTA update was started.
|
** value as when the RBU update was started.
|
||||||
**
|
**
|
||||||
** Once the OTA update is finished, the OTA extension does not
|
** Once the RBU update is finished, the RBU extension does not
|
||||||
** automatically remove any zState database file, even if it created it.
|
** automatically remove any zState database file, even if it created it.
|
||||||
**
|
**
|
||||||
** By default, OTA uses the default VFS to access the files on disk. To
|
** By default, RBU uses the default VFS to access the files on disk. To
|
||||||
** use a VFS other than the default, an SQLite "file:" URI containing a
|
** use a VFS other than the default, an SQLite "file:" URI containing a
|
||||||
** "vfs=..." option may be passed as the zTarget option.
|
** "vfs=..." option may be passed as the zTarget option.
|
||||||
**
|
**
|
||||||
** IMPORTANT NOTE FOR ZIPVFS USERS: The OTA extension works with all of
|
** IMPORTANT NOTE FOR ZIPVFS USERS: The RBU extension works with all of
|
||||||
** SQLite's built-in VFSs, including the multiplexor VFS. However it does
|
** SQLite's built-in VFSs, including the multiplexor VFS. However it does
|
||||||
** not work out of the box with zipvfs. Refer to the comment describing
|
** not work out of the box with zipvfs. Refer to the comment describing
|
||||||
** the zipvfs_create_vfs() API below for details on using OTA with zipvfs.
|
** the zipvfs_create_vfs() API below for details on using RBU with zipvfs.
|
||||||
*/
|
*/
|
||||||
sqlite3ota *sqlite3ota_open(
|
sqlite3rbu *sqlite3rbu_open(
|
||||||
const char *zTarget,
|
const char *zTarget,
|
||||||
const char *zOta,
|
const char *zRbu,
|
||||||
const char *zState
|
const char *zState
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Internally, each OTA connection uses a separate SQLite database
|
** Internally, each RBU connection uses a separate SQLite database
|
||||||
** connection to access the target and ota update databases. This
|
** connection to access the target and rbu update databases. This
|
||||||
** API allows the application direct access to these database handles.
|
** API allows the application direct access to these database handles.
|
||||||
**
|
**
|
||||||
** The first argument passed to this function must be a valid, open, OTA
|
** The first argument passed to this function must be a valid, open, RBU
|
||||||
** handle. The second argument should be passed zero to access the target
|
** handle. The second argument should be passed zero to access the target
|
||||||
** database handle, or non-zero to access the ota update database handle.
|
** database handle, or non-zero to access the rbu update database handle.
|
||||||
** Accessing the underlying database handles may be useful in the
|
** Accessing the underlying database handles may be useful in the
|
||||||
** following scenarios:
|
** following scenarios:
|
||||||
**
|
**
|
||||||
@ -305,44 +305,44 @@ sqlite3ota *sqlite3ota_open(
|
|||||||
** call sqlite3_create_module() on the target database handle to
|
** call sqlite3_create_module() on the target database handle to
|
||||||
** register the required virtual table implementations.
|
** register the required virtual table implementations.
|
||||||
**
|
**
|
||||||
** * If the data_xxx tables in the OTA source database are virtual
|
** * If the data_xxx tables in the RBU source database are virtual
|
||||||
** tables, the application may need to call sqlite3_create_module() on
|
** tables, the application may need to call sqlite3_create_module() on
|
||||||
** the ota update db handle to any required virtual table
|
** the rbu update db handle to any required virtual table
|
||||||
** implementations.
|
** implementations.
|
||||||
**
|
**
|
||||||
** * If the application uses the "ota_delta()" feature described above,
|
** * If the application uses the "rbu_delta()" feature described above,
|
||||||
** it must use sqlite3_create_function() or similar to register the
|
** it must use sqlite3_create_function() or similar to register the
|
||||||
** ota_delta() implementation with the target database handle.
|
** rbu_delta() implementation with the target database handle.
|
||||||
**
|
**
|
||||||
** If an error has occurred, either while opening or stepping the OTA object,
|
** If an error has occurred, either while opening or stepping the RBU object,
|
||||||
** this function may return NULL. The error code and message may be collected
|
** this function may return NULL. The error code and message may be collected
|
||||||
** when sqlite3ota_close() is called.
|
** when sqlite3rbu_close() is called.
|
||||||
*/
|
*/
|
||||||
sqlite3 *sqlite3ota_db(sqlite3ota*, int bOta);
|
sqlite3 *sqlite3rbu_db(sqlite3rbu*, int bRbu);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Do some work towards applying the OTA update to the target db.
|
** Do some work towards applying the RBU update to the target db.
|
||||||
**
|
**
|
||||||
** Return SQLITE_DONE if the update has been completely applied, or
|
** Return SQLITE_DONE if the update has been completely applied, or
|
||||||
** SQLITE_OK if no error occurs but there remains work to do to apply
|
** SQLITE_OK if no error occurs but there remains work to do to apply
|
||||||
** the OTA update. If an error does occur, some other error code is
|
** the RBU update. If an error does occur, some other error code is
|
||||||
** returned.
|
** returned.
|
||||||
**
|
**
|
||||||
** Once a call to sqlite3ota_step() has returned a value other than
|
** Once a call to sqlite3rbu_step() has returned a value other than
|
||||||
** SQLITE_OK, all subsequent calls on the same OTA handle are no-ops
|
** SQLITE_OK, all subsequent calls on the same RBU handle are no-ops
|
||||||
** that immediately return the same value.
|
** that immediately return the same value.
|
||||||
*/
|
*/
|
||||||
int sqlite3ota_step(sqlite3ota *pOta);
|
int sqlite3rbu_step(sqlite3rbu *pRbu);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Close an OTA handle.
|
** Close an RBU handle.
|
||||||
**
|
**
|
||||||
** If the OTA update has been completely applied, mark the OTA database
|
** If the RBU update has been completely applied, mark the RBU database
|
||||||
** as fully applied. Otherwise, assuming no error has occurred, save the
|
** as fully applied. Otherwise, assuming no error has occurred, save the
|
||||||
** current state of the OTA update appliation to the OTA database.
|
** current state of the RBU update appliation to the RBU database.
|
||||||
**
|
**
|
||||||
** If an error has already occurred as part of an sqlite3ota_step()
|
** If an error has already occurred as part of an sqlite3rbu_step()
|
||||||
** or sqlite3ota_open() call, or if one occurs within this function, an
|
** or sqlite3rbu_open() call, or if one occurs within this function, an
|
||||||
** SQLite error code is returned. Additionally, *pzErrmsg may be set to
|
** SQLite error code is returned. Additionally, *pzErrmsg may be set to
|
||||||
** point to a buffer containing a utf-8 formatted English language error
|
** point to a buffer containing a utf-8 formatted English language error
|
||||||
** message. It is the responsibility of the caller to eventually free any
|
** message. It is the responsibility of the caller to eventually free any
|
||||||
@ -352,67 +352,67 @@ int sqlite3ota_step(sqlite3ota *pOta);
|
|||||||
** update has been partially applied, or SQLITE_DONE if it has been
|
** update has been partially applied, or SQLITE_DONE if it has been
|
||||||
** completely applied.
|
** completely applied.
|
||||||
*/
|
*/
|
||||||
int sqlite3ota_close(sqlite3ota *pOta, char **pzErrmsg);
|
int sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Return the total number of key-value operations (inserts, deletes or
|
** Return the total number of key-value operations (inserts, deletes or
|
||||||
** updates) that have been performed on the target database since the
|
** updates) that have been performed on the target database since the
|
||||||
** current OTA update was started.
|
** current RBU update was started.
|
||||||
*/
|
*/
|
||||||
sqlite3_int64 sqlite3ota_progress(sqlite3ota *pOta);
|
sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Create an OTA VFS named zName that accesses the underlying file-system
|
** Create an RBU VFS named zName that accesses the underlying file-system
|
||||||
** via existing VFS zParent. Or, if the zParent parameter is passed NULL,
|
** via existing VFS zParent. Or, if the zParent parameter is passed NULL,
|
||||||
** then the new OTA VFS uses the default system VFS to access the file-system.
|
** then the new RBU VFS uses the default system VFS to access the file-system.
|
||||||
** The new object is registered as a non-default VFS with SQLite before
|
** The new object is registered as a non-default VFS with SQLite before
|
||||||
** returning.
|
** returning.
|
||||||
**
|
**
|
||||||
** Part of the OTA implementation uses a custom VFS object. Usually, this
|
** Part of the RBU implementation uses a custom VFS object. Usually, this
|
||||||
** object is created and deleted automatically by OTA.
|
** object is created and deleted automatically by RBU.
|
||||||
**
|
**
|
||||||
** The exception is for applications that also use zipvfs. In this case,
|
** The exception is for applications that also use zipvfs. In this case,
|
||||||
** the custom VFS must be explicitly created by the user before the OTA
|
** the custom VFS must be explicitly created by the user before the RBU
|
||||||
** handle is opened. The OTA VFS should be installed so that the zipvfs
|
** handle is opened. The RBU VFS should be installed so that the zipvfs
|
||||||
** VFS uses the OTA VFS, which in turn uses any other VFS layers in use
|
** VFS uses the RBU VFS, which in turn uses any other VFS layers in use
|
||||||
** (for example multiplexor) to access the file-system. For example,
|
** (for example multiplexor) to access the file-system. For example,
|
||||||
** to assemble an OTA enabled VFS stack that uses both zipvfs and
|
** to assemble an RBU enabled VFS stack that uses both zipvfs and
|
||||||
** multiplexor (error checking omitted):
|
** multiplexor (error checking omitted):
|
||||||
**
|
**
|
||||||
** // Create a VFS named "multiplex" (not the default).
|
** // Create a VFS named "multiplex" (not the default).
|
||||||
** sqlite3_multiplex_initialize(0, 0);
|
** sqlite3_multiplex_initialize(0, 0);
|
||||||
**
|
**
|
||||||
** // Create an ota VFS named "ota" that uses multiplexor. If the
|
** // Create an rbu VFS named "rbu" that uses multiplexor. If the
|
||||||
** // second argument were replaced with NULL, the "ota" VFS would
|
** // second argument were replaced with NULL, the "rbu" VFS would
|
||||||
** // access the file-system via the system default VFS, bypassing the
|
** // access the file-system via the system default VFS, bypassing the
|
||||||
** // multiplexor.
|
** // multiplexor.
|
||||||
** sqlite3ota_create_vfs("ota", "multiplex");
|
** sqlite3rbu_create_vfs("rbu", "multiplex");
|
||||||
**
|
**
|
||||||
** // Create a zipvfs VFS named "zipvfs" that uses ota.
|
** // Create a zipvfs VFS named "zipvfs" that uses rbu.
|
||||||
** zipvfs_create_vfs_v3("zipvfs", "ota", 0, xCompressorAlgorithmDetector);
|
** zipvfs_create_vfs_v3("zipvfs", "rbu", 0, xCompressorAlgorithmDetector);
|
||||||
**
|
**
|
||||||
** // Make zipvfs the default VFS.
|
** // Make zipvfs the default VFS.
|
||||||
** sqlite3_vfs_register(sqlite3_vfs_find("zipvfs"), 1);
|
** sqlite3_vfs_register(sqlite3_vfs_find("zipvfs"), 1);
|
||||||
**
|
**
|
||||||
** Because the default VFS created above includes a OTA functionality, it
|
** Because the default VFS created above includes a RBU functionality, it
|
||||||
** may be used by OTA clients. Attempting to use OTA with a zipvfs VFS stack
|
** may be used by RBU clients. Attempting to use RBU with a zipvfs VFS stack
|
||||||
** that does not include the OTA layer results in an error.
|
** that does not include the RBU layer results in an error.
|
||||||
**
|
**
|
||||||
** The overhead of adding the "ota" VFS to the system is negligible for
|
** The overhead of adding the "rbu" VFS to the system is negligible for
|
||||||
** non-OTA users. There is no harm in an application accessing the
|
** non-RBU users. There is no harm in an application accessing the
|
||||||
** file-system via "ota" all the time, even if it only uses OTA functionality
|
** file-system via "rbu" all the time, even if it only uses RBU functionality
|
||||||
** occasionally.
|
** occasionally.
|
||||||
*/
|
*/
|
||||||
int sqlite3ota_create_vfs(const char *zName, const char *zParent);
|
int sqlite3rbu_create_vfs(const char *zName, const char *zParent);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Deregister and destroy an OTA vfs created by an earlier call to
|
** Deregister and destroy an RBU vfs created by an earlier call to
|
||||||
** sqlite3ota_create_vfs().
|
** sqlite3rbu_create_vfs().
|
||||||
**
|
**
|
||||||
** VFS objects are not reference counted. If a VFS object is destroyed
|
** VFS objects are not reference counted. If a VFS object is destroyed
|
||||||
** before all database handles that use it have been closed, the results
|
** before all database handles that use it have been closed, the results
|
||||||
** are undefined.
|
** are undefined.
|
||||||
*/
|
*/
|
||||||
void sqlite3ota_destroy_vfs(const char *zName);
|
void sqlite3rbu_destroy_vfs(const char *zName);
|
||||||
|
|
||||||
#endif /* _SQLITE3OTA_H */
|
#endif /* _SQLITE3RBU_H */
|
@ -14,23 +14,23 @@
|
|||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
|
|
||||||
#if defined(SQLITE_TEST)
|
#if defined(SQLITE_TEST)
|
||||||
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_OTA)
|
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)
|
||||||
|
|
||||||
#include "sqlite3ota.h"
|
#include "sqlite3rbu.h"
|
||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/* From main.c (apparently...) */
|
/* From main.c (apparently...) */
|
||||||
extern const char *sqlite3ErrName(int);
|
extern const char *sqlite3ErrName(int);
|
||||||
|
|
||||||
void test_ota_delta(sqlite3_context *pCtx, int nArg, sqlite3_value **apVal){
|
void test_rbu_delta(sqlite3_context *pCtx, int nArg, sqlite3_value **apVal){
|
||||||
Tcl_Interp *interp = (Tcl_Interp*)sqlite3_user_data(pCtx);
|
Tcl_Interp *interp = (Tcl_Interp*)sqlite3_user_data(pCtx);
|
||||||
Tcl_Obj *pScript;
|
Tcl_Obj *pScript;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pScript = Tcl_NewObj();
|
pScript = Tcl_NewObj();
|
||||||
Tcl_IncrRefCount(pScript);
|
Tcl_IncrRefCount(pScript);
|
||||||
Tcl_ListObjAppendElement(0, pScript, Tcl_NewStringObj("ota_delta", -1));
|
Tcl_ListObjAppendElement(0, pScript, Tcl_NewStringObj("rbu_delta", -1));
|
||||||
for(i=0; i<nArg; i++){
|
for(i=0; i<nArg; i++){
|
||||||
sqlite3_value *pIn = apVal[i];
|
sqlite3_value *pIn = apVal[i];
|
||||||
const char *z = (const char*)sqlite3_value_text(pIn);
|
const char *z = (const char*)sqlite3_value_text(pIn);
|
||||||
@ -48,15 +48,15 @@ void test_ota_delta(sqlite3_context *pCtx, int nArg, sqlite3_value **apVal){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int test_sqlite3ota_cmd(
|
static int test_sqlite3rbu_cmd(
|
||||||
ClientData clientData,
|
ClientData clientData,
|
||||||
Tcl_Interp *interp,
|
Tcl_Interp *interp,
|
||||||
int objc,
|
int objc,
|
||||||
Tcl_Obj *CONST objv[]
|
Tcl_Obj *CONST objv[]
|
||||||
){
|
){
|
||||||
int ret = TCL_OK;
|
int ret = TCL_OK;
|
||||||
sqlite3ota *pOta = (sqlite3ota*)clientData;
|
sqlite3rbu *pRbu = (sqlite3rbu*)clientData;
|
||||||
const char *azMethod[] = { "step", "close", "create_ota_delta", 0 };
|
const char *azMethod[] = { "step", "close", "create_rbu_delta", 0 };
|
||||||
int iMethod;
|
int iMethod;
|
||||||
|
|
||||||
if( objc!=2 ){
|
if( objc!=2 ){
|
||||||
@ -69,7 +69,7 @@ static int test_sqlite3ota_cmd(
|
|||||||
|
|
||||||
switch( iMethod ){
|
switch( iMethod ){
|
||||||
case 0: /* step */ {
|
case 0: /* step */ {
|
||||||
int rc = sqlite3ota_step(pOta);
|
int rc = sqlite3rbu_step(pRbu);
|
||||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ static int test_sqlite3ota_cmd(
|
|||||||
char *zErrmsg = 0;
|
char *zErrmsg = 0;
|
||||||
int rc;
|
int rc;
|
||||||
Tcl_DeleteCommand(interp, Tcl_GetString(objv[0]));
|
Tcl_DeleteCommand(interp, Tcl_GetString(objv[0]));
|
||||||
rc = sqlite3ota_close(pOta, &zErrmsg);
|
rc = sqlite3rbu_close(pRbu, &zErrmsg);
|
||||||
if( rc==SQLITE_OK || rc==SQLITE_DONE ){
|
if( rc==SQLITE_OK || rc==SQLITE_DONE ){
|
||||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||||
assert( zErrmsg==0 );
|
assert( zErrmsg==0 );
|
||||||
@ -93,10 +93,10 @@ static int test_sqlite3ota_cmd(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2: /* create_ota_delta */ {
|
case 2: /* create_rbu_delta */ {
|
||||||
sqlite3 *db = sqlite3ota_db(pOta, 0);
|
sqlite3 *db = sqlite3rbu_db(pRbu, 0);
|
||||||
int rc = sqlite3_create_function(
|
int rc = sqlite3_create_function(
|
||||||
db, "ota_delta", -1, SQLITE_UTF8, (void*)interp, test_ota_delta, 0, 0
|
db, "rbu_delta", -1, SQLITE_UTF8, (void*)interp, test_rbu_delta, 0, 0
|
||||||
);
|
);
|
||||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||||
ret = (rc==SQLITE_OK ? TCL_OK : TCL_ERROR);
|
ret = (rc==SQLITE_OK ? TCL_OK : TCL_ERROR);
|
||||||
@ -112,39 +112,39 @@ static int test_sqlite3ota_cmd(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Tclcmd: sqlite3ota CMD <target-db> <ota-db> ?<state-db>?
|
** Tclcmd: sqlite3rbu CMD <target-db> <rbu-db> ?<state-db>?
|
||||||
*/
|
*/
|
||||||
static int test_sqlite3ota(
|
static int test_sqlite3rbu(
|
||||||
ClientData clientData,
|
ClientData clientData,
|
||||||
Tcl_Interp *interp,
|
Tcl_Interp *interp,
|
||||||
int objc,
|
int objc,
|
||||||
Tcl_Obj *CONST objv[]
|
Tcl_Obj *CONST objv[]
|
||||||
){
|
){
|
||||||
sqlite3ota *pOta = 0;
|
sqlite3rbu *pRbu = 0;
|
||||||
const char *zCmd;
|
const char *zCmd;
|
||||||
const char *zTarget;
|
const char *zTarget;
|
||||||
const char *zOta;
|
const char *zRbu;
|
||||||
const char *zStateDb = 0;
|
const char *zStateDb = 0;
|
||||||
|
|
||||||
if( objc!=4 && objc!=5 ){
|
if( objc!=4 && objc!=5 ){
|
||||||
Tcl_WrongNumArgs(interp, 1, objv, "NAME TARGET-DB OTA-DB ?STATE-DB?");
|
Tcl_WrongNumArgs(interp, 1, objv, "NAME TARGET-DB RBU-DB ?STATE-DB?");
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
zCmd = Tcl_GetString(objv[1]);
|
zCmd = Tcl_GetString(objv[1]);
|
||||||
zTarget = Tcl_GetString(objv[2]);
|
zTarget = Tcl_GetString(objv[2]);
|
||||||
zOta = Tcl_GetString(objv[3]);
|
zRbu = Tcl_GetString(objv[3]);
|
||||||
if( objc==5 ) zStateDb = Tcl_GetString(objv[4]);
|
if( objc==5 ) zStateDb = Tcl_GetString(objv[4]);
|
||||||
|
|
||||||
pOta = sqlite3ota_open(zTarget, zOta, zStateDb);
|
pRbu = sqlite3rbu_open(zTarget, zRbu, zStateDb);
|
||||||
Tcl_CreateObjCommand(interp, zCmd, test_sqlite3ota_cmd, (ClientData)pOta, 0);
|
Tcl_CreateObjCommand(interp, zCmd, test_sqlite3rbu_cmd, (ClientData)pRbu, 0);
|
||||||
Tcl_SetObjResult(interp, objv[1]);
|
Tcl_SetObjResult(interp, objv[1]);
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Tclcmd: sqlite3ota_create_vfs ?-default? NAME PARENT
|
** Tclcmd: sqlite3rbu_create_vfs ?-default? NAME PARENT
|
||||||
*/
|
*/
|
||||||
static int test_sqlite3ota_create_vfs(
|
static int test_sqlite3rbu_create_vfs(
|
||||||
ClientData clientData,
|
ClientData clientData,
|
||||||
Tcl_Interp *interp,
|
Tcl_Interp *interp,
|
||||||
int objc,
|
int objc,
|
||||||
@ -163,7 +163,7 @@ static int test_sqlite3ota_create_vfs(
|
|||||||
zParent = Tcl_GetString(objv[objc-1]);
|
zParent = Tcl_GetString(objv[objc-1]);
|
||||||
if( zParent[0]=='\0' ) zParent = 0;
|
if( zParent[0]=='\0' ) zParent = 0;
|
||||||
|
|
||||||
rc = sqlite3ota_create_vfs(zName, zParent);
|
rc = sqlite3rbu_create_vfs(zName, zParent);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
@ -177,9 +177,9 @@ static int test_sqlite3ota_create_vfs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Tclcmd: sqlite3ota_destroy_vfs NAME
|
** Tclcmd: sqlite3rbu_destroy_vfs NAME
|
||||||
*/
|
*/
|
||||||
static int test_sqlite3ota_destroy_vfs(
|
static int test_sqlite3rbu_destroy_vfs(
|
||||||
ClientData clientData,
|
ClientData clientData,
|
||||||
Tcl_Interp *interp,
|
Tcl_Interp *interp,
|
||||||
int objc,
|
int objc,
|
||||||
@ -193,14 +193,14 @@ static int test_sqlite3ota_destroy_vfs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
zName = Tcl_GetString(objv[1]);
|
zName = Tcl_GetString(objv[1]);
|
||||||
sqlite3ota_destroy_vfs(zName);
|
sqlite3rbu_destroy_vfs(zName);
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Tclcmd: sqlite3ota_internal_test
|
** Tclcmd: sqlite3rbu_internal_test
|
||||||
*/
|
*/
|
||||||
static int test_sqlite3ota_internal_test(
|
static int test_sqlite3rbu_internal_test(
|
||||||
ClientData clientData,
|
ClientData clientData,
|
||||||
Tcl_Interp *interp,
|
Tcl_Interp *interp,
|
||||||
int objc,
|
int objc,
|
||||||
@ -213,24 +213,24 @@ static int test_sqlite3ota_internal_test(
|
|||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
db = sqlite3ota_db(0, 0);
|
db = sqlite3rbu_db(0, 0);
|
||||||
if( db!=0 ){
|
if( db!=0 ){
|
||||||
Tcl_AppendResult(interp, "sqlite3ota_db(0, 0)!=0", 0);
|
Tcl_AppendResult(interp, "sqlite3rbu_db(0, 0)!=0", 0);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SqliteOta_Init(Tcl_Interp *interp){
|
int SqliteRbu_Init(Tcl_Interp *interp){
|
||||||
static struct {
|
static struct {
|
||||||
char *zName;
|
char *zName;
|
||||||
Tcl_ObjCmdProc *xProc;
|
Tcl_ObjCmdProc *xProc;
|
||||||
} aObjCmd[] = {
|
} aObjCmd[] = {
|
||||||
{ "sqlite3ota", test_sqlite3ota },
|
{ "sqlite3rbu", test_sqlite3rbu },
|
||||||
{ "sqlite3ota_create_vfs", test_sqlite3ota_create_vfs },
|
{ "sqlite3rbu_create_vfs", test_sqlite3rbu_create_vfs },
|
||||||
{ "sqlite3ota_destroy_vfs", test_sqlite3ota_destroy_vfs },
|
{ "sqlite3rbu_destroy_vfs", test_sqlite3rbu_destroy_vfs },
|
||||||
{ "sqlite3ota_internal_test", test_sqlite3ota_internal_test },
|
{ "sqlite3rbu_internal_test", test_sqlite3rbu_internal_test },
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
|
for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
|
||||||
@ -241,7 +241,6 @@ int SqliteOta_Init(Tcl_Interp *interp){
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
int SqliteOta_Init(Tcl_Interp *interp){ return TCL_OK; }
|
int SqliteRbu_Init(Tcl_Interp *interp){ return TCL_OK; }
|
||||||
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_OTA) */
|
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */
|
||||||
#endif /* defined(SQLITE_TEST) */
|
#endif /* defined(SQLITE_TEST) */
|
||||||
|
|
16
main.mk
16
main.mk
@ -65,7 +65,7 @@ LIBOBJ+= vdbe.o parse.o \
|
|||||||
mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
|
mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
|
||||||
notify.o opcodes.o os.o os_unix.o os_win.o \
|
notify.o opcodes.o os.o os_unix.o os_win.o \
|
||||||
pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
|
pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
|
||||||
random.o resolve.o rowset.o rtree.o select.o sqlite3ota.o status.o \
|
random.o resolve.o rowset.o rtree.o select.o sqlite3rbu.o status.o \
|
||||||
table.o threads.o tokenize.o treeview.o trigger.o \
|
table.o threads.o tokenize.o treeview.o trigger.o \
|
||||||
update.o userauth.o util.o vacuum.o \
|
update.o userauth.o util.o vacuum.o \
|
||||||
vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
|
vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
|
||||||
@ -226,8 +226,8 @@ SRC += \
|
|||||||
$(TOP)/ext/userauth/sqlite3userauth.h
|
$(TOP)/ext/userauth/sqlite3userauth.h
|
||||||
|
|
||||||
SRC += \
|
SRC += \
|
||||||
$(TOP)/ext/ota/sqlite3ota.c \
|
$(TOP)/ext/rbu/sqlite3rbu.c \
|
||||||
$(TOP)/ext/ota/sqlite3ota.h
|
$(TOP)/ext/rbu/sqlite3rbu.h
|
||||||
|
|
||||||
|
|
||||||
# Generated source code files
|
# Generated source code files
|
||||||
@ -246,7 +246,7 @@ SRC += \
|
|||||||
TESTSRC = \
|
TESTSRC = \
|
||||||
$(TOP)/ext/fts3/fts3_term.c \
|
$(TOP)/ext/fts3/fts3_term.c \
|
||||||
$(TOP)/ext/fts3/fts3_test.c \
|
$(TOP)/ext/fts3/fts3_test.c \
|
||||||
$(TOP)/ext/ota/test_ota.c \
|
$(TOP)/ext/rbu/test_rbu.c \
|
||||||
$(TOP)/src/test1.c \
|
$(TOP)/src/test1.c \
|
||||||
$(TOP)/src/test2.c \
|
$(TOP)/src/test2.c \
|
||||||
$(TOP)/src/test3.c \
|
$(TOP)/src/test3.c \
|
||||||
@ -666,8 +666,8 @@ fts5.c: $(FTS5_SRC)
|
|||||||
userauth.o: $(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
|
userauth.o: $(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
|
||||||
$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/userauth/userauth.c
|
$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/userauth/userauth.c
|
||||||
|
|
||||||
sqlite3ota.o: $(TOP)/ext/ota/sqlite3ota.c $(HDR) $(EXTHDR)
|
sqlite3rbu.o: $(TOP)/ext/rbu/sqlite3rbu.c $(HDR) $(EXTHDR)
|
||||||
$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/ota/sqlite3ota.c
|
$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/rbu/sqlite3rbu.c
|
||||||
|
|
||||||
|
|
||||||
# Rules for building test programs and for running tests
|
# Rules for building test programs and for running tests
|
||||||
@ -811,8 +811,8 @@ wordcount$(EXE): $(TOP)/test/wordcount.c sqlite3.c
|
|||||||
speedtest1$(EXE): $(TOP)/test/speedtest1.c sqlite3.o
|
speedtest1$(EXE): $(TOP)/test/speedtest1.c sqlite3.o
|
||||||
$(TCC) -I. $(OTAFLAGS) -o speedtest1$(EXE) $(TOP)/test/speedtest1.c sqlite3.o $(THREADLIB)
|
$(TCC) -I. $(OTAFLAGS) -o speedtest1$(EXE) $(TOP)/test/speedtest1.c sqlite3.o $(THREADLIB)
|
||||||
|
|
||||||
ota$(EXE): $(TOP)/ext/ota/ota.c $(TOP)/ext/ota/sqlite3ota.c sqlite3.o
|
rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.o
|
||||||
$(TCC) -I. -o ota$(EXE) $(TOP)/ext/ota/ota.c sqlite3.o \
|
$(TCC) -I. -o rbu$(EXE) $(TOP)/ext/rbu/rbu.c sqlite3.o \
|
||||||
$(THREADLIB)
|
$(THREADLIB)
|
||||||
|
|
||||||
loadfts: $(TOP)/tool/loadfts.c libsqlite3.a
|
loadfts: $(TOP)/tool/loadfts.c libsqlite3.a
|
||||||
|
70
manifest
70
manifest
@ -1,9 +1,9 @@
|
|||||||
C When\sSQLITE_OMIT_LOOKASIDE\sis\sset,\sdo\snot\sallocate\sany\slookaside\smemory\ssince\nit\swill\snever\sbe\sused.
|
C Change\sthe\sname\sof\sthe\sOTA\sextension\sto\sRBU:\s\sResumable\sBulk\sUpdate.
|
||||||
D 2015-07-23T17:16:27.642
|
D 2015-07-23T20:44:49.716
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 6b439e21d6dabede337772b85959340d37bb17bb
|
F Makefile.in b13c653ee215cb0d294ffa4f10ac4d14255767e0
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
F Makefile.msc efafcbf2be203b61dc7b6301703544753c513cb2
|
F Makefile.msc cddf142cac25c011aadd69a371399db9a8892ccd
|
||||||
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
|
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
|
||||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||||
F VERSION ce0ae95abd7121c534f6917c1c8f2b70d9acd4db
|
F VERSION ce0ae95abd7121c534f6917c1c8f2b70d9acd4db
|
||||||
@ -200,25 +200,25 @@ F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
|
|||||||
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
|
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
|
||||||
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
|
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
|
||||||
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
|
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
|
||||||
F ext/ota/ota.c 3a849c3b0a4ad6e63125668be9f67be03621216e
|
F ext/rbu/rbu.c e04e7baea76b6dd719a4f290f8a58166efc8d234 w ext/ota/ota.c
|
||||||
F ext/ota/ota1.test abdcbe746db4c7f7b51e842b576cacb33eef28f5
|
F ext/rbu/rbu1.test 57601977588603e82700a43c279bd55282ffa482 w ext/ota/ota1.test
|
||||||
F ext/ota/ota10.test 85e0f6e7964db5007590c1b299e75211ed4240d4
|
F ext/rbu/rbu10.test 046b0980041d30700464a800bbf6733ed2df515d w ext/ota/ota10.test
|
||||||
F ext/ota/ota11.test 2f606cd2b4af260a86b549e91b9f395450fc75cb
|
F ext/rbu/rbu11.test 9bc68c2d3dbeb1720153626e3bd0466dcc017702 w ext/ota/ota11.test
|
||||||
F ext/ota/ota12.test e4c0b9a14255ffbe04d241fc15da2c65b3c06846
|
F ext/rbu/rbu12.test bde22ed0004dd5d1888c72a84ae407e574aeae16 w ext/ota/ota12.test
|
||||||
F ext/ota/ota13.test f7a3d73fa5d3fabf2755b569f125fce7390a874c
|
F ext/rbu/rbu13.test 462ff799c4afedc3ef8a47ff818c0ffbf14ae4f2 w ext/ota/ota13.test
|
||||||
F ext/ota/ota3.test 3fe3521fbdce32d0e4e116a60999c3cba47712c5
|
F ext/rbu/rbu3.test 8bd4c6b87367c358981b6a47dc3d654fa60bff90 w ext/ota/ota3.test
|
||||||
F ext/ota/ota5.test ad0799daf8923ddebffe75ae8c5504ca90b7fadb
|
F ext/rbu/rbu5.test 2e24fee3e615aecd99bbdd46967935a641e866f7 w ext/ota/ota5.test
|
||||||
F ext/ota/ota6.test 3bde7f69a894748b27206b6753462ec3b75b6bb6
|
F ext/rbu/rbu6.test 32e8ed60631b6facdb6366bd2b5f5f25245e7edb w ext/ota/ota6.test
|
||||||
F ext/ota/ota7.test 1fe2c5761705374530e29f70c39693076028221a
|
F ext/rbu/rbu7.test fd025d5ba440fcfe151fbb0e3835e1e7fe964fa1 w ext/ota/ota7.test
|
||||||
F ext/ota/ota8.test cd70e63a0c29c45c0906692827deafa34638feda
|
F ext/rbu/rbu8.test 3bbf2c35d71a843c463efe93946f14ad10c3ede0 w ext/ota/ota8.test
|
||||||
F ext/ota/ota9.test d3eee95dd836824d07a22e5efcdb7bf6e869358b
|
F ext/rbu/rbu9.test 0806d1772c9f4981774ff028de6656e4183082af w ext/ota/ota9.test
|
||||||
F ext/ota/otaA.test ab67f7f53670b81c750dcc946c5b704f51c429a4
|
F ext/rbu/rbuA.test c1a7b3e2d926b8f8448bb3b4ae787e314ee4b2b3 w ext/ota/otaA.test
|
||||||
F ext/ota/otacrash.test 8346192b2d46cbe7787d5d65904d81d3262a3cbf
|
F ext/rbu/rbucrash.test 8d2ed5d4b05fef6c00c2a6b5f7ead71fa172a695 w ext/ota/otacrash.test
|
||||||
F ext/ota/otafault.test 8c43586c2b96ca16bbce00b5d7e7d67316126db8
|
F ext/rbu/rbufault.test cc0be8d5d392d98b0c2d6a51be377ea989250a89 w ext/ota/otafault.test
|
||||||
F ext/ota/otafault2.test fa202a98ca221faec318f3e5c5f39485b1256561
|
F ext/rbu/rbufault2.test 9a7f19edd6ea35c4c9f807d8a3db0a03a5670c06 w ext/ota/otafault2.test
|
||||||
F ext/ota/sqlite3ota.c 21575d86eac30482a9bfbb2a531f433015e0e03c
|
F ext/rbu/sqlite3rbu.c d37e1ca2d13e439cb3df7cd9d98db90458f21433 w ext/ota/sqlite3ota.c
|
||||||
F ext/ota/sqlite3ota.h 4c66588429338b8977f33caa4c1d026d16fc383e
|
F ext/rbu/sqlite3rbu.h 27dc1bdc18df6c9bfa3bd7d7b011699ed619d6f6 w ext/ota/sqlite3ota.h
|
||||||
F ext/ota/test_ota.c a876f88550d7d59a3ef62d4c1a5c04c4c2f1ebe1
|
F ext/rbu/test_rbu.c f99698956cc9158d6bf865e461e2d15876538ac1 w ext/ota/test_ota.c
|
||||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||||
F ext/rtree/rtree.c 0f9b595bd0debcbedf1d7a63d0e0678d619e6c9c
|
F ext/rtree/rtree.c 0f9b595bd0debcbedf1d7a63d0e0678d619e6c9c
|
||||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||||
@ -248,7 +248,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
|
|||||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||||
F main.mk 7f0c666075028f306001ec9e883cf20dcb2deb64
|
F main.mk 4affd40e93db8e0063c2a0768c1887b3e2a272a1
|
||||||
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
|
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
|
||||||
F mkopcodeh.awk 0e7f04a8eb90f92259e47d80110e4e98d7ce337a
|
F mkopcodeh.awk 0e7f04a8eb90f92259e47d80110e4e98d7ce337a
|
||||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||||
@ -329,14 +329,14 @@ F src/resolve.c 2d47554370de8de6dd5be060cef9559eec315005
|
|||||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||||
F src/select.c 57ef3d98c4400b93eea318813be41b2af2da2217
|
F src/select.c 57ef3d98c4400b93eea318813be41b2af2da2217
|
||||||
F src/shell.c 8af3cced094aebb5f57a8ad739b9dafc7867eed7
|
F src/shell.c 8af3cced094aebb5f57a8ad739b9dafc7867eed7
|
||||||
F src/sqlite.h.in 3d951bf985839de7fcf4d3f69568bb4df2641abe
|
F src/sqlite.h.in ae2a0ceb9d65880437d56dfa9bd9ed1af7d36fce
|
||||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||||
F src/sqlite3ext.h be1a718b7d2ce40ceba725ae92c8eb5f18003066
|
F src/sqlite3ext.h be1a718b7d2ce40ceba725ae92c8eb5f18003066
|
||||||
F src/sqliteInt.h c67d0a1368484dd156e7d13caa62862adc2ebefa
|
F src/sqliteInt.h c67d0a1368484dd156e7d13caa62862adc2ebefa
|
||||||
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
||||||
F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179
|
F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179
|
||||||
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
||||||
F src/tclsqlite.c 13b9c2aa725882de807377fa889682eff2a74114
|
F src/tclsqlite.c d9439b6a910985b7fff43ba6756bcef00de22649
|
||||||
F src/test1.c 375d7bd56d9f806095deb91a3dafe61bd0e367c8
|
F src/test1.c 375d7bd56d9f806095deb91a3dafe61bd0e367c8
|
||||||
F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d
|
F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d
|
||||||
F src/test3.c 64d2afdd68feac1bb5e2ffb8226c8c639f798622
|
F src/test3.c 64d2afdd68feac1bb5e2ffb8226c8c639f798622
|
||||||
@ -351,7 +351,7 @@ F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12
|
|||||||
F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803
|
F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803
|
||||||
F src/test_blob.c e5a7a81d61a780da79101aeb1e60d300af169e07
|
F src/test_blob.c e5a7a81d61a780da79101aeb1e60d300af169e07
|
||||||
F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
|
F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
|
||||||
F src/test_config.c b14036415582c329d2a7b154ce079e0f623113ce
|
F src/test_config.c fb2e5d354d9a077f5fbb261652eff4787deb104f
|
||||||
F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852
|
F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852
|
||||||
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
||||||
F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f
|
F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f
|
||||||
@ -889,7 +889,6 @@ F test/orderby6.test 8b38138ab0972588240b3fca0985d2e400432859
|
|||||||
F test/orderby7.test 3d1383d52ade5b9eb3a173b3147fdd296f0202da
|
F test/orderby7.test 3d1383d52ade5b9eb3a173b3147fdd296f0202da
|
||||||
F test/orderby8.test 23ef1a5d72bd3adcc2f65561c654295d1b8047bd
|
F test/orderby8.test 23ef1a5d72bd3adcc2f65561c654295d1b8047bd
|
||||||
F test/oserror.test 14fec2796c2b6fe431c7823750e8a18a761176d7
|
F test/oserror.test 14fec2796c2b6fe431c7823750e8a18a761176d7
|
||||||
F test/ota.test 3a8d97cbf8f7210dc6a638797c4e4cd674036927
|
|
||||||
F test/ovfl.test 4f7ca651cba5c059a12d8c67dddd49bec5747799
|
F test/ovfl.test 4f7ca651cba5c059a12d8c67dddd49bec5747799
|
||||||
F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa
|
F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa
|
||||||
F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71
|
F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71
|
||||||
@ -903,7 +902,7 @@ F test/pagesize.test 5769fc62d8c890a83a503f67d47508dfdc543305
|
|||||||
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||||
F test/pcache2.test c70d92547550136ba6f818e6a44fe246d2738604
|
F test/pcache2.test c70d92547550136ba6f818e6a44fe246d2738604
|
||||||
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
||||||
F test/permutations.test 6a88fd9ca15b804e9c20990773262ca67494058f
|
F test/permutations.test 04004bd977f66c064f27e6d18edadce486cf5074
|
||||||
F test/pragma.test be7195f0aa72bdb8a512133e9640ac40f15b57a2
|
F test/pragma.test be7195f0aa72bdb8a512133e9640ac40f15b57a2
|
||||||
F test/pragma2.test f624a496a95ee878e81e59961eade66d5c00c028
|
F test/pragma2.test f624a496a95ee878e81e59961eade66d5c00c028
|
||||||
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
|
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
|
||||||
@ -919,10 +918,11 @@ F test/quota2.test 7dc12e08b11cbc4c16c9ba2aa2e040ea8d8ab4b8
|
|||||||
F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
|
F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
|
||||||
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
|
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
|
||||||
F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
|
F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
|
||||||
|
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 w test/ota.test
|
||||||
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
||||||
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
||||||
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
||||||
F test/releasetest.tcl 2aaffa548a8f8d10053b20bcf68a1b5a01081e51
|
F test/releasetest.tcl 8eb718bca8bca71c0c0145384f9915bb7e53fca3
|
||||||
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
||||||
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
||||||
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
|
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
|
||||||
@ -1006,7 +1006,7 @@ F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523
|
|||||||
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
|
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
|
||||||
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
|
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
|
||||||
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
|
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
|
||||||
F test/speedtest1.c 54f211994e2fb5b3f7c5c82137378f46ca89aae8
|
F test/speedtest1.c 857439869d1cb4db35e1c720ee9c2756eb9ea2a0
|
||||||
F test/spellfix.test 0597065ff57042df1f138e6a2611ae19c2698135
|
F test/spellfix.test 0597065ff57042df1f138e6a2611ae19c2698135
|
||||||
F test/sqldiff1.test 8f6bc7c6a5b3585d350d779c6078869ba402f8f5
|
F test/sqldiff1.test 8f6bc7c6a5b3585d350d779c6078869ba402f8f5
|
||||||
F test/sqllimits1.test e05786eaed7950ff6a2d00031d001d8a26131e68
|
F test/sqllimits1.test e05786eaed7950ff6a2d00031d001d8a26131e68
|
||||||
@ -1330,7 +1330,7 @@ F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
|||||||
F tool/mkpragmatab.tcl 84af2b180484323a2ea22a2279e8bd9e3e1e492e
|
F tool/mkpragmatab.tcl 84af2b180484323a2ea22a2279e8bd9e3e1e492e
|
||||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||||
F tool/mksqlite3c-noext.tcl 87240b09c20042999b41d5fabe091b7111287835
|
F tool/mksqlite3c-noext.tcl 87240b09c20042999b41d5fabe091b7111287835
|
||||||
F tool/mksqlite3c.tcl f29898d34f1dcd77ccc4e6fd7dcc2f9ebb54622f
|
F tool/mksqlite3c.tcl 421ecbd437d8cd7123e67430ee8146218396680d
|
||||||
F tool/mksqlite3h.tcl 44730d586c9031638cdd2eb443b801c0d2dbd9f8
|
F tool/mksqlite3h.tcl 44730d586c9031638cdd2eb443b801c0d2dbd9f8
|
||||||
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
||||||
F tool/mkvsix.tcl 3b58b9398f91c7dbf18d49eb87cefeee9efdbce1
|
F tool/mkvsix.tcl 3b58b9398f91c7dbf18d49eb87cefeee9efdbce1
|
||||||
@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 793e206f9032d9205bdb3f447b136bed9a25fa22
|
P 0ffd499f2374f2b191080b9952acfed56daf3335
|
||||||
R 9158ac1eaf08b6ce5d701ee4b9a1ddba
|
R 9a40f6298bbd05e21325ac6bd7e21602
|
||||||
U drh
|
U drh
|
||||||
Z 6817e7006180b52519c297d18e3556cf
|
Z 01b794dd6ae3d5a3e200b05a3bea889a
|
||||||
|
@ -1 +1 @@
|
|||||||
0ffd499f2374f2b191080b9952acfed56daf3335
|
017c5019e1ce042025d4f327e50ec50af49f9fa4
|
@ -967,9 +967,9 @@ struct sqlite3_io_methods {
|
|||||||
** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
|
** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
|
||||||
** VFS should return SQLITE_NOTFOUND for this opcode.
|
** VFS should return SQLITE_NOTFOUND for this opcode.
|
||||||
**
|
**
|
||||||
** <li>[[SQLITE_FCNTL_OTA]]
|
** <li>[[SQLITE_FCNTL_RBU]]
|
||||||
** The [SQLITE_FCNTL_OTA] opcode is implemented by the special VFS used by
|
** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
|
||||||
** the OTA extension only. All other VFS should return SQLITE_NOTFOUND for
|
** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
|
||||||
** this opcode.
|
** this opcode.
|
||||||
** </ul>
|
** </ul>
|
||||||
*/
|
*/
|
||||||
@ -997,7 +997,7 @@ struct sqlite3_io_methods {
|
|||||||
#define SQLITE_FCNTL_WIN32_SET_HANDLE 23
|
#define SQLITE_FCNTL_WIN32_SET_HANDLE 23
|
||||||
#define SQLITE_FCNTL_WAL_BLOCK 24
|
#define SQLITE_FCNTL_WAL_BLOCK 24
|
||||||
#define SQLITE_FCNTL_ZIPVFS 25
|
#define SQLITE_FCNTL_ZIPVFS 25
|
||||||
#define SQLITE_FCNTL_OTA 26
|
#define SQLITE_FCNTL_RBU 26
|
||||||
|
|
||||||
/* deprecated names */
|
/* deprecated names */
|
||||||
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
||||||
|
@ -3761,7 +3761,7 @@ static void init_all(Tcl_Interp *interp){
|
|||||||
extern int SqliteSuperlock_Init(Tcl_Interp*);
|
extern int SqliteSuperlock_Init(Tcl_Interp*);
|
||||||
extern int SqlitetestSyscall_Init(Tcl_Interp*);
|
extern int SqlitetestSyscall_Init(Tcl_Interp*);
|
||||||
extern int Fts5tcl_Init(Tcl_Interp *);
|
extern int Fts5tcl_Init(Tcl_Interp *);
|
||||||
extern int SqliteOta_Init(Tcl_Interp*);
|
extern int SqliteRbu_Init(Tcl_Interp*);
|
||||||
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
||||||
extern int Sqlitetestfts3_Init(Tcl_Interp *interp);
|
extern int Sqlitetestfts3_Init(Tcl_Interp *interp);
|
||||||
#endif
|
#endif
|
||||||
@ -3805,7 +3805,7 @@ static void init_all(Tcl_Interp *interp){
|
|||||||
SqliteSuperlock_Init(interp);
|
SqliteSuperlock_Init(interp);
|
||||||
SqlitetestSyscall_Init(interp);
|
SqlitetestSyscall_Init(interp);
|
||||||
Fts5tcl_Init(interp);
|
Fts5tcl_Init(interp);
|
||||||
SqliteOta_Init(interp);
|
SqliteRbu_Init(interp);
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
||||||
Sqlitetestfts3_Init(interp);
|
Sqlitetestfts3_Init(interp);
|
||||||
|
@ -436,10 +436,10 @@ Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
|
|||||||
Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_OTA
|
#ifdef SQLITE_ENABLE_RBU
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "ota", "1", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY);
|
||||||
#else
|
#else
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "ota", "0", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SQLITE_OMIT_PAGER_PRAGMAS
|
#ifdef SQLITE_OMIT_PAGER_PRAGMAS
|
||||||
|
@ -113,7 +113,7 @@ set allquicktests [test_set $alltests -exclude {
|
|||||||
vtab_err.test walslow.test walcrash.test walcrash3.test
|
vtab_err.test walslow.test walcrash.test walcrash3.test
|
||||||
walthread.test rtree3.test indexfault.test securedel2.test
|
walthread.test rtree3.test indexfault.test securedel2.test
|
||||||
sort3.test sort4.test fts4growth.test fts4growth2.test
|
sort3.test sort4.test fts4growth.test fts4growth2.test
|
||||||
bigsort.test ota.test
|
bigsort.test rbu.test
|
||||||
}]
|
}]
|
||||||
if {[info exists ::env(QUICKTEST_INCLUDE)]} {
|
if {[info exists ::env(QUICKTEST_INCLUDE)]} {
|
||||||
set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
|
set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
|
||||||
@ -962,10 +962,10 @@ test_suite "rtree" -description {
|
|||||||
All R-tree related tests. Provides coverage of source file rtree.c.
|
All R-tree related tests. Provides coverage of source file rtree.c.
|
||||||
} -files [glob -nocomplain $::testdir/../ext/rtree/*.test]
|
} -files [glob -nocomplain $::testdir/../ext/rtree/*.test]
|
||||||
|
|
||||||
test_suite "ota" -description {
|
test_suite "rbu" -description {
|
||||||
OTA tests.
|
RBU tests.
|
||||||
} -files [
|
} -files [
|
||||||
test_set [glob -nocomplain $::testdir/../ext/ota/*.test] -exclude ota.test
|
test_set [glob -nocomplain $::testdir/../ext/rbu/*.test] -exclude rbu.test
|
||||||
]
|
]
|
||||||
|
|
||||||
test_suite "no_optimization" -description {
|
test_suite "no_optimization" -description {
|
||||||
|
@ -5,14 +5,13 @@
|
|||||||
# May you share freely, never taking more than you give.
|
# May you share freely, never taking more than you give.
|
||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# This file runs all rtree related tests.
|
# This file runs all RBU related tests.
|
||||||
#
|
#
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/permutations.test
|
source $testdir/permutations.test
|
||||||
|
|
||||||
ifcapable !ota { finish_test ; return }
|
ifcapable !rbu { finish_test ; return }
|
||||||
|
|
||||||
run_test_suite ota
|
run_test_suite rbu
|
||||||
finish_test
|
finish_test
|
||||||
|
|
@ -116,7 +116,7 @@ array set ::Configs [strip_comments {
|
|||||||
-DSQLITE_ENABLE_FTS4=1
|
-DSQLITE_ENABLE_FTS4=1
|
||||||
-DSQLITE_ENABLE_RTREE=1
|
-DSQLITE_ENABLE_RTREE=1
|
||||||
-DSQLITE_ENABLE_STAT4
|
-DSQLITE_ENABLE_STAT4
|
||||||
-DSQLITE_ENABLE_OTA
|
-DSQLITE_ENABLE_RBU
|
||||||
-DSQLITE_MAX_ATTACHED=125
|
-DSQLITE_MAX_ATTACHED=125
|
||||||
}
|
}
|
||||||
"Device-One" {
|
"Device-One" {
|
||||||
|
@ -51,8 +51,8 @@ static const char zHelp[] =
|
|||||||
#if SQLITE_VERSION_NUMBER<3005000
|
#if SQLITE_VERSION_NUMBER<3005000
|
||||||
# define sqlite3_int64 sqlite_int64
|
# define sqlite3_int64 sqlite_int64
|
||||||
#endif
|
#endif
|
||||||
#ifdef SQLITE_ENABLE_OTA
|
#ifdef SQLITE_ENABLE_RBU
|
||||||
# include "sqlite3ota.h"
|
# include "sqlite3rbu.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* All global state is held in this structure */
|
/* All global state is held in this structure */
|
||||||
@ -1240,10 +1240,10 @@ int main(int argc, char **argv){
|
|||||||
noSync = 1;
|
noSync = 1;
|
||||||
}else if( strcmp(z,"notnull")==0 ){
|
}else if( strcmp(z,"notnull")==0 ){
|
||||||
g.zNN = "NOT NULL";
|
g.zNN = "NOT NULL";
|
||||||
#ifdef SQLITE_ENABLE_OTA
|
#ifdef SQLITE_ENABLE_RBU
|
||||||
}else if( strcmp(z,"ota")==0 ){
|
}else if( strcmp(z,"rbu")==0 ){
|
||||||
sqlite3ota_create_vfs("ota", 0);
|
sqlite3ota_create_vfs("rbu", 0);
|
||||||
sqlite3_vfs_register(sqlite3_vfs_find("ota"), 1);
|
sqlite3_vfs_register(sqlite3_vfs_find("rbu"), 1);
|
||||||
#endif
|
#endif
|
||||||
}else if( strcmp(z,"pagesize")==0 ){
|
}else if( strcmp(z,"pagesize")==0 ){
|
||||||
if( i>=argc-1 ) fatal_error("missing argument on %s\n", argv[i]);
|
if( i>=argc-1 ) fatal_error("missing argument on %s\n", argv[i]);
|
||||||
|
@ -113,7 +113,7 @@ foreach hdr {
|
|||||||
rtree.h
|
rtree.h
|
||||||
sqlite3.h
|
sqlite3.h
|
||||||
sqlite3ext.h
|
sqlite3ext.h
|
||||||
sqlite3ota.h
|
sqlite3rbu.h
|
||||||
sqliteicu.h
|
sqliteicu.h
|
||||||
sqliteInt.h
|
sqliteInt.h
|
||||||
sqliteLimit.h
|
sqliteLimit.h
|
||||||
@ -219,7 +219,7 @@ proc copy_file {filename} {
|
|||||||
regsub {^SQLITE_API } $line {} line
|
regsub {^SQLITE_API } $line {} line
|
||||||
# Add the SQLITE_PRIVATE or SQLITE_API keyword before functions.
|
# Add the SQLITE_PRIVATE or SQLITE_API keyword before functions.
|
||||||
# so that linkage can be modified at compile-time.
|
# so that linkage can be modified at compile-time.
|
||||||
if {[regexp {^sqlite3(_|ota_)} $funcname]} {
|
if {[regexp {^sqlite3(_|rbu_)} $funcname]} {
|
||||||
set line SQLITE_API
|
set line SQLITE_API
|
||||||
append line " " [string trim $rettype]
|
append line " " [string trim $rettype]
|
||||||
if {[string index $rettype end] ne "*"} {
|
if {[string index $rettype end] ne "*"} {
|
||||||
@ -376,7 +376,7 @@ foreach file {
|
|||||||
rtree.c
|
rtree.c
|
||||||
icu.c
|
icu.c
|
||||||
fts3_icu.c
|
fts3_icu.c
|
||||||
sqlite3ota.c
|
sqlite3rbu.c
|
||||||
dbstat.c
|
dbstat.c
|
||||||
} {
|
} {
|
||||||
copy_file tsrc/$file
|
copy_file tsrc/$file
|
||||||
|
Reference in New Issue
Block a user