[tracker] SPARQL: Small refactoring to avoid code duplication
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] SPARQL: Small refactoring to avoid code duplication
- Date: Wed, 21 Oct 2009 12:46:08 +0000 (UTC)
commit 9f067ac48973ac91a7932b8b26790f1bbfbbc46b
Author: Jürg Billeter <j bitron ch>
Date: Wed Oct 21 14:40:15 2009 +0200
SPARQL: Small refactoring to avoid code duplication
src/libtracker-data/tracker-sparql-query.vala | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index cdf5de6..f8dc348 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -622,13 +622,17 @@ public class Tracker.SparqlQuery : Object {
}
}
+ void begin_query () {
+ var_map = new HashTable<string,Variable>.full (str_hash, str_equal, g_free, g_object_unref);
+ predicate_variable_map = new HashTable<Variable,PredicateVariable>.full (direct_hash, direct_equal, g_object_unref, g_object_unref);
+ used_sql_identifiers = new HashTable<string,bool>.full (str_hash, str_equal, g_free, null);
+ }
+
DBResultSet? execute_select () throws Error {
// SELECT query
var pattern_sql = new StringBuilder ();
- var_map = new HashTable<string,Variable>.full (str_hash, str_equal, g_free, g_object_unref);
- predicate_variable_map = new HashTable<Variable,PredicateVariable>.full (direct_hash, direct_equal, g_object_unref, g_object_unref);
- used_sql_identifiers = new HashTable<string,bool>.full (str_hash, str_equal, g_free, null);
+ begin_query ();
// build SQL
var sql = new StringBuilder ();
@@ -805,9 +809,7 @@ public class Tracker.SparqlQuery : Object {
// ASK query
var pattern_sql = new StringBuilder ();
- var_map = new HashTable<string,Variable>.full (str_hash, str_equal, g_free, g_object_unref);
- predicate_variable_map = new HashTable<Variable,PredicateVariable>.full (direct_hash, direct_equal, g_object_unref, g_object_unref);
- used_sql_identifiers = new HashTable<string,bool>.full (str_hash, str_equal, g_free, null);
+ begin_query ();
// build SQL
var sql = new StringBuilder ();
@@ -843,9 +845,7 @@ public class Tracker.SparqlQuery : Object {
// INSERT or DELETE
var pattern_sql = new StringBuilder ();
- var_map = new HashTable<string,Variable>.full (str_hash, str_equal, g_free, g_object_unref);
- predicate_variable_map = new HashTable<Variable,PredicateVariable>.full (direct_hash, direct_equal, g_object_unref, g_object_unref);
- used_sql_identifiers = new HashTable<string,bool>.full (str_hash, str_equal, g_free, null);
+ begin_query ();
var sql = new StringBuilder ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]