[anjuta] symbol-db: don't allow or set null scope_definition_id and scope_id.



commit e17f6eb4d6baf4ba019efa0e23df9d4a2da9b132
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Sat Nov 17 14:39:47 2012 +0100

    symbol-db: don't allow or set null scope_definition_id and scope_id.
    
    Add not null constraints to the two fields and fixup PREP_QUERY_SYMBOL_NEW and
    PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID so that they don't set the fields to null.
    
    The scope_id lookup in PREP_QUERY_SYMBOL_NEW can be removed since
    the call to sdb_engine_add_new_scope_definition() at symbol-db-engine-core.c:4830 already
    does  the lookup.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688533

 plugins/symbol-db/symbol-db-engine-core.c |   17 ++---------------
 plugins/symbol-db/tables.sql              |    4 ++--
 2 files changed, 4 insertions(+), 17 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index 881c74a..e551c5f 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -1958,11 +1958,7 @@ sdb_engine_init (SymbolDBEngine * object)
                                        ## /* name:'isfilescope' type:gint */, \
                                        ## /* name:'signature' type:gchararray */, \
                                        ## /* name:'returntype' type:gchararray */, \
-                               CASE ## /* name:'scopedefinitionid' type:gint */ \
-                                       WHEN -1 THEN (SELECT scope_id FROM scope \
-                                                                 WHERE scope_name = ## /* name:'scope' 
type:gchararray */ \
-                                                                 LIMIT 1) \
-                                       ELSE ## /* name:'scopedefinitionid' type:gint */ END, \
+                               ## /* name:'scopedefinitionid' type:gint */, \
                                        ## /* name:'scopeid' type:gint */, \
                                        ## /* name:'typetype' type:gchararray */, \
                                ## /* name:'typename' type:gchararray */, \
@@ -1987,7 +1983,7 @@ sdb_engine_init (SymbolDBEngine * object)
        
        STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list, 
                                                                        PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID,
-               "UPDATE symbol SET scope_id = (SELECT scope_definition_id FROM symbol WHERE \
+               "UPDATE OR IGNORE symbol SET scope_id = (SELECT scope_definition_id FROM symbol WHERE \
                type_type = ## /* name:'tokenname' type:gchararray */ AND \
                type_name = ## /* name:'objectname' type:gchararray */ LIMIT 1) \
                 WHERE symbol_id = ## /* name:'symbolid' type:gint */");
@@ -4637,15 +4633,6 @@ sdb_engine_add_new_symbol_case_2_3 (SymbolDBEngine *dbe,
 
        SDB_PARAM_SET_STRING(param, type_name);
 
-       if ((param = gda_set_get_holder ((GdaSet*)plist, "scope")) == NULL)
-       {
-               g_warning ("param scope is NULL from pquery!");
-               return;
-       }
-
-       /* scope is to be considered the tag name */
-       SDB_PARAM_SET_STRING(param, name);
-       
        *plist_ptr = (GdaSet*)plist;
        *stmt_ptr = (GdaStatement*)stmt;
 }
diff --git a/plugins/symbol-db/tables.sql b/plugins/symbol-db/tables.sql
index e0db171..ddb889f 100644
--- a/plugins/symbol-db/tables.sql
+++ b/plugins/symbol-db/tables.sql
@@ -37,8 +37,8 @@ CREATE TABLE symbol (symbol_id integer PRIMARY KEY AUTOINCREMENT,
                      is_file_scope integer,
                      signature text,
                      returntype text,
-                     scope_definition_id integer,
-                     scope_id integer,
+                     scope_definition_id integer not null,
+                     scope_id integer not null,
                      type_type text not null,
                                         type_name text not null,
                      kind_id integer REFERENCES sym_kind (sym_kind_id),


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