Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value

[prev] [thread] [next] [Date index for 2005/11/21]

From: David Steinbrunner
Subject: Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value
Date: 15:30 on 21 Nov 2005
Peter Speltz wrote:

> I thought you had to define a sequence in you CDBI code  for PG cause
> it does not have auto inc columns. Is that right?

Ok, this makes sense.  But does then tie your code to only working with
database that support sequences?  My goal is to be able to have the same
codebase be able to work on top of both MySQL and Postgres (maybe even
SQLite at some point).  It seems to me that using last_insert_id in the
_auto_increment_value method would not only clean up the code for that
method but make it so that you would not have to define a sequence and be
more database agnostic.

My system is currently working as I just described.  I would have to test to
see if defining sequences in my CDBI objects breaks compatibility with MySQL
but regardless It seems to me that CDBI using last_insert_id  on the backend
is a much more elegant solution.

--
David Steinbrunner



_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value
David Steinbrunner 15:30 on 21 Nov 2005

Generated at 19:11 on 22 Dec 2005 by mariachi v0.52