[tracker/rss-enclosures] libtracker-db: Do not keep unnecessary copy of SQL of cached statements



commit 81ad1fe097b672f577b5b7717313367821f96088
Author: Jürg Billeter <j bitron ch>
Date:   Wed Jun 16 09:25:13 2010 +0200

    libtracker-db: Do not keep unnecessary copy of SQL of cached statements

 src/libtracker-db/tracker-db-interface-sqlite.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index c80e5cc..b1a4033 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -639,7 +639,7 @@ static void
 prepare_database (TrackerDBInterface *db_interface)
 {
 	db_interface->dynamic_statements = g_hash_table_new_full (g_str_hash, g_str_equal,
-	                                                          (GDestroyNotify) g_free,
+	                                                          NULL,
 	                                                          (GDestroyNotify) g_object_unref);
 }
 
@@ -759,14 +759,13 @@ tracker_db_interface_create_statement (TrackerDBInterface  *db_interface,
 
 		stmt = tracker_db_statement_sqlite_new (db_interface, sqlite_stmt);
 
-		/* ownership of full_query is transferred to the hash table */
-		g_hash_table_insert (db_interface->dynamic_statements, full_query, stmt);
+		g_hash_table_insert (db_interface->dynamic_statements, sqlite3_sql (sqlite_stmt), stmt);
 	} else {
-		g_free (full_query);
-
 		tracker_db_statement_sqlite_reset (stmt);
 	}
 
+	g_free (full_query);
+
 	return g_object_ref (stmt);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]