[Dbix-class] FW: DBIC and Informix

Robert Carew Robert.Carew at topazsolutions.co.nz
Tue Sep 4 01:46:17 GMT 2007


Request originally posted on Catalyst list.

Hi

I am trying to use Catalyst and DBIC with an Informix database. At present I am working through the Catalyst Tutorial. I got this working ok with SQLite and have now converted it for Informix. 
So far the select and insert statements are working ok.
The problem I am having is when a record is inserted in the books table which has a primary key of serial (auto-increment) the primary key of the new record is not retrieved. I tried overriding the "_dbh_last_insert_id" method by adding an Informix.pm module in the DBIx/Class/Storage/DBI folder. But this method does not have access to the statement handle in order to retrieve the new key.
The way the key is retrieved in Informix is:

my $sth = $dbh->prepare('insert .....');
my $status = $sth->execute(...);

Immediately after an execute of an insert statement make the following call

my $id = $sth->{ix_sqlerrd}[1];

How can I get hold of the statement handle in order to execute this call?
Any ideas?

I am willing to try any suggestions and carry out any test necessary.

Robert Carew



More information about the DBIx-Class mailing list