1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Modify the sqlite3_stmt_readonly() interface so that it returns false for

CREATE TABLE IF NOT EXISTS statements even if the table already exists and
the statement is really a read-only no-op.  Likewise for DROP TABLE, 
CREATE INDEX, and DROP INDEX.  Update the documentation for
sqlite3_stmt_readonly() to reflect this new behavior.

FossilOrigin-Name: cf8eb465974e596a13df56f3efbc98e098e7b74de9af4fde9ad58312db9750e4
This commit is contained in:
drh
2021-05-13 18:24:22 +00:00
parent 756748ea86
commit 31da7be9f2
4 changed files with 40 additions and 9 deletions

View File

@@ -4198,6 +4198,15 @@ const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
** sqlite3_stmt_readonly() returns false for those commands.
**
** ^This routine returns false if there is any possibility that the
** statement might change the database file. ^A false return does
** not guarantee that the statement will change the database file.
** ^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. ^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.
*/
int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);