开发者

How do you tune Android's SQLite as per the SQLite docs, e.g. PRAGMA cache_size?

开发者 https://www.devze.com 2023-03-29 00:26 出处:网络
The SQLite docs here http://web.utk.开发者_Python百科edu/~jplyon/sqlite/SQLite_optimization_FAQ.html#pragmas look interesting. Is there a way to try what it suggests in Android?Quoting the SQLite docu

The SQLite docs here http://web.utk.开发者_Python百科edu/~jplyon/sqlite/SQLite_optimization_FAQ.html#pragmas look interesting. Is there a way to try what it suggests in Android?


Quoting the SQLite documentation:

The PRAGMA statement is an SQL extension specific to SQLite and used to modify the operation of the SQLite library or to query the SQLite library for internal (non-table) data. The PRAGMA statement is issued using the same interface as other SQLite commands (e.g. SELECT, INSERT)

So, I would expect execSQL() on a SQLiteDatabase should work with a PRAGMA that returns no result set.

If the PRAGMA affects compilation of a SQLite statement, try compileStatement() with a SQLiteDatabase and see if that works. I would expect that to map to sqlite3_prepare() in the SQLite C API, though I am not certain of that.


I don't know how in Android, it may not allow to bind parameters when using PRAGMA so I've to execute whole statement with parameters in it like this example:

"PRAGMA main.locking_mode = exclusive";

Maybe in Android it can be used with that execSQL() method only.

0

精彩评论

暂无评论...
验证码 换一张
取 消