diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2020-08-31 11:44:37 +0000 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2020-08-31 11:44:37 +0000 |
commit | ed7c9af385ea91d06d37d68f1c0236dbad2e3355 (patch) | |
tree | 2fbf194cc06ef94aaf267a1d055956b9a07f00b6 /src | |
parent | 41842f9a19e691e41393e4ce9aa19338f67a1b30 (diff) | |
parent | aa40f98ae3f67d368de22345a2da32aacf267619 (diff) | |
download | tracker-ed7c9af385ea91d06d37d68f1c0236dbad2e3355.tar.gz |
Merge branch 'wip/carlosg/sql-statements-debug' into 'master'
libtracker-data: Provide better sql-statements debug output
See merge request GNOME/tracker!305
Diffstat (limited to 'src')
-rw-r--r-- | src/libtracker-data/tracker-db-interface-sqlite.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c index 46b2aab46..d758f92e0 100644 --- a/src/libtracker-data/tracker-db-interface-sqlite.c +++ b/src/libtracker-data/tracker-db-interface-sqlite.c @@ -2613,7 +2613,6 @@ tracker_db_interface_prepare_stmt (TrackerDBInterface *db_interface, sqlite3_stmt *sqlite_stmt; int retval; - TRACKER_NOTE (SQL_STATEMENTS, g_message ("Preparing query: '%s'", full_query)); retval = sqlite3_prepare_v2 (db_interface->db, full_query, -1, &sqlite_stmt, NULL); if (retval != SQLITE_OK) { @@ -2851,6 +2850,22 @@ execute_stmt (TrackerDBInterface *interface, g_atomic_int_inc (&interface->n_active_cursors); +#ifdef G_ENABLE_DEBUG + if (TRACKER_DEBUG_CHECK (SQL_STATEMENTS)) { + gchar *full_query; + + full_query = sqlite3_expanded_sql (stmt); + + if (full_query) { + g_message ("Executing update: '%s'", full_query); + sqlite3_free (full_query); + } else { + g_message ("Executing update: '%s'", + sqlite3_sql (stmt)); + } + } +#endif + while (result == SQLITE_OK || result == SQLITE_ROW) { @@ -3183,6 +3198,22 @@ tracker_db_cursor_sqlite_new (TrackerDBStatement *ref_stmt, iface = ref_stmt->db_interface; g_atomic_int_inc (&iface->n_active_cursors); +#ifdef G_ENABLE_DEBUG + if (TRACKER_DEBUG_CHECK (SQL_STATEMENTS)) { + gchar *full_query; + + full_query = sqlite3_expanded_sql (ref_stmt->stmt); + + if (full_query) { + g_message ("Executing query: '%s'", full_query); + sqlite3_free (full_query); + } else { + g_message ("Executing query: '%s'", + sqlite3_sql (ref_stmt->stmt)); + } + } +#endif + cursor = g_object_new (TRACKER_TYPE_DB_CURSOR, NULL); cursor->finished = FALSE; |