Android Question SQLITE PRAGMA

Guenter Becker

Active Member
Licensed User
Hello,

if we use sqlite PRAGMA statements some of them are reporting a result like PRAGMA integrity_check. If the check fails a string for each wrong report is reported.
With other PRAGMAS I use SQL.ExecNonQuery("PRAGMA auto_vacuum=0") and it works fine.

But how to retrive a PRAGMA Result as shown in the example? ExecNonQuery does not return results.

Can anyone help me?
 

drgottjr

Expert
Licensed User
Longtime User
pragma can respond to normal queries.

B4X:
    Dim response As String = SQL.ExecQuerySingleResult("PRAGMA encoding")
    Log(response)
logs "UTF-8" on my system


issue your SQL.ExecNonQuery("PRAGMA auto_vacuum=0") as normal
and then issue SQL.ExecQuerySingleResult("PRAGMA auto_vacuum") to see the result.
(note: some commands may not be legal. eg, auto_vacuum can depend on how sqlite was built. you may not simply be able to turn it on...)

check sqlite documentation regarding valid pragmas and any trickiness that you might expect.
 
Upvote 0
Top