Module Dbf_old (.ml)


module Dbf_old: sig .. end
Types to describe an old DBForge schema.


type t_key =
| Primary_key
| Key
Type of keys.
type sql_code = string 
SQL code is a string.

type dbms =
| Odbc
| Mysql
| Postgres
The various supported DBMS.

type column_dbms = {
   mutable col_type_sql : string * string option * string option; (*SQL type, an optional argument, and optional args*)
   mutable col_2ml : string; (*Name of the function to call to get a ml value from a string*)
   mutable col_ml2 : string; (*Name of the function to call to get a strign from a ml value*)
   mutable col_key : t_key option; (*optional key type*)
   mutable col_default : sql_code option; (*optional default SQL value*)
   mutable col_atts : (string * sql_code) list; (*list of (attribute name, SQL code for value)*)
}
Column info for a specific dbms.

type column = {
   mutable col_name : string; (*Name of the column, will also be the name of the record in the ocaml record type of the table*)
   mutable col_comment : string; (*Comment of the column*)
   mutable col_type_ml : string; (*OCaml type to represent the SQL type*)
   mutable col_nullable : bool; (*column can contain NULL values or not*)
   mutable col_index : bool; (*make an index on this column or not*)
   mutable col_dbms : (dbms * column_dbms) list; (*DBMS-specific information*)
}
A table column.

type table = {
   mutable ta_name : string;
   mutable ta_comment : string;
   mutable ta_columns : column list;
   mutable ta_atts : int list; (*later, table attributes*)
   mutable ta_indexes : int list; (*later, indexes on various columns*)
   mutable ta_logged : bool; (*whether this table must have a table_log*)
}
A table.

type schema = {
   mutable sch_tables : table list;
}
A schema.

Reading old DBForge files


val fail : Xml.xml -> string -> 'a
val bool_of_xml : Xml.xml -> bool
val unescape : string -> string
val db_of_xml : Xml.xml -> dbms
val key_of_xml : Xml.xml -> t_key
val opt_of_xml : (Xml.xml -> 'a) -> Xml.xml -> 'a option
val att_of_xml : Xml.xml -> string * string
val string_of_xml : Xml.xml -> string
val type_sql_of_xml : Xml.xml list -> string * string option * string option
val coldbms_of_xml : Xml.xml -> column_dbms
val dbms_of_xml : Xml.xml -> dbms * column_dbms
val column_of_xml : Xml.xml -> column
val table_of_xml : Xml.xml -> table
val schema_of_xml : Xml.xml -> schema
val read : string -> schema

Converting old to new format


val string_of_dbms : dbms -> string
val regular_type_of_old_sql_type : string * string option * 'a -> Dbf_sql.SQL_db.ty option
val sqltype_of_col : dbms ->
column_dbms -> Dbf_sql.SQL_db.ty * string Dbf_misc.StringMap.t
val convert_column : Dbf_sql.SQL_db.table -> dbms -> column -> unit
val convert_table : Dbf_sql.SQL_db.db -> dbms -> table -> unit
val convert_to_db : schema -> dbms -> Dbf_sql.SQL_db.db