SQLite

Artifact [feba6072af]
Login

Artifact feba6072af04bc4bee192f7576aac60cef6a4727:


# 2014 October 21
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file contains tests for the OTA module. Specifically, it tests the
# that affinities are correctly applied to values within the OTA database.
#

if {![info exists testdir]} {
  set testdir [file join [file dirname [info script]] .. .. test]
}
source $testdir/tester.tcl
set ::testprefix ota7

do_test 1.0 {
  execsql {
    CREATE TABLE t1(a INT PRIMARY KEY, b) WITHOUT ROWID;
    INSERT INTO t1 VALUES(1, 'abc');
    INSERT INTO t1 VALUES(2, 'def');
  }

  forcedelete ota.db
  sqlite3 ota ota.db
  ota eval {
    CREATE TABLE data_t1(a, b, ota_control);
    INSERT INTO data_t1 VALUES('1', NULL, 1);
  }
  ota close
} {}

do_test 1.1 {
  sqlite3ota ota test.db ota.db
  while { [ota step]=="SQLITE_OK" } {}
  ota close
} {SQLITE_DONE}

sqlite3 db test.db
do_execsql_test 1.2 {
  SELECT * FROM t1
} {2 def}

finish_test