Hi,

I was attempting to tidy up some code in DBD::ODBC and noticed quite a number of tests using DBIc_ACTIVE which attempt to signal an error when the database is not active (not connected). Having never seen these errors I wrote a quick test script and got no errors when calling prepare, do etc after disconnecting. Investigating, it appears there is a bug in DBD::ODBC which fails to report these errors correctly but this led me to a few questions:

dbd_st_prepare, dbd_db_execdirect, dbd_st_tables, dbd_st_primary_keys and a host of odbc private functions in dbdimp.c receive combinations of an sth, dbh or both and do something like:

if (!DBIc_ACTIVE(imp_dbh)) {
  error code
}

I would like to commonise some of this. I know I can get my private sth from an sth (D_imp_sth) and similarly for database handle (D_imp_dbh) and I can get my private dbh from an sth with D_imp_dbh_from_sth but the DBIh_SET_ERR_CHAR macros needs a handle - how do you get SV *dbh from imp_dbh? (DBIc_PARENT_COM perhaps?)

Also, who does DBI allow prepare in a driver to be called when the dbh was disconnected?

Thanks

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to