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



commit 620b40a2b8a07f42ecb63a293b4c29e02973807b
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 1a9521f..fb2e6dc 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;
 
@@ -305,8 +305,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;
@@ -322,8 +322,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++;
@@ -333,9 +333,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;
@@ -348,9 +348,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;
@@ -359,8 +359,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;
@@ -376,8 +376,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++;
@@ -387,9 +387,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;
@@ -402,9 +402,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;
@@ -413,7 +413,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;
@@ -429,7 +429,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++;
@@ -574,9 +574,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;
@@ -694,7 +694,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);
@@ -718,13 +718,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;
 				}
@@ -738,10 +738,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) {
@@ -753,7 +753,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) {
@@ -794,21 +794,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);
@@ -816,26 +816,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]