vtab_err.test 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.8 2007/09/03 16:12:10 drh Exp $
  13. set testdir [file dirname $argv0]
  14. source $testdir/tester.tcl
  15. ifcapable !vtab {
  16. finish_test
  17. return
  18. }
  19. unset -nocomplain echo_module_begin_fail
  20. do_ioerr_test vtab_err-1 -tclprep {
  21. register_echo_module [sqlite3_connection_pointer db]
  22. } -sqlbody {
  23. BEGIN;
  24. CREATE TABLE r(a PRIMARY KEY, b, c);
  25. CREATE VIRTUAL TABLE e USING echo(r);
  26. INSERT INTO e VALUES(1, 2, 3);
  27. INSERT INTO e VALUES('a', 'b', 'c');
  28. UPDATE e SET c = 10;
  29. DELETE FROM e WHERE a = 'a';
  30. COMMIT;
  31. BEGIN;
  32. CREATE TABLE r2(a, b, c);
  33. INSERT INTO r2 SELECT * FROM e;
  34. INSERT INTO e SELECT a||'x', b, c FROM r2;
  35. COMMIT;
  36. }
  37. ifcapable !memdebug {
  38. puts "Skipping vtab_err-2 tests: not compiled with -DSQLITE_MEMDEBUG..."
  39. finish_test
  40. return
  41. }
  42. source $testdir/malloc_common.tcl
  43. do_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. sqlite3_memdebug_fail -1
  61. finish_test