[sf-perl] Going from XML to SQL

Matthew Albright mattalbright at yahoo.com
Fri Apr 1 09:45:50 PST 2005


We're on 7.x here, and we use:

select currval($tablename . '_id_seq')

We can do this because all of our tables are created through one
interface, and they always have a column: "id serial primary
key".

And of course the above sql statement is abstracted behind a
method that's called "get_last_insert_id", and that method
checks that you're in a transaction at the time, and dies if it
isn't.

If we ever upgrade to 8.x it could probably be changed, but it's
only in one place so it would be trivial.

matt


--- David Wheeler <david at kineticode.com> wrote:
> On Mar 31, 2005, at 5:59 PM, Shane Hill wrote:
> 
> > my $id = 
> >
>
$self->connection->last_insert_id(undef,undef,$table_name,undef);
> > $table_name is defined and assigned.
> >
> > the docs say this is ok,  how am I screwing up?
> 
> How is the ID generated? What does your ID column declaration
> look 
> like? Do you use a sequence?
> 
> Regards,
> 
> David
> 
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> 


More information about the SanFrancisco-pm mailing list