intckbusy.test 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # 2024 February 24
  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. source [file join [file dirname [info script]] intck_common.tcl]
  13. set testprefix intckbusy
  14. return_if_no_intck
  15. do_execsql_test 1.0 {
  16. CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
  17. INSERT INTO t1 VALUES(1, 2, 3);
  18. INSERT INTO t1 VALUES(2, 'two', 'three');
  19. INSERT INTO t1 VALUES(3, NULL, NULL);
  20. CREATE INDEX i1 ON t1(b, c);
  21. }
  22. sqlite3 db2 test.db
  23. do_execsql_test -db db2 1.1 {
  24. BEGIN EXCLUSIVE;
  25. INSERT INTO t1 VALUES(4, 5, 6);
  26. }
  27. do_test 1.2 {
  28. set ic [sqlite3_intck db main]
  29. $ic step
  30. } {SQLITE_BUSY}
  31. do_test 1.3 {
  32. $ic unlock
  33. } {SQLITE_BUSY}
  34. do_test 1.4 {
  35. $ic error
  36. } {SQLITE_BUSY {database is locked}}
  37. do_test 1.4 {
  38. $ic close
  39. } {}
  40. finish_test