xref: /sqlite-3.40.0/test/vtab_err.test (revision a1644fd8)
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#
12# $Id: vtab_err.test,v 1.7 2007/08/29 12:31:29 danielk1977 Exp $
13
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16
17source $testdir/malloc_common.tcl
18
19ifcapable !vtab {
20  finish_test
21  return
22}
23
24unset -nocomplain echo_module_begin_fail
25do_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
43do_malloc_test vtab_err-2 -tclprep {
44  register_echo_module [sqlite3_connection_pointer db]
45} -sqlbody {
46  BEGIN;
47  CREATE TABLE r(a PRIMARY KEY, b, c);
48  CREATE VIRTUAL TABLE e USING echo(r);
49  INSERT INTO e VALUES(1, 2, 3);
50  INSERT INTO e VALUES('a', 'b', 'c');
51  UPDATE e SET c = 10;
52  DELETE FROM e WHERE a = 'a';
53  COMMIT;
54  BEGIN;
55    CREATE TABLE r2(a, b, c);
56    INSERT INTO r2 SELECT * FROM e;
57    INSERT INTO e SELECT a||'x', b, c FROM r2;
58  COMMIT;
59}
60
61sqlite3_memdebug_fail -1
62
63finish_test
64