danielk1977 | a298e90 | 2006-06-22 09:53:48 +0000 | [diff] [blame] | 1 | # 2006 June 10 |
| 2 | # |
| 3 | # The author disclaims copyright to this source code. In place of |
| 4 | # a legal notice, here is a blessing: |
| 5 | # |
| 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. |
| 9 | # |
| 10 | #*********************************************************************** |
| 11 | # |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 12 | # $Id: vtab_err.test,v 1.8 2007/09/03 16:12:10 drh Exp $ |
danielk1977 | a298e90 | 2006-06-22 09:53:48 +0000 | [diff] [blame] | 13 | |
| 14 | set testdir [file dirname $argv0] |
| 15 | source $testdir/tester.tcl |
| 16 | |
| 17 | ifcapable !vtab { |
| 18 | finish_test |
| 19 | return |
| 20 | } |
| 21 | |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 22 | |
| 23 | |
drh | 73bdf07 | 2006-08-15 14:21:16 +0000 | [diff] [blame] | 24 | unset -nocomplain echo_module_begin_fail |
danielk1977 | a298e90 | 2006-06-22 09:53:48 +0000 | [diff] [blame] | 25 | do_ioerr_test vtab_err-1 -tclprep { |
| 26 | register_echo_module [sqlite3_connection_pointer db] |
| 27 | } -sqlbody { |
| 28 | BEGIN; |
| 29 | CREATE TABLE r(a PRIMARY KEY, b, c); |
| 30 | CREATE VIRTUAL TABLE e USING echo(r); |
| 31 | INSERT INTO e VALUES(1, 2, 3); |
| 32 | INSERT INTO e VALUES('a', 'b', 'c'); |
| 33 | UPDATE e SET c = 10; |
| 34 | DELETE FROM e WHERE a = 'a'; |
| 35 | COMMIT; |
| 36 | BEGIN; |
| 37 | CREATE TABLE r2(a, b, c); |
| 38 | INSERT INTO r2 SELECT * FROM e; |
| 39 | INSERT INTO e SELECT a||'x', b, c FROM r2; |
| 40 | COMMIT; |
| 41 | } |
| 42 | |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 43 | ifcapable !memdebug { |
| 44 | puts "Skipping vtab_err-2 tests: not compiled with -DSQLITE_MEMDEBUG..." |
| 45 | finish_test |
| 46 | return |
| 47 | } |
| 48 | source $testdir/malloc_common.tcl |
| 49 | |
| 50 | |
danielk1977 | a1644fd | 2007-08-29 12:31:25 +0000 | [diff] [blame] | 51 | do_malloc_test vtab_err-2 -tclprep { |
danielk1977 | be71889 | 2006-06-23 08:05:19 +0000 | [diff] [blame] | 52 | register_echo_module [sqlite3_connection_pointer db] |
| 53 | } -sqlbody { |
| 54 | BEGIN; |
| 55 | CREATE TABLE r(a PRIMARY KEY, b, c); |
| 56 | CREATE VIRTUAL TABLE e USING echo(r); |
| 57 | INSERT INTO e VALUES(1, 2, 3); |
| 58 | INSERT INTO e VALUES('a', 'b', 'c'); |
| 59 | UPDATE e SET c = 10; |
| 60 | DELETE FROM e WHERE a = 'a'; |
| 61 | COMMIT; |
| 62 | BEGIN; |
| 63 | CREATE TABLE r2(a, b, c); |
| 64 | INSERT INTO r2 SELECT * FROM e; |
| 65 | INSERT INTO e SELECT a||'x', b, c FROM r2; |
| 66 | COMMIT; |
| 67 | } |
| 68 | |
danielk1977 | a1644fd | 2007-08-29 12:31:25 +0000 | [diff] [blame] | 69 | sqlite3_memdebug_fail -1 |
danielk1977 | 222a757 | 2007-08-25 13:37:48 +0000 | [diff] [blame] | 70 | |
danielk1977 | a298e90 | 2006-06-22 09:53:48 +0000 | [diff] [blame] | 71 | finish_test |