"Markus Hoenicka" <[EMAIL PROTECTED]> writes on 
Sat, 27 May 2006 22:46:22 +0200 (METDST):

> Martin Kutschker writes:
> > Have the systems which use sequences some nameing schemes, which
> > build the sequence name from the table name?
> > 
> 
> SQLite and MySQL don't use sequences, so I can speak only of
> PostgreSQL (don't know about Oracle, Sybase et al.). If you use the
> Serial type in PostgreSQL, a sequence is automatically created with a
> predictable name (tablename_colname_seq). However, you can do this
> just as well:
> 
> CREATE SEQUENCE whatever_seq;
> CREATE TABLE tablename (
> colname integer DEFAULT nextval('whatever_seq') NOT NULL
> 
> A mechanism that relies on a particular naming scheme of sequences
> would fail in the second case.


I was aware of that. I shoud have written that the new function would only work 
with the default sequence names. But this is no real problem as you can use 
dbi_conn_sequence_last() if you have custom sequence names.

But now you *have* to use custom names to have predictable names for your 
application. 


> > And perhaps dbi couild handle the problem that Mysql doesn't store
> > the id by table or sequence but by connection by automatically
> > calling mysql_last_insert_id() on every insert and storing the ids
> > in a dbi datastructure per table.
> 
> I don't see a real problem here. If an application makes sure to
> store
> relevant id values after INSERT commands, you'll get a portable code
> without causing dbi to interfere with tables behind the users back.


Yes. But the docs must, if they don't do already, state that 
dbi_conn_sequence_last() must be the very first statement after an INSERT. Ok, 
I think it's enough if you issue it before another INSERT, but better be strict 
that get a wrong id.

I just thought it might be a bit more convenient for folks that switch to Mysql.

Masi 


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users

Reply via email to