[Xfce4-commits] <midori:master> Enable SQL tracing on the bookmark db

Christian Dywan noreply at xfce.org
Sat May 12 04:10:01 CEST 2012


Updating branch refs/heads/master
         to cb8b27f14efab81f8fbab0c466c078cc94f4e975 (commit)
       from 986a7acad6bd14ae7d6abd211789c18debd03045 (commit)

commit cb8b27f14efab81f8fbab0c466c078cc94f4e975
Author: Vincent Cappe <vcappe at gmail.com>
Date:   Mon Apr 16 14:21:25 2012 +0200

    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(+), 0 deletions(-)

diff --git a/INSTALL b/INSTALL
index 238ba54..a81718b 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 97ea7a6..59865fb 100644
--- a/midori/midori-bookmarks.c
+++ b/midori/midori-bookmarks.c
@@ -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, "


More information about the Xfce4-commits mailing list