Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug method to print prepared statements #98

Open
benasher44 opened this issue Apr 19, 2019 · 0 comments
Open

Add debug method to print prepared statements #98

benasher44 opened this issue Apr 19, 2019 · 0 comments

Comments

@benasher44
Copy link

benasher44 commented Apr 19, 2019

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 benasher44 changed the title Add debug option to print prepared statements Add debug method to print prepared statements Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants