Index: third_party/sqlite/src/test/capi3d.test |
diff --git a/third_party/sqlite/src/test/capi3d.test b/third_party/sqlite/src/test/capi3d.test |
index 49e64476ebb5f5698d175185d8f566e331b2bbd5..fb8abe86d24284d5677e804c8e627c8642949735 100644 |
--- a/third_party/sqlite/src/test/capi3d.test |
+++ b/third_party/sqlite/src/test/capi3d.test |
@@ -11,7 +11,7 @@ |
# This file implements regression tests for SQLite library. |
# |
# This file is devoted to testing the sqlite3_next_stmt and |
-# sqlite3_stmt_readonly interfaces. |
+# sqlite3_stmt_readonly and sqlite3_stmt_busy interfaces. |
# |
# $Id: capi3d.test,v 1.2 2008/07/14 15:11:20 drh Exp $ |
# |
@@ -108,9 +108,77 @@ db eval {CREATE TABLE t1(x)} |
test_is_readonly capi3d-2.3 {INSERT INTO t1 VALUES(5)} 0 |
test_is_readonly capi3d-2.4 {UPDATE t1 SET x=x+1 WHERE x<0} 0 |
test_is_readonly capi3d-2.5 {SELECT * FROM t1} 1 |
+ifcapable wal { |
+ test_is_readonly capi3d-2.6 {PRAGMA journal_mode=WAL} 0 |
+ test_is_readonly capi3d-2.7 {PRAGMA wal_checkpoint} 0 |
+} |
+test_is_readonly capi3d-2.8 {PRAGMA application_id=1234} 0 |
+test_is_readonly capi3d-2.9 {VACUUM} 0 |
+test_is_readonly capi3d-2.10 {PRAGMA integrity_check} 1 |
do_test capi3-2.99 { |
sqlite3_stmt_readonly 0 |
} 1 |
+# Tests for sqlite3_stmt_busy |
+# |
+do_test capi3d-3.1 { |
+ db eval {INSERT INTO t1 VALUES(6); INSERT INTO t1 VALUES(7);} |
+ set STMT [sqlite3_prepare db {SELECT * FROM t1} -1 TAIL] |
+ sqlite3_stmt_busy $STMT |
+} {0} |
+do_test capi3d-3.2 { |
+ sqlite3_step $STMT |
+ sqlite3_stmt_busy $STMT |
+} {1} |
+do_test capi3d-3.3 { |
+ sqlite3_step $STMT |
+ sqlite3_stmt_busy $STMT |
+} {1} |
+do_test capi3d-3.4 { |
+ sqlite3_reset $STMT |
+ sqlite3_stmt_busy $STMT |
+} {0} |
+ |
+do_test capi3d-3.99 { |
+ sqlite3_finalize $STMT |
+ sqlite3_stmt_busy 0 |
+} {0} |
+ |
+#-------------------------------------------------------------------------- |
+# Test the sqlite3_stmt_busy() function with ROLLBACK statements. |
+# |
+reset_db |
+ |
+do_execsql_test capi3d-4.1 { |
+ CREATE TABLE t4(x,y); |
+ BEGIN; |
+} |
+ |
+do_test capi3d-4.2.1 { |
+ breakpoint |
+ set ::s1 [sqlite3_prepare_v2 db "ROLLBACK" -1 notused] |
+ sqlite3_step $::s1 |
+} {SQLITE_DONE} |
+ |
+do_test capi3d-4.2.2 { |
+ sqlite3_stmt_busy $::s1 |
+} {1} |
+ |
+do_catchsql_test capi3d-4.2.3 { |
+ VACUUM |
+} {1 {cannot VACUUM - SQL statements in progress}} |
+ |
+do_test capi3d-4.2.4 { |
+ sqlite3_reset $::s1 |
+} {SQLITE_OK} |
+ |
+do_catchsql_test capi3d-4.2.5 { |
+ VACUUM |
+} {0 {}} |
+ |
+do_test capi3d-4.2.6 { |
+ sqlite3_finalize $::s1 |
+} {SQLITE_OK} |
+ |
finish_test |