*** DRAFT ***

SQLite Requirement Matrix Details
stmt_readonly.html

Index Summary Markup Original


R-23332-64992-62836-09715-29451-35524-14907-15195 tcl slt th3 src

The sqlite3_stmt_readonly(X) interface returns true (non-zero) if and only if the prepared statement X makes no direct changes to the content of the database file.

tcl/capi3d.test:125   th3/cov1/vdbeapi14.test:34

/* IMP: R-23332-64992 */
# EVIDENCE-OF: R-23332-64992 The sqlite3_stmt_readonly(X) interface
# returns true (non-zero) if and only if the prepared statement X makes
# no direct changes to the content of the database file.

R-21769-42523-56036-07125-49513-08938-03164-12762 tcl slt th3 src

For example, if an application defines a function "eval()" that calls sqlite3_exec(), then the following SQL statement would change the database file through side-effects:

SELECT eval('DELETE FROM t1') FROM t2;

But because the SELECT statement does not change the database file directly, sqlite3_stmt_readonly() would still return true.

tcl/capi3d.test:198   th3/cov1/vdbeapi14.test:109

/* IMP: R-21769-42523 */
# EVIDENCE-OF: R-21769-42523 For example, if an application defines a
# function "eval()" that calls sqlite3_exec(), then the following SQL
# statement would change the database file through side-effects: SELECT
# eval('DELETE FROM t1') FROM t2; But because the SELECT statement does
# not change the database file directly, sqlite3_stmt_readonly() would
# still return true.

R-07474-04783-61557-15842-18544-20982-63471-50658 tcl slt th3 src

Transaction control statements such as BEGIN, COMMIT, ROLLBACK, SAVEPOINT, and RELEASE cause sqlite3_stmt_readonly() to return true, since the statements themselves do not actually modify the database but rather they control the timing of when other statements modify the database.

tcl/capi3d.test:179   th3/cov1/vdbeapi14.test:70

/* IMP: R-07474-04783 */
# EVIDENCE-OF: R-07474-04783 Transaction control statements such as
# BEGIN, COMMIT, ROLLBACK, SAVEPOINT, and RELEASE cause
# sqlite3_stmt_readonly() to return true, since the statements
# themselves do not actually modify the database but rather they control
# the timing of when other statements modify the database.

R-37014-01401-21089-17070-29691-04562-53032-12534 tcl slt th3 src

The ATTACH and DETACH statements also cause sqlite3_stmt_readonly() to return true since, while those statements change the configuration of a database connection, they do not make changes to the content of the database files on disk.

tcl/capi3d.test:169   th3/cov1/vdbeapi14.test:62

/* IMP: R-37014-01401 */
# EVIDENCE-OF: R-37014-01401 The ATTACH and DETACH statements also cause
# sqlite3_stmt_readonly() to return true since, while those statements
# change the configuration of a database connection, they do not make
# changes to the content of the database files on disk.

R-36961-63052-16205-51009-18443-35672-28780-03927 tcl slt th3 src

The sqlite3_stmt_readonly() interface returns true for BEGIN since BEGIN merely sets internal flags, but the BEGIN IMMEDIATE and BEGIN EXCLUSIVE commands do touch the database and so sqlite3_stmt_readonly() returns false for those commands.

tcl/capi3d.test:190   th3/cov1/vdbeapi14.test:76

/* IMP: R-36961-63052 */
# EVIDENCE-OF: R-36961-63052 The sqlite3_stmt_readonly() interface
# returns true for BEGIN since BEGIN merely sets internal flags, but the
# BEGIN IMMEDIATE and BEGIN EXCLUSIVE commands do touch the database and
# so sqlite3_stmt_readonly() returns false for those commands.

R-04929-09147-56295-64072-16041-07476-46206-21781 tcl slt th3 src

This routine returns false if there is any possibility that the statement might change the database file.

tcl/capi3d.test:147   th3/cov1/vdbeapi14.test:139

/* IMP: R-04929-09147 */
# EVIDENCE-OF: R-04929-09147 This routine returns false if there is any
# possibility that the statement might change the database file.

R-13288-53765-24256-39621-08967-42078-48057-53348 tcl slt th3 src

A false return does not guarantee that the statement will change the database file.

tcl/capi3d.test:150   th3/cov1/vdbeapi14.test:136

/* IMP: R-13288-53765 */
# EVIDENCE-OF: R-13288-53765 A false return does not guarantee that the
# statement will change the database file.

R-22182-18548-50904-36957-63145-12902-60404-23884 tcl slt th3 src

For example, an UPDATE statement might have a WHERE clause that makes it a no-op, but the sqlite3_stmt_readonly() result would still be false.

tcl/capi3d.test:153   th3/cov1/vdbeapi14.test:132

/* IMP: R-22182-18548 */
# EVIDENCE-OF: R-22182-18548 For example, an UPDATE statement might have
# a WHERE clause that makes it a no-op, but the sqlite3_stmt_readonly()
# result would still be false.

R-50998-48593-15923-36152-59159-51921-46950-43599 tcl slt th3 src

Similarly, a CREATE TABLE IF NOT EXISTS statement is a read-only no-op if the table already exists, but sqlite3_stmt_readonly() still returns false for such a statement.

tcl/capi3d.test:157   th3/cov1/vdbeapi14.test:123

/* IMP: R-50998-48593 */
# EVIDENCE-OF: R-50998-48593 Similarly, a CREATE TABLE IF NOT EXISTS
# statement is a read-only no-op if the table already exists, but
# sqlite3_stmt_readonly() still returns false for such a statement.

R-61212-30018-17379-64854-64667-34825-18647-31040 tcl slt th3 src

If prepared statement X is an EXPLAIN or EXPLAIN QUERY PLAN statement, then sqlite3_stmt_readonly(X) returns the same value as if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted.

tcl/capi3d.test:104   th3/cov1/vdbeapi14.test:174

/* IMP: R-61212-30018 */
# EVIDENCE-OF: R-61212-30018 If prepared statement X is an EXPLAIN or
# EXPLAIN QUERY PLAN statement, then sqlite3_stmt_readonly(X) returns
# the same value as if the EXPLAIN or EXPLAIN QUERY PLAN prefix were
# omitted.