[tracker/binary-log-2: 17/47] Renamed code to id in the journal API



commit 1663dc329889b56848eb4b19206c8b4b16e09b0d
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Jan 5 16:25:59 2010 +0100

    Renamed code to id in the journal API

 src/libtracker-data/tracker-data-update.c |    6 +-
 src/libtracker-db/tracker-db-journal.c    |   96 ++++++++++++++--------------
 src/libtracker-db/tracker-db-journal.h    |   38 ++++++------
 tests/libtracker-db/tracker-db-journal.c  |    5 +-
 4 files changed, 72 insertions(+), 73 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index c901bd0..40120c7 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1280,7 +1280,7 @@ tracker_data_delete_statement (const gchar  *graph,
 	if (object && g_strcmp0 (predicate, RDF_PREFIX "type") == 0) {
 		class = tracker_ontology_get_class_by_uri (object);
 		if (class != NULL) {
-			tracker_db_journal_append_delete_statement_code (resource_buffer->id,
+			tracker_db_journal_append_delete_statement_id (resource_buffer->id,
 				tracker_data_query_resource_id (predicate),
 				query_resource_id (object));
 
@@ -1294,7 +1294,7 @@ tracker_data_delete_statement (const gchar  *graph,
 		if (field != NULL) {
 			guint32 id = tracker_property_get_id (field);
 			if (tracker_property_get_data_type (field) == TRACKER_PROPERTY_TYPE_RESOURCE) {
-				tracker_db_journal_append_delete_statement_code (resource_buffer->id,
+				tracker_db_journal_append_delete_statement_id (resource_buffer->id,
 					(id != 0) ? id : tracker_data_query_resource_id (predicate),
 					query_resource_id (object));
 			} else {
@@ -1510,7 +1510,7 @@ tracker_data_insert_statement_with_uri (const gchar            *graph,
 		return;
 	}
 
-	tracker_db_journal_append_insert_statement_code (resource_buffer->id,
+	tracker_db_journal_append_insert_statement_id (resource_buffer->id,
 		(prop_id != 0) ? prop_id : tracker_data_query_resource_id (predicate),
 		query_resource_id (object));
 
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index d0f57cc..66f7e38 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -51,9 +51,9 @@ static struct {
 	guint32 amount_of_triples;
 	TrackerDBJournalEntryType type;
 	const gchar *uri;
-	guint32 s_code;
-	guint32 p_code;
-	guint32 o_code;
+	guint32 s_id;
+	guint32 p_id;
+	guint32 o_id;
 	const gchar *object;
 } reader;
 
@@ -304,8 +304,8 @@ tracker_db_journal_start_transaction (void)
 }
 
 gboolean
-tracker_db_journal_append_delete_statement (guint32      s_code,
-                                            guint32      p_code,
+tracker_db_journal_append_delete_statement (guint32      s_id,
+                                            guint32      p_id,
                                             const gchar *object)
 {
 	gint o_len;
@@ -321,8 +321,8 @@ tracker_db_journal_append_delete_statement (guint32      s_code,
 	cur_block_maybe_expand (size);
 
 	cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
-	cur_setnum (writer.cur_block, &writer.cur_pos, s_code);
-	cur_setnum (writer.cur_block, &writer.cur_pos, p_code);
+	cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
+	cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
 	cur_setstr (writer.cur_block, &writer.cur_pos, object, o_len);
 
 	writer.cur_entry_amount++;
@@ -332,9 +332,9 @@ tracker_db_journal_append_delete_statement (guint32      s_code,
 }
 
 gboolean
-tracker_db_journal_append_delete_statement_code (guint32 s_code,
-                                                 guint32 p_code,
-                                                 guint32 o_code)
+tracker_db_journal_append_delete_statement_id (guint32 s_id,
+                                               guint32 p_id,
+                                               guint32 o_id)
 {
 	gchar data_format;
 	gint size;
@@ -347,9 +347,9 @@ tracker_db_journal_append_delete_statement_code (guint32 s_code,
 	cur_block_maybe_expand (size);
 
 	cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
-	cur_setnum (writer.cur_block, &writer.cur_pos, s_code);
-	cur_setnum (writer.cur_block, &writer.cur_pos, p_code);
-	cur_setnum (writer.cur_block, &writer.cur_pos, o_code);
+	cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
+	cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
+	cur_setnum (writer.cur_block, &writer.cur_pos, o_id);
 
 	writer.cur_entry_amount++;
 	writer.cur_block_len += size;
@@ -358,8 +358,8 @@ tracker_db_journal_append_delete_statement_code (guint32 s_code,
 }
 
 gboolean
-tracker_db_journal_append_insert_statement (guint32      s_code,
-                                            guint32      p_code,
+tracker_db_journal_append_insert_statement (guint32      s_id,
+                                            guint32      p_id,
                                             const gchar *object)
 {
 	gint o_len;
@@ -375,8 +375,8 @@ tracker_db_journal_append_insert_statement (guint32      s_code,
 	cur_block_maybe_expand (size);
 
 	cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
-	cur_setnum (writer.cur_block, &writer.cur_pos, s_code);
-	cur_setnum (writer.cur_block, &writer.cur_pos, p_code);
+	cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
+	cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
 	cur_setstr (writer.cur_block, &writer.cur_pos, object, o_len);
 
 	writer.cur_entry_amount++;
@@ -386,9 +386,9 @@ tracker_db_journal_append_insert_statement (guint32      s_code,
 }
 
 gboolean
-tracker_db_journal_append_insert_statement_code (guint32 s_code,
-                                                 guint32 p_code,
-                                                 guint32 o_code)
+tracker_db_journal_append_insert_statement_id (guint32 s_id,
+                                               guint32 p_id,
+                                               guint32 o_id)
 {
 	gchar data_format;
 	gint size;
@@ -401,9 +401,9 @@ tracker_db_journal_append_insert_statement_code (guint32 s_code,
 	cur_block_maybe_expand (size);
 
 	cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
-	cur_setnum (writer.cur_block, &writer.cur_pos, s_code);
-	cur_setnum (writer.cur_block, &writer.cur_pos, p_code);
-	cur_setnum (writer.cur_block, &writer.cur_pos, o_code);
+	cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
+	cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
+	cur_setnum (writer.cur_block, &writer.cur_pos, o_id);
 
 	writer.cur_entry_amount++;
 	writer.cur_block_len += size;
@@ -412,7 +412,7 @@ tracker_db_journal_append_insert_statement_code (guint32 s_code,
 }
 
 gboolean
-tracker_db_journal_append_resource (guint32      s_code,
+tracker_db_journal_append_resource (guint32      s_id,
                                     const gchar *uri)
 {
 	gint o_len;
@@ -428,7 +428,7 @@ tracker_db_journal_append_resource (guint32      s_code,
 	cur_block_maybe_expand (size);
 
 	cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
-	cur_setnum (writer.cur_block, &writer.cur_pos, s_code);
+	cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
 	cur_setstr (writer.cur_block, &writer.cur_pos, uri, o_len);
 
 	writer.cur_entry_amount++;
@@ -573,9 +573,9 @@ tracker_db_journal_reader_shutdown (void)
 	reader.amount_of_triples = 0;
 	reader.type = TRACKER_DB_JOURNAL_START;
 	reader.uri = NULL;
-	reader.s_code = 0;
-	reader.p_code = 0;
-	reader.o_code = 0;
+	reader.s_id = 0;
+	reader.p_id = 0;
+	reader.o_id = 0;
 	reader.object = NULL;
 
 	return TRUE;
@@ -693,7 +693,7 @@ tracker_db_journal_reader_next (GError **error)
 				return FALSE;
 			}
 
-			reader.s_code = read_uint32 (reader.current);
+			reader.s_id = read_uint32 (reader.current);
 			reader.current += 4;
 
 			str_length = strnlen (reader.current, reader.end - reader.current);
@@ -717,13 +717,13 @@ tracker_db_journal_reader_next (GError **error)
 		} else {
 			if (data_format & 4) {
 				if (data_format & 2) {
-					reader.type = TRACKER_DB_JOURNAL_DELETE_STATEMENT_CODE;
+					reader.type = TRACKER_DB_JOURNAL_DELETE_STATEMENT_ID;
 				} else {
 					reader.type = TRACKER_DB_JOURNAL_DELETE_STATEMENT;
 				}
 			} else {
 				if (data_format & 2) {
-					reader.type = TRACKER_DB_JOURNAL_INSERT_STATEMENT_CODE;
+					reader.type = TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID;
 				} else {
 					reader.type = TRACKER_DB_JOURNAL_INSERT_STATEMENT;
 				}
@@ -737,10 +737,10 @@ tracker_db_journal_reader_next (GError **error)
 				return FALSE;
 			}
 
-			reader.s_code = read_uint32 (reader.current);
+			reader.s_id = read_uint32 (reader.current);
 			reader.current += 4;
 
-			reader.p_code = read_uint32 (reader.current);
+			reader.p_id = read_uint32 (reader.current);
 			reader.current += 4;
 
 			if (data_format & 2) {
@@ -752,7 +752,7 @@ tracker_db_journal_reader_next (GError **error)
 					return FALSE;
 				}
 
-				reader.o_code = read_uint32 (reader.current);
+				reader.o_id = read_uint32 (reader.current);
 				reader.current += 4;
 			} else {
 				if (reader.end - reader.current < 1) {
@@ -793,21 +793,21 @@ tracker_db_journal_reader_next (GError **error)
 }
 
 gboolean
-tracker_db_journal_reader_get_resource (guint32      *code,
+tracker_db_journal_reader_get_resource (guint32      *id,
                                         const gchar **uri)
 {
 	g_return_val_if_fail (reader.file != NULL, FALSE);
 	g_return_val_if_fail (reader.type == TRACKER_DB_JOURNAL_RESOURCE, FALSE);
 
-	*code = reader.s_code;
+	*id = reader.s_id;
 	*uri = reader.uri;
 
 	return TRUE;
 }
 
 gboolean
-tracker_db_journal_reader_get_statement (guint32      *s_code,
-                                         guint32      *p_code,
+tracker_db_journal_reader_get_statement (guint32      *s_id,
+                                         guint32      *p_id,
                                          const gchar **object)
 {
 	g_return_val_if_fail (reader.file != NULL, FALSE);
@@ -815,26 +815,26 @@ tracker_db_journal_reader_get_statement (guint32      *s_code,
 	                      reader.type == TRACKER_DB_JOURNAL_DELETE_STATEMENT,
 	                      FALSE);
 
-	*s_code = reader.s_code;
-	*p_code = reader.p_code;
+	*s_id = reader.s_id;
+	*p_id = reader.p_id;
 	*object = reader.object;
 
 	return TRUE;
 }
 
 gboolean
-tracker_db_journal_reader_get_statement_code (guint32 *s_code,
-                                              guint32 *p_code,
-                                              guint32 *o_code)
+tracker_db_journal_reader_get_statement_id (guint32 *s_id,
+                                            guint32 *p_id,
+                                            guint32 *o_id)
 {
 	g_return_val_if_fail (reader.file != NULL, FALSE);
-	g_return_val_if_fail (reader.type == TRACKER_DB_JOURNAL_INSERT_STATEMENT_CODE ||
-	                      reader.type == TRACKER_DB_JOURNAL_DELETE_STATEMENT_CODE,
+	g_return_val_if_fail (reader.type == TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID ||
+	                      reader.type == TRACKER_DB_JOURNAL_DELETE_STATEMENT_ID,
 	                      FALSE);
 
-	*s_code = reader.s_code;
-	*p_code = reader.p_code;
-	*o_code = reader.o_code;
+	*s_id = reader.s_id;
+	*p_id = reader.p_id;
+	*o_id = reader.o_id;
 
 	return TRUE;
 }
diff --git a/src/libtracker-db/tracker-db-journal.h b/src/libtracker-db/tracker-db-journal.h
index 8894ebe..3034234 100644
--- a/src/libtracker-db/tracker-db-journal.h
+++ b/src/libtracker-db/tracker-db-journal.h
@@ -36,9 +36,9 @@ typedef enum {
 	TRACKER_DB_JOURNAL_END_TRANSACTION,
 	TRACKER_DB_JOURNAL_RESOURCE,
 	TRACKER_DB_JOURNAL_INSERT_STATEMENT,
-	TRACKER_DB_JOURNAL_INSERT_STATEMENT_CODE,
+	TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID,
 	TRACKER_DB_JOURNAL_DELETE_STATEMENT,
-	TRACKER_DB_JOURNAL_DELETE_STATEMENT_CODE
+	TRACKER_DB_JOURNAL_DELETE_STATEMENT_ID
 } TrackerDBJournalEntryType;
 
 GQuark       tracker_db_journal_error_quark                  (void);
@@ -53,19 +53,19 @@ const gchar* tracker_db_journal_get_filename                 (void);
 gsize        tracker_db_journal_get_size                     (void);
 
 gboolean     tracker_db_journal_start_transaction            (void);
-gboolean     tracker_db_journal_append_delete_statement      (guint32      s_code,
-                                                              guint32      p_code,
+gboolean     tracker_db_journal_append_delete_statement      (guint32      s_id,
+                                                              guint32      p_id,
                                                               const gchar *object);
-gboolean     tracker_db_journal_append_delete_statement_code (guint32      s_code,
-                                                              guint32      p_code,
-                                                              guint32      o_code);
-gboolean     tracker_db_journal_append_insert_statement      (guint32      s_code, 
-                                                              guint32      p_code, 
+gboolean     tracker_db_journal_append_delete_statement_id   (guint32      s_id,
+                                                              guint32      p_id,
+                                                              guint32      o_id);
+gboolean     tracker_db_journal_append_insert_statement      (guint32      s_id, 
+                                                              guint32      p_id, 
                                                               const gchar *object);
-gboolean     tracker_db_journal_append_insert_statement_code (guint32      s_code,
-                                                              guint32      p_code,
-                                                              guint32      o_code);
-gboolean     tracker_db_journal_append_resource              (guint32      s_code,
+gboolean     tracker_db_journal_append_insert_statement_id   (guint32      s_id,
+                                                              guint32      p_id,
+                                                              guint32      o_id);
+gboolean     tracker_db_journal_append_resource              (guint32      s_id,
                                                               const gchar *uri);
 
 gboolean     tracker_db_journal_rollback_transaction         (void);
@@ -82,14 +82,14 @@ TrackerDBJournalEntryType
              tracker_db_journal_reader_get_type              (void);
 
 gboolean     tracker_db_journal_reader_next                  (GError      **error);
-gboolean     tracker_db_journal_reader_get_resource          (guint32      *code,
+gboolean     tracker_db_journal_reader_get_resource          (guint32      *id,
                                                               const gchar **uri);
-gboolean     tracker_db_journal_reader_get_statement         (guint32      *s_code,
-                                                              guint32      *p_code,
+gboolean     tracker_db_journal_reader_get_statement         (guint32      *s_id,
+                                                              guint32      *p_id,
                                                               const gchar **object);
-gboolean     tracker_db_journal_reader_get_statement_code    (guint32      *s_code,
-                                                              guint32      *p_code,
-                                                              guint32      *o_code);
+gboolean     tracker_db_journal_reader_get_statement_id      (guint32      *s_id,
+                                                              guint32      *p_id,
+                                                              guint32      *o_id);
 
 G_END_DECLS
 
diff --git a/tests/libtracker-db/tracker-db-journal.c b/tests/libtracker-db/tracker-db-journal.c
index 4db0916..447b264 100644
--- a/tests/libtracker-db/tracker-db-journal.c
+++ b/tests/libtracker-db/tracker-db-journal.c
@@ -87,7 +87,7 @@ test_write_functions (void)
 	g_assert_cmpint (result, ==, TRUE);
 	result = tracker_db_journal_append_resource (14, "http://resource";);
 	g_assert_cmpint (result, ==, TRUE);
-	result = tracker_db_journal_append_delete_statement_code (12, 13, 14);
+	result = tracker_db_journal_append_delete_statement_id (12, 13, 14);
 	g_assert_cmpint (result, ==, TRUE);
 	result = tracker_db_journal_commit_transaction ();
 	g_assert_cmpint (result, ==, TRUE);
@@ -115,7 +115,7 @@ test_write_functions (void)
 	g_assert_cmpint (result, ==, TRUE);
 	result = tracker_db_journal_append_resource (19, "http://resource";);
 	g_assert_cmpint (result, ==, TRUE);
-	result = tracker_db_journal_append_insert_statement_code (17, 18, 19);
+	result = tracker_db_journal_append_insert_statement_id (17, 18, 19);
 	g_assert_cmpint (result, ==, TRUE);
 	result = tracker_db_journal_commit_transaction ();
 	g_assert_cmpint (result, ==, TRUE);
@@ -134,7 +134,6 @@ test_read_functions (void)
 {
 	GError *error = NULL;
 	gchar *path;
-	gsize initial_size, actual_size;
 	gboolean result;
 	TrackerDBJournalEntryType type;
 



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