]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update the sqlite3_stmt_readonly() interface so that its output is
authordrh <drh@noemail.net>
Wed, 8 Dec 2010 18:30:19 +0000 (18:30 +0000)
committerdrh <drh@noemail.net>
Wed, 8 Dec 2010 18:30:19 +0000 (18:30 +0000)
well-defined for all prepared statements, and so that it gives the
correct result for VACUUM.

FossilOrigin-Name: 9c19b7ae3542fd1fac692b4471f1839b22685c76

manifest
manifest.uuid
src/sqlite.h.in
src/vdbeaux.c

index 36254014d3771e21227458cb8b88c616714b2818..2497116d8c461eb8a05b26c418fd083f839d6069 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C The\scommand-line\sshell\signore\serrors\sin\ssqlite3_close()\swhen\sshutting\sdown.
-D 2010-12-08T03:28:17
+C Update\sthe\ssqlite3_stmt_readonly()\sinterface\sso\sthat\sits\soutput\sis\s\nwell-defined\sfor\sall\sprepared\sstatements,\sand\sso\sthat\sit\sgives\sthe\s\ncorrect\sresult\sfor\sVACUUM.
+D 2010-12-08T18:30:20
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 4547616ad2286053af6ccccefa242dc925e49bf0
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -179,7 +179,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
 F src/select.c 8a7ba246b0b4bb45df7fbc52681728a0e3deaaa7
 F src/shell.c ee5905fef7bf8dfceaf31ee32db92a250c5acab4
-F src/sqlite.h.in d0cd88c447f25ead403bca04ebd8fe93e035f820
+F src/sqlite.h.in 2bd41c95c0a38a048511025b646b6fe3621f0753
 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
 F src/sqliteInt.h b96d5ddb8b419a2ed7cf69a7778b53872d73e8a7
 F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44
@@ -235,7 +235,7 @@ F src/vdbe.c 5d310eaf1a4d8383602126fa82e01291ab7d3cf3
 F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2
 F src/vdbeInt.h 1f2137b905969f4de0648256aeb73abdf88f9213
 F src/vdbeapi.c fb0036185b3c56e15916a5ee96309cd4acf6818f
-F src/vdbeaux.c b810a66902ee40c71cdb9c64f43760da516c91df
+F src/vdbeaux.c 33448d23b857654dd69ed2103611f5c733606f68
 F src/vdbeblob.c 18955f0ee6b133cd08e1592010cb9a6b11e9984c
 F src/vdbemem.c 411649a35686f54268ccabeda175322c4697f5a6
 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
@@ -897,14 +897,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P e474fd9e7f89644a7840e33e9df03dbaa4dd28bd
-R 7edcb2582417e56eb98f0dae455ae31e
+P 925332c3d79f6252895ff1a367f795630619247e
+R 21967790fc1d3a87411c7dc79f0363d8
 U drh
-Z b15026da9128033b9dc0a7b0dce2ca83
+Z 43b494b0390c277287ad8dcfa52377ca
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFM/vtUoxKgR168RlERAi0wAJ4nUq0PfKIRivnR/wjbLVQFsF5neACfb8+m
-fqFov7rgIDAItG1ZstpEvGo=
-=CHf6
+iD8DBQFM/87BoxKgR168RlERAq7yAJ91YZzLtFsuVU7N+/YXYPca9gc1nQCggog3
+BbPOFe1Sz6rNVdsQrKMw7s8=
+=vXgA
 -----END PGP SIGNATURE-----
index 2287c208e6aa3f36ce7d663225fb7cc88c882cbb..c8a9082ca9b1dd9717857412fa536cc086c2d625 100644 (file)
@@ -1 +1 @@
-925332c3d79f6252895ff1a367f795630619247e
\ No newline at end of file
+9c19b7ae3542fd1fac692b4471f1839b22685c76
\ No newline at end of file
index 7c259c8671ab61141775c81636455490410060b6..f2bd71b1ff88c762bfcaea5b71a1bd7b5e715bc8 100644 (file)
@@ -2650,14 +2650,31 @@ const char *sqlite3_sql(sqlite3_stmt *pStmt);
 /*
 ** CAPI3REF: Determine If An SQL Statement Writes The Database
 **
-** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
-** the [prepared statement] X is [SELECT] statement and false (zero) if
-** X is an [INSERT], [UPDATE], [DELETE], CREATE, DROP, [ANALYZE],
-** [ALTER], or [REINDEX] statement.
-** If X is a NULL pointer or any other kind of statement, including but
-** not limited to [ATTACH], [DETACH], [COMMIT], [ROLLBACK], [RELEASE],
-** [SAVEPOINT], [PRAGMA], or [VACUUM] the result of sqlite3_stmt_readonly(X) is
-** undefined.
+** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if 
+** and only if the [prepared statement] X is makes no direct changes to
+** the content of the database file.
+**
+** Note that [application-defined SQL functions] or
+** [virtual tables] might change the database indirectly as a side effect.  
+** ^(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:
+**
+** <blockquote><pre>
+**    SELECT eval('DELETE FROM t1') FROM t2;
+** </pre></blockquote>
+**
+** But because the [SELECT] statement does not change the database file
+** directly, sqlite3_stmt_readonly() would still return true.)^
+**
+** ^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.  ^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.
 */
 int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
 
index a9ac9b032dd037aac04951abef3fd26954fdfbb0..de69e544e5aa8e68973d4db8048916cd5935a237 100644 (file)
@@ -408,7 +408,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
     pOp->opflags = sqlite3OpcodeProperty[opcode];
     if( opcode==OP_Function || opcode==OP_AggStep ){
       if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5;
-    }else if( opcode==OP_Transaction && pOp->p2!=0 ){
+    }else if( (opcode==OP_Transaction && pOp->p2!=0) || opcode==OP_Vacuum ){
       p->readOnly = 0;
 #ifndef SQLITE_OMIT_VIRTUALTABLE
     }else if( opcode==OP_VUpdate ){