Remove the MySQL upsert syntax. As an optional alias to the insert table
[sqlite.git] / test / incrblobfault.test
blob10c2c8ecb479805f234a199ca5f034495ee672f5
1 # 2010 October 26
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
6 #    May you do good and not evil.
7 #    May you find forgiveness for yourself and forgive others.
8 #    May you share freely, never taking more than you give.
10 #***********************************************************************
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
17 set testprefix incrblobfault
19 do_execsql_test 1.0 {
20   CREATE TABLE blob(x INTEGER PRIMARY KEY, v BLOB);
21   INSERT INTO blob VALUES(1, 'hello world');
22   INSERT INTO blob VALUES(2, 'world hello');
23   INSERT INTO blob SELECT NULL, v FROM blob;
24   INSERT INTO blob SELECT NULL, v FROM blob;
25   INSERT INTO blob SELECT NULL, v FROM blob;
26   INSERT INTO blob SELECT NULL, v FROM blob;
27   INSERT INTO blob SELECT NULL, v FROM blob;
28   INSERT INTO blob SELECT NULL, v FROM blob;
29   INSERT INTO blob SELECT NULL, v FROM blob;
30   INSERT INTO blob SELECT NULL, v FROM blob;
31   INSERT INTO blob SELECT NULL, v FROM blob;
32   INSERT INTO blob SELECT NULL, v FROM blob;
35 do_faultsim_test 1 -prep {
36   sqlite3 db test.db
37   set ::blob [db incrblob blob v 1]
38 } -body {
39   if {[catch {sqlite3_blob_reopen $::blob 1000}]} {
40     error [sqlite3_errmsg db]
41   }
42 } -test {
43   faultsim_test_result {0 {}}
44   close $::blob
47 do_faultsim_test 2 -prep {
48   sqlite3 db test.db
49   set ::blob [db incrblob blob v 1]
50 } -body {
51   if {[catch {sqlite3_blob_reopen $::blob -1}]} {
52     error [sqlite3_errmsg db]
53   }
54 } -test {
55   faultsim_test_result {1 {no such rowid: -1}} {1 {disk I/O error}}
56   close $::blob
59 do_faultsim_test 3 -prep {
60   sqlite3 db test.db
61 } -body {
62   set ::blob [db incrblob blob v 1]
63   gets $::blob
64 } -test {
65   faultsim_test_result {0 {hello world}}
66   catch { close $::blob }
69 finish_test