Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2827d6d9 authored by Vasu Nori's avatar Vasu Nori
Browse files

for WAL to work, can't keep prepared SQL stmt_id in SQLiteStatement

Some (including the Contacts app) do the following:
  1. Open database
  2. As part of database_connection.onCreate(),
       Create some SQLiteStatement objects to cache them in the process
  3. attach databases
WAL doesn't work with attached databases. so, apps doing the above
should enable WAL only if there are no attached databases.

But we would like to enable WAL automatically for all apps after step #1 above
and disable WAL if the app subsequently does 'attach database' SQL.

this works only if there are no SQLiteStatement objects created in step # 2,
because SQLiteStatements cwmaintain a hard-reference to the database connection
for life and also to the prepared SQL statement id.
It is quite difficult to disable WAL in step # 3
    if it is enabled in step # 1
    and then a connection pool gets used by step # 2

would make WAL disabling easier if SQLiteStatement refers to prepared SQL
statement id only when it is needed (during binding and execute calls)
and thus NOT tied to a spacific database conenction.

also, from the standpoint of not blocking readers, it helps NOT to have
SQLiteStatement be married to a database connection and prepared SQL statement
id for life.

Change-Id: I464d57042965a28d2bde88e0f44b66ec119b40dc
parent 7fbee2f7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment