On Mar 30, 2005, at 8:02 AM, Stas Bekman wrote:
Tim Bunce wrote: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 :)
it seems to work, at least for the test that I wrote.
Index: lib/DBD/mysql.pmI think it's important to not change this code but put the "am I
- # 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;
+ }
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).
OK, will work on that.
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.
You mean it should be just:
#define dbd_take_imp_data &PL_sv_yes;
?
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Patrick Galbraith Senior Software Developer [EMAIL PROTECTED] http://www.mysql.com
"Whatever action a great man performs, common men follow. Whatever standards he sets by exemplary acts, all the world pursues" -- Bhagavad Gita