Browse files

removed some dependencies to ocamlbdb

  • Loading branch information...
1 parent 2997ced commit 3d099fe600ce6451a676e7c71595cc1d6efe9824 pad committed Sep 25, 2010
View
50 Makefile
@@ -24,11 +24,10 @@ PROGS+=sgrep
PROGS+=spatch
PROGS+=ppp
-ifeq ($(FEATURE_BDB),1)
-PROGS+=pfff_db
+# without bdb pfff_db_light will be incomplete regarding PHP
PROGS+=pfff_db_light
+PROGS+=pfff_db
PROGS+=scheck
-endif
ifeq ($(FEATURE_VISUAL), 1)
PROGS+=pfff_visual
@@ -105,48 +104,16 @@ endif
#------------------------------------------------------------------------------
# should be FEATURE_OCAMLGRAPH, or should give dependencies between features
-ifeq ($(FEATURE_BDB), 1)
GRAPHCMA=external/ocamlgraph/ocamlgraph.cma commons/commons_graph.cma
GRAPHDIR=external/ocamlgraph
GRAPHCMD= $(MAKE) all -C $(GRAPHDIR) && $(MAKE) graph -C commons
GRAPHCMDOPT= $(MAKE) all.opt -C $(GRAPHDIR) && $(MAKE) graph.opt -C commons
-else
-endif
+
ifeq ($(FEATURE_GRAPHICS), 1)
#GRAPHICSCMXA=graphics.cmxa
endif
-ifeq ($(FEATURE_GUI),1)
-ANALYZEPHPCMA_EXTRA+=lang_php/analyze/finder/lib.cma
-else
-endif
-
-# pfff_misc run the tests and so requires almost all libs
-ifeq ($(FEATURE_BDB),1)
-ANALYZEPHPCMA_EXTRA+= \
- lang_php/analyze/static_analysis/lib.cma \
- lang_php/analyze/qa_test/lib.cma \
-
-else
-endif
-
-
-#make analyze_php toggable
-ifeq ($(FEATURE_BDB), 1)
-ANALYZEPHPCMA= \
- lang_php/analyze/database/lib.cma \
- $(ANALYZEPHPCMA_EXTRA) \
- lang_php/analyze/analyze_php.cma \
-
-ANALYZEPHPDIR=\
- lang_php/analyze/ \
- lang_php/analyze/database \
- lang_php/analyze/static_analysis \
-
-else
-endif
-
ifeq ($(FEATURE_VISUAL),1)
VISUALDIR=visual
endif
@@ -157,7 +124,7 @@ endif
SYSLIBS=nums.cma bigarray.cma str.cma unix.cma
# used for sgrep and other small utilities which I dont want to depend
-# on bdb, even when I did a configure -bdb
+# on too much things
BASICLIBS=commons/commons.cma \
globals/globals.cma \
h_program-lang/lib.cma \
@@ -192,7 +159,11 @@ LIBS= commons/commons.cma \
lang_php/analyze/checker/lib.cma \
lang_php/mini/lib.cma \
lang_php/matcher/lib.cma \
- $(ANALYZEPHPCMA) \
+ lang_php/analyze/database/lib.cma \
+ lang_php/analyze/finder/lib.cma \
+ lang_php/analyze/static_analysis/lib.cma \
+ lang_php/analyze/qa_test/lib.cma \
+ lang_php/analyze/analyze_php.cma \
lang_sql/parsing/lib.cma \
lang_js/parsing/lib.cma \
lang_js/analyze/lib.cma \
@@ -222,7 +193,8 @@ MAKESUBDIRS=commons \
lang_php/analyze/basic \
lang_php/analyze/foundation \
lang_php/analyze/checker \
- $(ANALYZEPHPDIR) \
+ lang_php/analyze/database \
+ lang_php/analyze/static_analysis \
$(VISUALDIR) \
INCLUDEDIRS=$(MAKESUBDIRS) \
View
14 lang_cpp/analyze/Makefile
@@ -22,23 +22,13 @@ LIBS=$(TOP)/commons/commons.cma \
$(TOP)/h_version-control/lib.cma \
../parsing/lib.cma \
-MAKESUBDIRS=
-
-ifeq ($(FEATURE_BDB),1)
-MAKESUBDIRS+=
-
#database \
# dynamic_analysis static_analysis \
# qa_test qa_code \
-MAYBE_TARGET_CMA=$(TARGET).cma
-MAYBE_TARGET_CMXA=$(TARGET).cmxa
-endif
-
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
$(TOP)/globals \
@@ -69,8 +59,8 @@ INCLUDEDIRS= $(TOP)/commons \
##############################################################################
# Top rules
##############################################################################
-all:: rec $(MAYBE_TARGET_CMA)
-all.opt:: rec.opt $(MAYBE_TARGET_CMXA)
+all:: rec $(TARGET).cma
+all.opt:: rec.opt $(TARGET).cmxa
rec:
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all || exit 1; done
View
14 lang_js/analyze/Makefile
@@ -18,23 +18,13 @@ LIBS=$(TOP)/commons/commons.cma \
$(TOP)/h_version-control/lib.cma \
../parsing/lib.cma \
-MAKESUBDIRS=
-
-ifeq ($(FEATURE_BDB),1)
-MAKESUBDIRS+=
-
#database \
# dynamic_analysis static_analysis \
# qa_test qa_code \
-MAYBE_TARGET_CMA=$(TARGET).cma
-MAYBE_TARGET_CMXA=$(TARGET).cmxa
-endif
-
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
$(TOP)/globals \
@@ -49,8 +39,8 @@ INCLUDEDIRS= $(TOP)/commons \
##############################################################################
# Top rules
##############################################################################
-all:: rec $(MAYBE_TARGET_CMA)
-all.opt:: rec.opt $(MAYBE_TARGET_CMXA)
+all:: rec $(TARGET).cma
+all.opt:: rec.opt $(TARGET).cmxa
rec:
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all || exit 1; done
View
12 lang_ml/analyze/Makefile
@@ -27,21 +27,13 @@ LIBS=$(TOP)/commons/commons.cma \
MAKESUBDIRS=
-ifeq ($(FEATURE_BDB),1)
-MAKESUBDIRS+=
-
#database \
# dynamic_analysis static_analysis \
# qa_test qa_code \
-MAYBE_TARGET_CMA=$(TARGET).cma
-MAYBE_TARGET_CMXA=$(TARGET).cmxa
-endif
-
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
$(TOP)/globals \
@@ -72,8 +64,8 @@ INCLUDEDIRS= $(TOP)/commons \
##############################################################################
# Top rules
##############################################################################
-all:: rec $(MAYBE_TARGET_CMA)
-all.opt:: rec.opt $(MAYBE_TARGET_CMXA)
+all:: rec $(TARGET).cma
+all.opt:: rec.opt $(TARGET).cmxa
rec:
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all || exit 1; done
View
18 lang_php/analyze/Makefile
@@ -28,7 +28,6 @@ SRC= \
#PCREINCLUDE=$(TOP)/ocamlpcre/lib
#endif
-# this directory use ocamlbdb (in database_php.ml)
# h_version-control is used for now only by deadcode_php.ml
SYSLIBS= str.cma unix.cma $(PCRECMA)
@@ -37,21 +36,12 @@ LIBS=$(TOP)/commons/commons.cma \
$(TOP)/h_version-control/lib.cma \
../parsing/lib.cma \
-MAKESUBDIRS=basic foundation tools typing finder checker annotaters
-
-ifeq ($(FEATURE_BDB),1)
-MAKESUBDIRS+= database \
- dynamic_analysis static_analysis \
- qa_test qa_code \
-
-MAYBE_TARGET_CMA=$(TARGET).cma
-MAYBE_TARGET_CMXA=$(TARGET).cmxa
-endif
+MAKESUBDIRS=basic foundation tools typing finder checker annotaters \
+ database dynamic_analysis static_analysis qa_test qa_code \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
$(TOP)/globals \
@@ -81,8 +71,8 @@ INCLUDEDIRS= $(TOP)/commons \
##############################################################################
# Top rules
##############################################################################
-all:: rec $(MAYBE_TARGET_CMA)
-all.opt:: rec.opt $(MAYBE_TARGET_CMXA)
+all:: rec $(TARGET).cma
+all.opt:: rec.opt $(TARGET).cmxa
rec:
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all || exit 1; done
View
1 lang_php/analyze/annotaters/Makefile
@@ -14,7 +14,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/basic/Makefile
@@ -26,7 +26,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing
View
1 lang_php/analyze/checker/Makefile
@@ -15,7 +15,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/database/Makefile
@@ -21,7 +21,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
368 lang_php/analyze/database/database_php.ml
@@ -333,6 +333,25 @@ let string_of_extra_id_info x =
raise Todo
+(*****************************************************************************)
+(* Locking wrappers *)
+(*****************************************************************************)
+
+(* Berkeley DB and especially GDBM don't like when there is a concurrent
+ * access to the same database.
+ * todo: could move in h_program-lang/ ?
+ *)
+
+exception DatabaseAlreadyLocked
+
+let lockfile metapath = Filename.concat metapath "lockfile.lock"
+
+let acquire_lock metapath =
+ try Common.acquire_file_lock (lockfile metapath)
+ with Common.FileAlreadyLocked -> raise DatabaseAlreadyLocked
+
+let release_lock metapath =
+ Common.release_file_lock (lockfile metapath)
(*****************************************************************************)
(* Extra *)
@@ -1005,351 +1024,14 @@ let readable_filename_of_id id db =
let prj_path = path_of_project db.project in
Common.filename_without_leading_path prj_path file
-(*****************************************************************************)
-(* Helpers persistency *)
-(*****************************************************************************)
-
-let create_bdb ?(size_buffer=800) metapath dbname env =
- let transact () = None in
- let (fv, unv) = Common.id, Common.id in
- let flag_size_buffer_oassoc_buffer = size_buffer in
-
- Oassocbdb.create_bdb metapath dbname env transact (fv, unv)
- flag_size_buffer_oassoc_buffer
-let create_bdb_string metapath dbname env =
- let transact () = None in
- let flag_size_buffer_oassoc_buffer = 800 in
-
- Oassocbdb_string.create_bdb metapath dbname env transact
- flag_size_buffer_oassoc_buffer
-
-(* if use GDBM, but buggy:
- * let create_dbm metapath dbname =
- * Oassocdbm.create_dbm metapath dbname
- *)
-
-
-(*****************************************************************************)
-(* Locking wrappers *)
-(*****************************************************************************)
-
-(* Berkeley DB and especially GDBM don't like when there is a concurrent
- * access to the same database.
- *)
-exception DatabaseAlreadyLocked
-
-let lockfile metapath = Filename.concat metapath "lockfile.lock"
-
-let acquire_lock metapath =
- try Common.acquire_file_lock (lockfile metapath)
- with Common.FileAlreadyLocked -> raise DatabaseAlreadyLocked
-
-let release_lock metapath =
- Common.release_file_lock (lockfile metapath)
(*****************************************************************************)
(* Open/Close *)
(*****************************************************************************)
-let open_db ~metapath =
- let metapath = Common.chop_dirsymbol metapath in
- check_is_database_dir metapath;
-
- let prj = Common.read_value (metapath ^ "/prj.raw") in
- acquire_lock metapath;
-
- (* assert (default_metapath_of_project prj = metapath);
- pr2_gen (metapath_of_project prj,metapath);
- let metapath = metapath_of_project prj in
- *)
-
- (* For the moment bdb seems 2x times faster than gdbm on linux/fs/. Maybe
- * because oassocbdb also use by default the oassoc_buffer cache.
- * And for the size ? bigger ?
- *)
- let env = Bdb.Env.create [] in
-
- Bdb.env_set_max_stuff env bdb_size_tables;
- Bdb.Env.env_open env metapath
- [Bdb.Env.DB_CREATE;Bdb.Env.DB_INIT_LOG;Bdb.Env.DB_INIT_LOCK;
- Bdb.Env.DB_INIT_MPOOL;
- (* does it help to comment that ? real opti? *)
- Bdb.Env.DB_INIT_TXN;Bdb.Env.DB_RECOVER;
- ]
- (Int32.of_int 0);
-
- if !Flag.debug_bdb then pr2 "env opened";
-
- (* coupling: if add new table, don't forget to add the code that
- * close the associated bdb table !!!! and code in flush_db() !!!!!
- *)
-
- let toplevels_db, toplevels_info = create_bdb metapath "/toplevels" env in
- let asts_db, asts_info = create_bdb metapath "/asts" env in
-
- let file_to_ids_db, file_to_ids_info = create_bdb metapath "/file_to_ids" env in
- let file_info_db, file_info_info = create_bdb metapath "/file_info" env in
-
- let fullid_db, fullid_info =
- create_bdb ~size_buffer:5000 metapath "/fullid" env in
- let id_of_fullid_db, id_of_fullid_info =
- create_bdb metapath "/id_of_fullid" env in
- let enclosing_db, enclosing_info =
- create_bdb metapath "/enclosing" env in
- let children_db, children_info =
- create_bdb metapath "/children_ids" env in
-
- (* opti: important to have bigger buffer for the very randomly
- * accessed callers_info table, especially in add_callees_of_f *)
- let callers_db, callers_info =
- create_bdb ~size_buffer:50000 metapath "/callers" env in
- (* this one is less randomly accessed *)
- let callees_db, callees_info =
- create_bdb ~size_buffer:10000 metapath "/callees" env in
-
- let class_users_db, class_users_info =
- create_bdb metapath "/class_users" env in
- let define_users_db, define_users_info =
- create_bdb metapath "/define_users" env in
-
- let extenders_db, extenders_info =
- create_bdb metapath "/extenders_of_class" env in
- let implementers_db, implementers_info =
- create_bdb metapath "/implementers_of_interface" env in
-
- let includers_db, includers_info =
- create_bdb metapath "/includers_of_file" env in
- let includees_db, includees_info =
- create_bdb metapath "/includees_of_file" env in
-
-
- (* opti: important to have bigger buffer for tables used in
- * function ids_with_kinds__of_string *)
- let fdef_db, fdef_info =
- create_bdb ~size_buffer:30000 metapath "/name_defs" env in
-
- let kinds_db, kinds_info =
- create_bdb ~size_buffer:30000 metapath "/id_kinds" env in
-
- let types_db, types_info =
- create_bdb ~size_buffer:3000 metapath "/types" env in
-
- let names_db, names_info = create_bdb metapath "/names" env in
-
- let phpnames_db, phpnames_info = create_bdb metapath "/phpnames" env in
-
- let symbols_db, symbols_info =
- create_bdb_string metapath "/symbols" env in
-
- let cststrings_db, cststrings_info =
- create_bdb_string metapath "/strings" env in
-
- let str_objects_db, str_objects_info = create_bdb metapath "/str_objects" env in
- let tokens_objects_db, tokens_objects_info = create_bdb metapath "/tokens_objects" env in
- let range_objects_db, range_objects_info = create_bdb metapath "/range_objects" env in
-
- let extra_db, extra_info =
- create_bdb ~size_buffer:10000 metapath "/extra" env in
-
-(*
- let comments_db, comments_info = create_bdb metapath "/comments" env in
-
- let word_idx_db, word_idx_info =
- create_bdb ~size_buffer:30000 metapath "/words_idx" env in
-
-
-
- (* opti, like callers_db, quite randomly accessed *)
- let globals_db, globals_info =
- create_bdb ~size_buffer:1000 metapath "/globals" env in
-
-
- let structs_db, structs_info =
- create_bdb ~size_buffer:1000 metapath "/structs" env in
- let fields_db, fields_info =
- create_bdb ~size_buffer:1000 metapath "/fields" env in
- let typedefs_db, typedefs_info =
- create_bdb ~size_buffer:1000 metapath "/typedefs" env in
-
-*)
-
- if !Flag.debug_bdb then pr2 "finished opened individual dbs";
-
- let flush_db () =
-
- toplevels_info#misc_op_hook2;
- asts_info#misc_op_hook2;
-
- file_to_ids_info#misc_op_hook2;
- file_info_info#misc_op_hook2;
-
- fullid_info#misc_op_hook2;
- id_of_fullid_info#misc_op_hook2;
-
- enclosing_info#misc_op_hook2;
- children_info#misc_op_hook2;
-
- callers_info#misc_op_hook2;
- callees_info#misc_op_hook2;
-
- class_users_info#misc_op_hook2;
- define_users_info#misc_op_hook2;
-
- extenders_info#misc_op_hook2;
- implementers_info#misc_op_hook2;
-
- includees_info#misc_op_hook2;
- includers_info#misc_op_hook2;
-
- fdef_info#misc_op_hook2;
- kinds_info#misc_op_hook2;
- types_info#misc_op_hook2;
- names_info#misc_op_hook2;
- phpnames_info#misc_op_hook2;
-
- symbols_info#misc_op_hook2;
- cststrings_info#misc_op_hook2;
-
- str_objects_info#misc_op_hook2;
- tokens_objects_info#misc_op_hook2;
- range_objects_info#misc_op_hook2;
-
- extra_info#misc_op_hook2;
-
-(*
- comments_info#misc_op_hook2;
- word_idx_info#misc_op_hook2;
-
-
- globals_info#misc_op_hook2;
- structs_info#misc_op_hook2;
- fields_info#misc_op_hook2;
- typedefs_info#misc_op_hook2;
-*)
- in
-
- let free_id = 1 in (* PPP *)
-
- {
- db_support = Disk metapath;
- project = prj;
-
- next_free_id = free_id;
-
- fullid_of_id = fullid_info;
- id_of_fullid = id_of_fullid_info;
- enclosing_id = enclosing_info;
- children_ids = children_info;
-
- file_to_topids = file_to_ids_info;
- file_info = file_info_info;
-
- symbols = symbols_info;
- strings = cststrings_info;
-
- defs = {
- toplevels = toplevels_info;
- asts = asts_info;
-
- name_defs = fdef_info;
- id_kind = kinds_info;
- id_type = types_info;
- id_name = names_info;
- id_phpname = phpnames_info;
-
- str_of_topid = str_objects_info;
- tokens_of_topid = tokens_objects_info;
- range_of_topid = range_objects_info;
-
- extra = extra_info;
-
- (*
- comments_of_ast = comments_info;
- word_to_ids = word_idx_info;
-
- ftype = types_info;
- *)
- };
-
- uses = {
- callers_of_f = callers_info;
- callees_of_f = callees_info;
-
- users_of_class = class_users_info;
- users_of_define = define_users_info;
-
- extenders_of_class = extenders_info;
- implementers_of_interface = implementers_info;
-
- includers_of_file = includers_info;
- includees_of_file = includees_info;
- };
- (*
- user_of_global = globals_info;
- user_of_field = fields_info;
- *)
-
- flush_db = flush_db;
- close_hook = (fun () ->
- flush_db();
-
- Bdb.Db.close toplevels_db [];
- Bdb.Db.close asts_db [];
-
- Bdb.Db.close file_to_ids_db [];
- Bdb.Db.close file_info_db [];
-
- Bdb.Db.close fullid_db [];
- Bdb.Db.close id_of_fullid_db [];
- Bdb.Db.close enclosing_db [];
- Bdb.Db.close children_db [];
-
- Bdb.Db.close callers_db [];
- Bdb.Db.close callees_db [];
-
- Bdb.Db.close class_users_db [];
- Bdb.Db.close define_users_db [];
-
- Bdb.Db.close extenders_db [];
- Bdb.Db.close implementers_db [];
-
- Bdb.Db.close includers_db [];
- Bdb.Db.close includees_db [];
-
- Bdb.Db.close fdef_db [];
- Bdb.Db.close kinds_db [];
- Bdb.Db.close types_db [];
- Bdb.Db.close names_db [];
- Bdb.Db.close phpnames_db [];
-
- Bdb.Db.close cststrings_db [];
- Bdb.Db.close symbols_db [];
-
- Bdb.Db.close str_objects_db [];
- Bdb.Db.close tokens_objects_db [];
- Bdb.Db.close range_objects_db [];
- Bdb.Db.close extra_db [];
-
- (*
-
- Bdb.Db.close comments_db [];
- Bdb.Db.close word_idx_db [];
-
-
- Bdb.Db.close globals_db [];
-
- Bdb.Db.close structs_db [];
- Bdb.Db.close fields_db [];
- Bdb.Db.close typedefs_db [];
- *)
-
- Bdb.Env.close env [];
-
- );
- }
-
+(* the real storage backend is in database_php_storage.ml now *)
let open_db_mem prj =
let free_id = 1 in
@@ -1409,7 +1091,6 @@ let open_db_mem prj =
}
-
(*---------------------------------------------------------------------------*)
let close_db db =
db.close_hook ();
@@ -1420,15 +1101,21 @@ let close_db db =
(*---------------------------------------------------------------------------*)
+let _current_open_db_backend = ref (fun metapath ->
+ failwith "no db backend set; have you run configure -bdb ?"
+)
+
let with_db ~metapath f =
- let db = open_db metapath in
+ let db = !_current_open_db_backend metapath in
Common.unwind_protect (fun () ->
let res = f db in
close_db db;
res
)
(fun e -> close_db db)
+
+
(*****************************************************************************)
(* Error *)
(*****************************************************************************)
@@ -1445,5 +1132,4 @@ let actions () = [
"-check_db", " <db>",
Common.mk_action_1_arg (fun dbname ->
with_db ~metapath:dbname check_db);
-
]
View
17 lang_php/analyze/database/database_php.mli
@@ -160,18 +160,21 @@ val report_error: error -> string
exception Error of error
(* ---------------------------------------------------------------------- *)
+(* note that the open and closing of the database is now in
+ * database_backend.ml to make database_php.ml independent
+ * of berkeley DB
+ *
+ *
+ * note: create_db is in database_php_build.mli
+ *)
exception DatabaseAlreadyLocked
-(* @Effect: acquire and release file lock *)
-val open_db : metapath:Common.dirname -> database
-val close_db: database -> unit
-val with_db: metapath:Common.dirname -> (database -> 'a) -> 'a
-
val check_db: database -> unit
-
val open_db_mem: project -> database
+val close_db: database -> unit
-(* note: create_db is in database_php_build.mli *)
+val _current_open_db_backend: (Common.dirname -> database) ref
+val with_db: metapath:Common.dirname -> (database -> 'a) -> 'a
(* ---------------------------------------------------------------------- *)
(* xxx_of_id *)
View
3 lang_php/analyze/database/database_php_query.ml
@@ -72,18 +72,19 @@ let rec calltree_callees_of_f ~depth ~preferences id db =
(* Actions *)
(*****************************************************************************)
+
let glimpse_query_files_db s dir =
Database_php.with_db ~metapath:dir (fun db ->
let res = glimpse_get_matching_files s db in
pr2_gen res;
)
-
(*****************************************************************************)
(* Main entry for Arg *)
(*****************************************************************************)
let actions () = [
+
"-test_query_glimpse_files", " <s> <dir>",
Common.mk_action_2_arg glimpse_query_files_db;
]
View
2 lang_php/analyze/database_php_build.ml
@@ -1308,7 +1308,7 @@ let create_db
Database_php.database_tag_filename);
Common.write_value prj (metapath ^ "/prj.raw");
- let db = open_db metapath in
+ let db = !Database_php._current_open_db_backend metapath in
let logchan = open_out (metapath ^ "/log.log") in
Common._chan_pr2 := Some logchan;
View
1 lang_php/analyze/dynamic_analysis/Makefile
@@ -13,7 +13,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/finder/Makefile
@@ -14,7 +14,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/foundation/Makefile
@@ -21,7 +21,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json $(TOP)/commons/lib-xml \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/qa_code/Makefile
@@ -12,7 +12,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/qa_test/Makefile
@@ -15,7 +15,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/static_analysis/Makefile
@@ -20,7 +20,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/tools/Makefile
@@ -20,7 +20,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json $(TOP)/commons/lib-xml \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \
View
1 lang_php/analyze/typing/Makefile
@@ -16,7 +16,6 @@ LIBS=$(TOP)/commons/commons.cma \
INCLUDEDIRS= $(TOP)/commons \
$(TOP)/commons/ocollection $(TOP)/commons/ocamlextra \
$(TOP)/commons/lib-json \
- $(TOP)/external/ocamlbdb \
$(TOP)/external/ocamlpcre/lib \
$(TOP)/h_program-lang $(TOP)/h_version-control \
../../parsing \

0 comments on commit 3d099fe

Please sign in to comment.