On Tue, Mar 29, 2005 at 11:46:26PM -0500, Stas Bekman wrote: > take_imp_data support for DBD::mysql. it seems to be too simple,
The sign of a good solution... if it works :) > Index: lib/DBD/mysql.pm > - # Call msqlConnect func in mSQL.xs file > - # and populate internal handle data. > - DBD::mysql::db::_login($this, $dsn, $username, $password) > - or $this = undef; > + # if dbi_imp_data is passed then we should already have a handle, > + # with a valid connection > + unless ($privateAttrHash->{dbi_imp_data}) { > + # Call msqlConnect func in mSQL.xs file > + # and populate internal handle data. > + DBD::mysql::db::_login($this, $dsn, $username, $password) > + or $this = undef; > + } I think it's important to not change this code but put the "am I reusing imp_data" logic into the drivers _MyLogin() function. Like this: if (DBIc_IMPSET(imp_xxh)) { ...reusing imp_data... } else { ...existing code... } That way the rest of the imp_dbh_t structure gets initialised properly (and it's how most drivers will need to do it). > Index: dbdimp.c > +SV *mysql_take_imp_data(SV *h, imp_xxh_t *imp_xxh, void *foo) > +{ > + D_imp_dbh(h); > + DBIc_ACTIVE_off(imp_dbh); > + if (dbis->debug >= 2) > + PerlIO_printf(DBILOGFP, "&imp_dbh->mysql: %lx\n", > + (long) &imp_dbh->mysql); > + return &PL_sv_yes; > +} The DBIc_ACTIVE_off isn't needed. In fact, looking at DBD::Mysql's struct imp_dbh_st, mysql_take_imp_data isn't needed at all. There's no 'preparation' the driver needs to do. Tim.