I'm trying to debug a weird problem with my ORMLite query in my Android app, and it would be really handy if I could see the SQL being generated. Is there any way to output the SQL of a query as a string? It doesn't matter if it's before or after the query is executed.
For example, I have
contactQb.where().eq("enabled", true);
I'd like to see what SQL is generated for that QueryBuilder.
Ah, I figured it out: contactQb.prepareStatementString()
gives the full SQL statement.
Is there any way to output the SQL of a query as a string?
As you mention logging the output of contactQb.prepareStatementString()
will show you the specific query string. You can also enable ORMLite's logging to show a lot more detail. See:
http://ormlite.com/docs/android-logging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With