anjuta r4522 - in trunk: . plugins/symbol-db
- From: mcora svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4522 - in trunk: . plugins/symbol-db
- Date: Thu, 1 Jan 2009 21:24:20 +0000 (UTC)
Author: mcora
Date: Thu Jan 1 21:24:20 2009
New Revision: 4522
URL: http://svn.gnome.org/viewvc/anjuta?rev=4522&view=rev
Log:
* plugins/symbol-db/symbol-db-engine-core.c
(sdb_engine_create_db_tables),
(sdb_engine_second_pass_update_heritage):
* plugins/symbol-db/symbol-db-engine-priv.h:
* plugins/symbol-db/tables.sql:
fixed #566145. Added a table 'version' where to store the symbol db structure
version. This should help migration in future releases.
Modified:
trunk/ChangeLog
trunk/plugins/symbol-db/symbol-db-engine-core.c
trunk/plugins/symbol-db/symbol-db-engine-priv.h
trunk/plugins/symbol-db/tables.sql
Modified: trunk/plugins/symbol-db/symbol-db-engine-core.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-core.c (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-core.c Thu Jan 1 21:24:20 2009
@@ -2645,7 +2645,6 @@
return TRUE;
}
-
/**
* Creates required tables for the database to work.
* @param tables_sql_file File containing sql code.
@@ -2656,6 +2655,7 @@
GError *err;
SymbolDBEnginePriv *priv;
gchar *contents;
+ gchar *query;
gsize sizez;
g_return_val_if_fail (tables_sql_file != NULL, FALSE);
@@ -2675,9 +2675,15 @@
return FALSE;
}
- sdb_engine_execute_non_select_sql (dbe, contents);
-
+ sdb_engine_execute_non_select_sql (dbe, contents);
g_free (contents);
+
+ /* set the current symbol db database version. This may help if new tables/fields
+ * are added/removed in future versions.
+ */
+ query = "INSERT INTO version VALUES ("SYMBOL_DB_VERSION")";
+ sdb_engine_execute_non_select_sql (dbe, query);
+
return TRUE;
}
@@ -4020,7 +4026,6 @@
}
/** Return the symbol_id of the changed symbol */
-// FIXME: find a quicker way to handle the thing here.
static inline gint
sdb_engine_second_pass_update_scope_1 (SymbolDBEngine * dbe,
GdaDataModel * data, gint data_row,
@@ -4164,7 +4169,6 @@
return symbol_referer_id;
}
-
/**
* @param data Must be filled with some values. It must have num_rows > 0
* @note *CALL THIS BEFORE second_pass_update_heritage ()*
@@ -4266,7 +4270,6 @@
g_mutex_lock (priv->mutex);
}
-
/**
* @param data Must be filled with some values. It must have num_rows > 0
* @note *CALL THIS AFTER second_pass_update_scope ()*
@@ -4458,8 +4461,7 @@
/* relock before leaving... */
if (priv->mutex)
- g_mutex_lock (dbe->priv->mutex);
-
+ g_mutex_lock (dbe->priv->mutex);
}
/**
Modified: trunk/plugins/symbol-db/symbol-db-engine-priv.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-priv.h (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-priv.h Thu Jan 1 21:24:20 2009
@@ -35,13 +35,15 @@
/* file should be specified without the ".db" extension. */
#define ANJUTA_DB_FILE ".anjuta_sym_db"
+/* if tables.sql changes or general db structure changes modify also the value here */
+#define SYMBOL_DB_VERSION "1.0"
+
#define TABLES_SQL PACKAGE_DATA_DIR"/tables.sql"
#define CTAGS_MARKER "#_#\n"
#define SHARED_MEMORY_PREFIX "/dev/shm"
-#define THREADS_MONITOR_TIMEOUT 50
#define THREADS_MAX_CONCURRENT 2
#define TRIGGER_SIGNALS_DELAY 100
Modified: trunk/plugins/symbol-db/tables.sql
==============================================================================
--- trunk/plugins/symbol-db/tables.sql (original)
+++ trunk/plugins/symbol-db/tables.sql Thu Jan 1 21:24:20 2009
@@ -84,7 +84,9 @@
type_id integer,
unique (scope_name, type_id)
);
-
+
+CREATE TABLE version (sdb_version numeric PRIMARY KEY);
+
CREATE TABLE __tmp_heritage_scope (tmp_heritage_scope_id integer PRIMARY KEY AUTOINCREMENT,
symbol_referer_id integer not null,
field_inherits varchar(256),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]