I have a large database (approx. 150 000 records) that I want to embed into an OCaml source code named compute.ml. I am trying (without success) to transform these tables into hashtables and to embed these hastables into a function compute
, so as to have the binary program run quicly without having to do queries to an external sql database.
I have 2 questions:
- Is there a way to export for once a mysql table into an associative array (Hashtbl) that can be accessed by (or even embedded into) my OCaml function
compute
(itself compiled and used as a binary)? - Is this hashtable permanently loaded in the function or has it to be re-initiated each time that the function is called within the binary?
I have a mysql table with 142741 records which, exported in CSV format, looks like this:
"1";"27";"10";"coco";"0";"730";"1641025";"1641053";"foo";"1";"S";"0"
"2";"27";"11";"kiki";"0";"730";"1641054";"1641083";"bar";"1";"S";"0"
"3";"27";"12";"toto";"0";"730";"1641084";"1641113";"foofoo";"1";"S";"0"
"4";"27";"1";"tata";"0";"730";"1641114";"1641142";"barbar";"1";"S";"0"
...
"142741";"5";"7";"chotto";"0";"1347";"1971472";"1971500";"lastrecord";"1";"S";"0"