Enable SQL tracing on the bookmark db

If built with G_ENABLE_DEBUG and the MIDORI_BOOKMARKS_DEBUG variable
is set, all SQL queries on the bookmark db will be printed to stderr.

See: https://bugs.launchpad.net/midori/+bug/983821
This commit is contained in:
Vincent Cappe 2012-04-16 14:21:25 +02:00 committed by Christian Dywan
parent 986a7acad6
commit cb8b27f14e
2 changed files with 16 additions and 0 deletions

View file

@ -67,6 +67,10 @@ If you want to "dry run" without WebKitGTK+ rendering, try this:
'MIDORI_UNARMED=1 _build/default/midori/midori'
If you want to test bookmarks, you can enable database tracing:
'MIDORI_BOOKMARKS_DEBUG=1 _build/default/midori/midori'
To disable Netscape plugins, use MOZ_PLUGIN_PATH=/.
To debug extensions you can specify the path:

View file

@ -16,6 +16,13 @@
#include <glib/gi18n.h>
#ifdef G_ENABLE_DEBUG
void midori_bookmarks_dbtracer(void* dummy, const char* query)
{
g_printerr ("%s\n", query);
}
#endif
void
midori_bookmarks_add_item_cb (KatzeArray* array,
KatzeItem* item,
@ -72,6 +79,11 @@ midori_bookmarks_initialize (KatzeArray* array,
return NULL;
}
#ifdef G_ENABLE_DEBUG
if (g_getenv ("MIDORI_BOOKMARKS_DEBUG"))
sqlite3_trace (db, midori_bookmarks_dbtracer, NULL);
#endif
if (sqlite3_exec (db,
"CREATE TABLE IF NOT EXISTS "
"bookmarks (uri text, title text, folder text, "