Tim,
I ran into some problems with last_insert_id() while trying to implement
it for DBD::mysql 3.0. I have subjoined a patch against DBI 1.42 with the
changes that I made so that I could get last_insert_id() working from the
DBD.
Thoughts, suggestions?
Rudy.
diff -ru DBI-1.42/dbd_xsh.h DBI-1.42-working/dbd_xsh.h
--- DBI-1.42/dbd_xsh.h 2004-02-15 17:15:20.000000000 -0500
+++ DBI-1.42-working/dbd_xsh.h 2004-03-20 17:54:01.318300272 -0500
@@ -33,7 +33,7 @@
void dbd_db_destroy _((SV *dbh, imp_dbh_t *imp_dbh));
int dbd_db_STORE_attrib _((SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv));
SV *dbd_db_FETCH_attrib _((SV *dbh, imp_dbh_t *imp_dbh, SV *keysv));
-SV *dbd_db_last_insert_id _((SV *dbh, SV *imp_dbh, SV *catalog, SV *schema, SV
*table, SV *field, SV *attr));
+SV *dbd_db_last_insert_id _((SV *dbh, imp_dbh_t *imp_dbh, SV *catalog, SV
*schema, SV *table, SV *field, SV *attr));
AV *dbd_db_data_sources _((SV *dbh, imp_dbh_t *imp_dbh, SV *attr));
int dbd_st_prepare _((SV *sth, imp_sth_t *imp_sth, char *statement, SV
*attribs));
diff -ru DBI-1.42/DBI.pm DBI-1.42-working/DBI.pm
--- DBI-1.42/DBI.pm 2004-03-11 08:45:38.000000000 -0500
+++ DBI-1.42-working/DBI.pm 2004-03-20 17:57:22.818667560 -0500
@@ -383,7 +383,7 @@
commit => { U =>[1,1], O=>0x0480|0x0800 },
rollback => { U =>[1,1], O=>0x0480|0x0800 },
'do' => { U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'],
O=>0x3200 },
- last_insert_id => { U =>[3,4,'$table_name, $field_name [, \%attr ]'],
O=>0x2100 },
+ last_insert_id => { U =>[5,6,'$table_name, $field_name [, \%attr ]'],
O=>0x2820 },
preparse => { }, # XXX
prepare => { U =>[2,3,'$statement [, \%attr]'],
O=>0x2200 },
prepare_cached => { U =>[2,4,'$statement [, \%attr [, $if_active ] ]'],
O=>0x2200 },