[tracker] libtracker-db: Remove unused support for blobs



commit 343d4faf4d881fe0e7a2563950bee90569dcb845
Author: Jürg Billeter <j bitron ch>
Date:   Thu Mar 18 13:46:59 2010 +0100

    libtracker-db: Remove unused support for blobs

 src/libtracker-db/tracker-db-interface-sqlite.c |   48 +----------------------
 src/libtracker-db/tracker-db-interface.c        |   36 -----------------
 src/libtracker-db/tracker-db-interface.h        |    3 -
 3 files changed, 1 insertions(+), 86 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index ca85f77..63d8876 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -396,7 +396,6 @@ internal_sqlite3_function (sqlite3_context *context,
 {
 	SqliteFunctionData *data;
 	GValue *values, result;
-	GByteArray *blob_array;
 	gint i;
 
 	data = (SqliteFunctionData *) sqlite3_user_data (context);
@@ -417,21 +416,6 @@ internal_sqlite3_function (sqlite3_context *context,
 			g_value_init (&values[i], G_TYPE_DOUBLE);
 			g_value_set_double (&values[i], sqlite3_value_double (argv[i]));
 			break;
-		case SQLITE_BLOB: {
-			gconstpointer blob;
-			gint size;
-
-			blob = sqlite3_value_blob (argv[i]);
-			size = sqlite3_value_bytes (argv[i]);
-
-			blob_array = g_byte_array_sized_new (size);
-			g_byte_array_append (blob_array, blob, size);
-
-			g_value_init (&values[i], TRACKER_TYPE_DB_BLOB);
-			g_value_take_boxed (&values[i], blob_array);
-
-			break;
-		}
 		case SQLITE_NULL:
 			/* Unset GValues as NULLs */
 			break;
@@ -453,12 +437,6 @@ internal_sqlite3_function (sqlite3_context *context,
 		sqlite3_result_text (context,
 		                     g_value_dup_string (&result),
 		                     -1, g_free);
-	} else if (G_VALUE_HOLDS (&result, TRACKER_TYPE_DB_BLOB)) {
-		blob_array = g_value_get_boxed (&result);
-		sqlite3_result_blob (context,
-		                     g_memdup (blob_array->data, blob_array->len),
-		                     blob_array->len,
-		                     g_free);
 	} else if (G_VALUE_HOLDS (&result, G_TYPE_INVALID)) {
 		sqlite3_result_null (context);
 	} else {
@@ -519,7 +497,6 @@ internal_sqlite3_aggregate_step (sqlite3_context *context,
 	SqliteAggregateData *data;
 	void *aggregate_context;
 	GValue *values;
-	GByteArray *blob_array;
 	gint i;
 
 	data = (SqliteAggregateData *) sqlite3_user_data (context);
@@ -540,25 +517,9 @@ internal_sqlite3_aggregate_step (sqlite3_context *context,
 			g_value_init (&values[i], G_TYPE_DOUBLE);
 			g_value_set_double (&values[i], sqlite3_value_double (argv[i]));
 			break;
-		case SQLITE_BLOB: {
-			gconstpointer blob;
-			gint size;
-
-			blob = sqlite3_value_blob (argv[i]);
-			size = sqlite3_value_bytes (argv[i]);
-
-			blob_array = g_byte_array_sized_new (size);
-			g_byte_array_append (blob_array, blob, size);
-
-			g_value_init (&values[i], TRACKER_TYPE_DB_BLOB);
-			g_value_take_boxed (&values[i], blob_array);
-
-			break;
-		}
-		case SQLITE_NULL: {
+		case SQLITE_NULL:
 			/* Ignore NULLs and let the function handle missing values */
 			break;
-		}
 		default:
 			g_critical ("Unknown sqlite3 database value type:%d",
 			            sqlite3_value_type (argv[i]));
@@ -587,7 +548,6 @@ internal_sqlite3_aggregate_final (sqlite3_context *context)
 	SqliteAggregateData *data;
 	void *aggregate_context;
 	GValue result;
-	GByteArray *blob_array;
 
 	data = (SqliteAggregateData *) sqlite3_user_data (context);
 
@@ -605,12 +565,6 @@ internal_sqlite3_aggregate_final (sqlite3_context *context)
 		sqlite3_result_text (context,
 		                     g_value_dup_string (&result),
 		                     -1, g_free);
-	} else if (G_VALUE_HOLDS (&result, TRACKER_TYPE_DB_BLOB)) {
-		blob_array = g_value_get_boxed (&result);
-		sqlite3_result_blob (context,
-		                     g_memdup (blob_array->data, blob_array->len),
-		                     blob_array->len,
-		                     g_free);
 	} else if (G_VALUE_HOLDS (&result, G_TYPE_INVALID)) {
 		sqlite3_result_null (context);
 	} else {
diff --git a/src/libtracker-db/tracker-db-interface.c b/src/libtracker-db/tracker-db-interface.c
index c4215e3..244a589 100644
--- a/src/libtracker-db/tracker-db-interface.c
+++ b/src/libtracker-db/tracker-db-interface.c
@@ -113,42 +113,6 @@ tracker_db_cursor_get_type (void)
 }
 
 
-/* Boxed type for blobs */
-static gpointer
-blob_copy (gpointer boxed)
-{
-	GByteArray *array, *copy;
-
-	array = (GByteArray *) boxed;
-	copy = g_byte_array_sized_new (array->len);
-	g_byte_array_append (copy, array->data, array->len);
-
-	return copy;
-}
-
-static void
-blob_free (gpointer boxed)
-{
-	GByteArray *array;
-
-	array = (GByteArray *) boxed;
-	g_byte_array_free (array, TRUE);
-}
-
-GType
-tracker_db_blob_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0)) {
-		type = g_boxed_type_register_static ("TrackerDBBlob",
-		                                     blob_copy,
-		                                     blob_free);
-	}
-
-	return type;
-}
-
 /* TrackerDBResultSet */
 static void
 tracker_db_result_set_set_property (GObject       *object,
diff --git a/src/libtracker-db/tracker-db-interface.h b/src/libtracker-db/tracker-db-interface.h
index f83157f..d6209b6 100644
--- a/src/libtracker-db/tracker-db-interface.h
+++ b/src/libtracker-db/tracker-db-interface.h
@@ -50,8 +50,6 @@ G_BEGIN_DECLS
 #define TRACKER_IS_DB_RESULT_SET_CLASS(c)   (G_TYPE_CHECK_CLASS_TYPE ((o),    TRACKER_TYPE_DB_RESULT_SET))
 #define TRACKER_DB_RESULT_SET_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o),  TRACKER_TYPE_DB_RESULT_SET, TrackerDbResultSetClass))
 
-#define TRACKER_TYPE_DB_BLOB                (tracker_db_blob_get_type ())
-
 #define TRACKER_DB_INTERFACE_ERROR          (tracker_db_interface_error_quark ())
 
 typedef enum {
@@ -133,7 +131,6 @@ GType               tracker_db_interface_get_type          (void);
 GType               tracker_db_statement_get_type          (void);
 GType               tracker_db_cursor_get_type             (void);
 GType               tracker_db_result_set_get_type         (void);
-GType               tracker_db_blob_get_type               (void);
 
 /* Functions to create queries/procedures */
 TrackerDBStatement *tracker_db_interface_create_statement  (TrackerDBInterface   *interface,



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