Changeset 191
- Timestamp:
- 10/15/09 10:25:33 (6 weeks ago)
- Files:
-
- 1 modified
-
trunk/tools/log2sqlite/log2sqlite_optim.ml (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/log2sqlite/log2sqlite_optim.ml
r182 r191 9 9 10 10 let dbName = ref "log.db" 11 11 12 let insert_ref = ref "" 13 14 let refs_num = ref 0 12 15 13 16 let anonymous s = … … 65 68 let quote_ref_loc = "\""^loc^"\"" in 66 69 let insert_q = "INSERT INTO afterKeys(refLocation, kind, keyLocation, 67 value )68 values("^quote_ref_loc^","^quote_kind^","^quote_keyLoc^","^quote_bool_val^" );" in70 value, refId) 71 values("^quote_ref_loc^","^quote_kind^","^quote_keyLoc^","^quote_bool_val^","^string_of_int(!refs_num)^");" in 69 72 exec db insert_q; 70 73 () 71 74 72 let conv_mova db mova location=73 let loc_str = conv_location location in 75 let conv_mova db location mova = 76 let loc_str = conv_location location in 74 77 match mova with 75 78 MovAfter(keys) -> … … 84 87 let conva_field = conv_conva conva in 85 88 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 88 92 ^"\",\""^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^"\");" 90 95 in 96 refs_num := !refs_num + 1; 91 97 insert_ref:=!insert_ref^insert_update 92 98 … … 96 102 let loc = "\""^conv_location location^"\"" in 97 103 let confOpt = "\""^configOption^"\"" in 98 let insert_q = "INSERT INTO "^table^"(refLocation, configOption ) values99 ("^loc^","^confOpt^" );" in104 let insert_q = "INSERT INTO "^table^"(refLocation, configOption, refId) values 105 ("^loc^","^confOpt^", "^string_of_int(!refs_num)^");" in 100 106 exec db insert_q; 101 107 () … … 112 118 match use_copt with 113 119 Some(ConfOpt(c)) -> List.iter (insert_confOpts db location "usageConfOpts") 114 c 120 c; 121 () 115 122 | None -> () 116 123 … … 125 132 conva); 126 133 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 128 137 | _ -> () (** For the Struct introductions **) 129 138 … … 166 175 let db = db_open !dbName in 167 176 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, 169 178 kind TEXT, name TEXT, refLoc TEXT, defLoc TEXT, useCond TEXT, 170 179 movableBefore BOOLEAN, convertibleBefore BOOLEAN, 171 180 convertibleAfter BOOLEAN); " in 172 181 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 174 184 let usageConfOpts = exec db "CREATE TABLE IF NOT EXISTS usageConfOpts ( 175 185 id INTEGER PRIMARY KEY 176 ASC, refLocation TEXT, configOption TEXT ); " in186 ASC, refLocation TEXT, configOption TEXT, refId INTEGER); " in 177 187 let defConfOpts = exec db "CREATE TABLE IF NOT EXISTS defConfOpts ( id 178 188 INTEGER PRIMARY KEY 179 ASC, refLocation TEXT, configOption TEXT ); " in189 ASC, refLocation TEXT, configOption TEXT, refId INTEGER); " in 180 190 Printf.printf "Checking creations\n"; 181 191 creation_check references afterKeys usageConfOpts defConfOpts;
