Changeset 191

Show
Ignore:
Timestamp:
10/15/09 10:25:33 (6 weeks ago)
Author:
lb
Message:

refId in the various tables

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tools/log2sqlite/log2sqlite_optim.ml

    r182 r191  
    99 
    1010let dbName = ref "log.db" 
     11 
    1112let insert_ref = ref "" 
     13 
     14let refs_num = ref 0 
    1215 
    1316let anonymous s =  
     
    6568     let quote_ref_loc = "\""^loc^"\"" in  
    6669     let insert_q = "INSERT INTO afterKeys(refLocation, kind, keyLocation, 
    67      value) 
    68 values("^quote_ref_loc^","^quote_kind^","^quote_keyLoc^","^quote_bool_val^");" in 
     70     value, refId) 
     71values("^quote_ref_loc^","^quote_kind^","^quote_keyLoc^","^quote_bool_val^","^string_of_int(!refs_num)^");" in 
    6972      exec db insert_q; 
    7073      ()       
    7174 
    72 let conv_mova db mova location =  
    73     let loc_str = conv_location location in  
     75let conv_mova db location mova =  
     76    let loc_str = conv_location location in 
    7477    match mova with 
    7578    MovAfter(keys) -> 
     
    8487    let conva_field = conv_conva conva in  
    8588    let insert_update =  
    86         "INSERT INTO ref(kind, name, refLoc, defLoc, useCond, movableBefore, 
    87         convertibleBefore, convertibleAfter) values( \""^ kind_field 
     89        "INSERT INTO ref(id, kind, name, refLoc, defLoc, useCond, movableBefore, 
     90        convertibleBefore, convertibleAfter) values( 
     91            "^string_of_int(!refs_num)^",\" "^ kind_field 
    8892        ^"\",\""^name^"\",\""^conv_location location^"\",\""^conv_defLoc 
    89         defLoc^"\",\""^ conv_use_cond use_cond^"\",\""^movb_field^"\",\""^convb_field^"\",\""^conva_field^"\");" 
     93        defLoc^"\",\""^ conv_use_cond 
     94        use_cond^"\",\""^movb_field^"\",\""^convb_field^"\",\""^conva_field^"\");" 
    9095    in  
     96        refs_num := !refs_num + 1; 
    9197        insert_ref:=!insert_ref^insert_update 
    9298     
     
    96102    let loc = "\""^conv_location location^"\"" in  
    97103    let confOpt = "\""^configOption^"\"" in   
    98     let insert_q = "INSERT INTO "^table^"(refLocation, configOption) values 
    99     ("^loc^","^confOpt^");" in 
     104    let insert_q = "INSERT INTO "^table^"(refLocation, configOption, refId) values 
     105    ("^loc^","^confOpt^", "^string_of_int(!refs_num)^");" in 
    100106    exec db insert_q; 
    101107    () 
     
    112118    match use_copt with  
    113119    Some(ConfOpt(c)) -> List.iter (insert_confOpts db location "usageConfOpts") 
    114     c 
     120    c; 
     121    () 
    115122    | None -> ()  
    116123    
     
    125132            conva); 
    126133          insert_uconfOpts db location use_copt; 
    127           insert_defconfOpts db location def_copt 
     134          insert_defconfOpts db location def_copt; 
     135          conv_mova db location mova 
     136 
    128137  | _ -> () (** For the Struct introductions **) 
    129138 
     
    166175        let db  = db_open !dbName in 
    167176        let references =  
    168         exec db "CREATE TABLE IF NOT EXISTS ref (id INTEGER PRIMARY KEY ASC, 
     177        exec db "CREATE TABLE IF NOT EXISTS ref (id INTEGER PRIMARY KEY, 
    169178        kind TEXT, name TEXT, refLoc TEXT, defLoc TEXT, useCond TEXT, 
    170179        movableBefore BOOLEAN, convertibleBefore BOOLEAN, 
    171180        convertibleAfter BOOLEAN); " in 
    172181        let afterKeys = exec db "CREATE TABLE IF NOT EXISTS afterKeys (id 
    173         INTEGER PRIMARY KEY ASC, refLocation TEXT, kind TEXT, keyLocation TEXT, value BOOL); " in  
     182        INTEGER PRIMARY KEY ASC, refLocation TEXT, kind TEXT, keyLocation TEXT, 
     183        value BOOL, refId INTEGER); " in  
    174184        let usageConfOpts = exec db "CREATE TABLE IF NOT EXISTS usageConfOpts ( 
    175185            id INTEGER PRIMARY KEY  
    176         ASC, refLocation TEXT, configOption TEXT); " in 
     186        ASC, refLocation TEXT, configOption TEXT, refId INTEGER); " in 
    177187        let defConfOpts = exec db "CREATE TABLE IF NOT EXISTS defConfOpts ( id 
    178188        INTEGER PRIMARY KEY  
    179         ASC, refLocation TEXT, configOption TEXT); " in  
     189        ASC, refLocation TEXT, configOption TEXT, refId INTEGER); " in  
    180190        Printf.printf "Checking creations\n";  
    181191        creation_check references afterKeys usageConfOpts defConfOpts;