Re: last_insert_rowid and DBD::ODBC combined with DBIx::Class::Storage::DBI

Re: last_insert_rowid and DBD::ODBC combined with DBIx::Class::Storage::DBI

am 01.09.2006 16:55:05 von Tim.Bunce

On Fri, Sep 01, 2006 at 04:45:07PM -0000, Eriam Schaffter wrote:
>
> my software crashes badly due to the fact that DBD::ODBC has not a
> "last_insert_rowid" method:

It's called last_insert_id

Tim.

Re: last_insert_rowid and DBD::ODBC combined with DBIx::Class::Storage::DBI

am 01.09.2006 17:33:01 von Martin.Evans

Tim Bunce wrote:
> On Fri, Sep 01, 2006 at 04:45:07PM -0000, Eriam Schaffter wrote:
>
>>my software crashes badly due to the fact that DBD::ODBC has not a
>>"last_insert_rowid" method:
>
>
> It's called last_insert_id
>
> Tim.

As you say, it is last_insert_id but I don't think DBD::ODBC implements
it because there is not a standard way in ODBC to get the last insert
id. In SQL Server it is select @@identity, in mysql it is a function
(something like select LAST_INSERTID), in Oracle people use the
returning clause or a sequence etc etc. They are all different.

IIRC, last time I needed to do this I had to override last_insert_id for
each db I was using DBD::ODBC with.

Martin

last_insert_rowid and DBD::ODBC combined with DBIx::Class::Storage::DBI

am 01.09.2006 18:45:07 von eriam

Hello

There is two sides to this issue, one has been filled on rt.cpan.org (the
DBIx::Class::Storage::DBI one) and the other one I am raising here.

Actually I'm using DBD::ODBC with DBIx::Class::Storage::DBI and when I try
to add a record

my $rapport = $schema->resultset('Rapports')->create({
nom => 'Hello World'
});

my software crashes badly due to the fact that DBD::ODBC has not a
"last_insert_rowid" method:

Can't locate DBI object method "last_insert_rowid" via package
"DBD::ODBC::db" a
t C:/Perl/site/lib/DBIx/Class/Storage/DBI.pm line 592.

This is not so cool, you can imagine ..

So is there a special reason why this last_insert_rowid is not implemented
in DBD::ODBC (like an ODBC reason, in this case it's just a
DBIx::Class::Storage::DBI issue) or is it simply missing (in this case I
can try adding this ..) ?

Thank you

Eriam

--
Eriam Schaffter