From 333b7710bc3ead707005cbed388766297f71f4c8 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sat, 11 Jun 2011 17:24:59 +0200 Subject: [PATCH] Queries must hit SQLITE_DONE to execute profiling callback --- src/db.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/db.c b/src/db.c index bc1c1be7..09915356 100644 --- a/src/db.c +++ b/src/db.c @@ -676,6 +676,11 @@ db_get_count(char *query) ret = sqlite3_column_int(stmt, 0); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); return ret; @@ -1638,6 +1643,11 @@ db_file_path_byid(int id) if (res) res = strdup(res); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); sqlite3_free(query); @@ -1679,6 +1689,11 @@ db_file_id_byquery(char *query) ret = sqlite3_column_int(stmt, 0); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); return ret; @@ -1823,6 +1838,11 @@ db_file_stamp_bypath(char *path) stamp = (time_t)sqlite3_column_int64(stmt, 0); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); sqlite3_free(query); @@ -1937,6 +1957,11 @@ db_file_fetch_byquery(char *query) } } +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); return mfi; @@ -2373,6 +2398,11 @@ db_pl_id_bypath(char *path, int *id) *id = sqlite3_column_int(stmt, 0); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); sqlite3_free(query); @@ -2950,6 +2980,11 @@ db_group_type_byid(int id) ret = sqlite3_column_int(stmt, 0); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); sqlite3_free(query); @@ -3073,6 +3108,11 @@ db_pairing_fetch_byguid(struct pairing_info *pi) pi->remote_id = strdup((char *)sqlite3_column_text(stmt, 0)); pi->name = strdup((char *)sqlite3_column_text(stmt, 1)); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); sqlite3_free(query); @@ -3161,6 +3201,11 @@ db_speaker_get(uint64_t id, int *selected, int *volume) *selected = sqlite3_column_int(stmt, 0); *volume = sqlite3_column_int(stmt, 1); +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); ret = 0; @@ -3451,6 +3496,11 @@ db_watch_get_bywd(struct watch_info *wi) } } +#ifdef DB_PROFILE + while (db_blocking_step(stmt) == SQLITE_ROW) + ; /* EMPTY */ +#endif + sqlite3_finalize(stmt); sqlite3_free(query);