sqlite-android icon indicating copy to clipboard operation
sqlite-android copied to clipboard

Add debug method to print prepared statements

Open benasher44 opened this issue 7 years ago • 0 comments

When you want to DETACH a database, you need be sure that the connection has no more prepare statements (at least for that db). While debugging, it was helpful to be able to print all of the compile statements that still associated with the connection. It'd be great to add such a helper to the library permanently that is callable from Java:

    sqlite3_stmt* statement = sqlite3_next_stmt(connection->db, NULL);
    if (statement == NULL) {
        return;
    }
    do {
        ALOGE("live statement: %s", sqlite3_expanded_sql(statement));
        statement = sqlite3_next_stmt(connection->db, statement);
    } while(statement != NULL);

This is the snippet I was working with locally. I'm less familiar with how to work this into the methods exposed via the JNI though.

benasher44 avatar Apr 19 '19 20:04 benasher44