From cb8b27f14efab81f8fbab0c466c078cc94f4e975 Mon Sep 17 00:00:00 2001 From: Vincent Cappe Date: Mon, 16 Apr 2012 14:21:25 +0200 Subject: [PATCH] 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 --- INSTALL | 4 ++++ midori/midori-bookmarks.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/INSTALL b/INSTALL index 238ba54c..a81718ba 100644 --- a/INSTALL +++ b/INSTALL @@ -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: diff --git a/midori/midori-bookmarks.c b/midori/midori-bookmarks.c index 97ea7a67..59865fb9 100644 --- a/midori/midori-bookmarks.c +++ b/midori/midori-bookmarks.c @@ -16,6 +16,13 @@ #include +#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, " -- 2.39.5