Search code examples
javaandroidsqliteopenhelpersqlcipher

SQLiteOpenHelper Query - How to show the SQL-Statment


I'd like to know if it's possible to see the SQL-Statment which the SQLiteOpenHelper generates. Here's some Sample-Code:

    String selection = "USER_LOGIN=?";
    String[] sectionArgument = new String[]{"username"};
    String[] columns = new String[]{"USER_LOGIN", "USER_PASS"};

    Cursor c = mDatabase.query("ACCOUNT_TABLE", columns, selection, sectionArgument, null, null, null);

Now how is it possible to see the generated SQL-Statment form the query-Method.


Solution

  • To view the queries that are issued to a SQLCipher database, please refer to the PRAGMA cipher_profile command which will allow you to capture both the queries and their respective execution time in milliseconds.