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 e346029f92f6b8300aae73680cf593641ec149c2..49e64476ebb5f5698d175185d8f566e331b2bbd5 100644 |
--- a/third_party/sqlite/src/test/capi3d.test |
+++ b/third_party/sqlite/src/test/capi3d.test |
@@ -10,7 +10,8 @@ |
#*********************************************************************** |
# This file implements regression tests for SQLite library. |
# |
-# This file is devoted to testing the sqlite3_next_stmt interface. |
+# This file is devoted to testing the sqlite3_next_stmt and |
+# sqlite3_stmt_readonly interfaces. |
# |
# $Id: capi3d.test,v 1.2 2008/07/14 15:11:20 drh Exp $ |
# |
@@ -88,6 +89,28 @@ for {set i 1} {$i<=100} {incr i} { |
sqlite3_next_stmt db 0 |
} {} |
} |
- |
+ |
+# Tests for the is-read-only interface. |
+# |
+proc test_is_readonly {testname sql truth} { |
+ do_test $testname [format { |
+ set DB [sqlite3_connection_pointer db] |
+ set STMT [sqlite3_prepare $DB {%s} -1 TAIL] |
+ set rc [sqlite3_stmt_readonly $STMT] |
+ sqlite3_finalize $STMT |
+ set rc |
+ } $sql] $truth |
+} |
+ |
+test_is_readonly capi3d-2.1 {SELECT * FROM sqlite_master} 1 |
+test_is_readonly capi3d-2.2 {CREATE TABLE t1(x)} 0 |
+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 |
+do_test capi3-2.99 { |
+ sqlite3_stmt_readonly 0 |
+} 1 |
+ |
finish_test |