Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Dbi: proposal #1
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Dbi: proposal #1

When I implemented a DBI interface for pthrlib, I added a "serial"
method. This is an extension to the basic Perl DBI, but very useful.
Example (in pseudocode):

Table: create table employees (empid serial, name text, salary int);

let query = dbh#prepare "insert into employees (name) values ('John Smith')";;
query#execute;;
let empid = query#serial ("employees_empid_seq");;     (* returns, eg., 1 *)

The argument to serial is the sequence name, required for PostgreSQL,
but can be ignored on other databases.

Rich.

-- 
Richard Jones, Red Hat Inc. (London) and Merjis Ltd. http://www.merjis.com/
http://www.annexia.org/ Freshmeat projects: http://freshmeat.net/users/rwmj
MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles,
RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners