OCaml SQLite3 version 0.21.0

OCaml bindings to the SQLite 3 database access library.

This package was rewritten by Marcus Mottl.

You are redirected (in 10 second) to his page for the latest updates.
Please click this link if your browser does not redirect you automatically

This installation of this package requires installed OCaml 3 system with working findlib, the SQLite 3 libraries and a C compiler.

Online documentation

Here is a link to the online documentation.

Example code

The following code iterates over all rows of mytable in the database test.db and prints out the entry in the second column if it is a floating point number, otherwise it stops with the error message Float expected.
open Sqlite3

let _ =
  let db = db_open "test.db" 
  ( try
      (fun s ->
        match column s 1 with
        | Data_float f ->
            Printf.printf "Found %f\n" f
        | _ -> failwith "Float expected"
      ) db "SELECT * FROM mytable"
    xcp -> print_endline (Printexc.to_string xcp) );
  db_close db;


OCaml SQLite3 can be distributed under the permissive MIT style license.

Download the local version