1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
Postgres: OCaml bindings for PostgreSQL
Copyright (C) 2001,2002 Alain Frisch <Alain.Frisch@ens.fr>
The library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License; see the file LGPL.
Other files, including the examples, are public domain.
===========================================================================
PostgreSQL (http://www.postgresql.org) is well-known open
source Relational Database Managment System (RDBMS); client
applications for PostgreSQL can be written in a number of languages.
This library allows programmers to write clients in OCaml.
It is mainly a set of bindings for the libpq (libpq is a low-level
C interface to write PostgreSQL clients in C; it is included
in the standard PostgreSQL distribution and libraries for
other languages usually rely on it).
There is no documentation. Sources of information are:
- the manuals included in the PostgreSQL distribution for
the basics about libpq and Large Objects
- postgres.mli
- the examples in the subdirectory tests/
Usage of low-level bindings (see postgres.mli) is discouraged.
You should use the OO-encapusalution which provides basic
runtime checks and raises exceptions to signal errors.
The library was developped with:
- OCaml 3.04
- PostgreSQL 7.1.2
It has been tested with PostgreSQL 7.0.2, 7.1.3 and 7.4.1.
This release create a dynamically linkable version of the library
(and thus requires OCaml 3.04 or higher).
===========================================================================
Building and installing
Before building the library, you probably need to fix the
POSTGRES_INCLUDE declaration in Makefile. The default
/usr/include/pgsql is correct for Redhat/Mandrake RPM installations.
Debian require /usr/include/postgresql.
To build the library:
make all
If you get the error message:
ld: fatal: library -lpq: not found
try to add -L... to the POSTGRES_LIB declartion in Makefile
(... is the directory where the file libpq.so is).
To install the library as a findlib package:
make install
(you may need to "su" to the unix account with write permission
on the findlib's site-lib/ directory)
A few examples can be found in the subdirectory tests/.
You don't need to install the library to use them.
One of them requires LablGTK 1.2
Once the package is installed, you can use something like:
(compilation)
ocamlfind ocamlc -c -package postgres my_prog.ml
(link)
ocamlfind ocamlc -o my_prog -package postgres -linkpkg my_prog.cmo
Or the same with ocamlopt.
You can also play directly in the OCaml toplevel with the following
directives:
#use "findlib";;
#require "postgres";;
===========================================================================
Contacting the author
For any feedback (suggestion, bug report, whatever ...), feel free
to contact the author of the package:
Alain.Frisch@ens.fr
The homepage for the package is:
http://www.eleves.ens.fr:8080/home/frisch/soft
|