Tim Bunce wrote:
Umm, okay. The key problem here is that DBD::DB2 isn't using the
Driver.xst 'driver template' file that the DBI provides.

This means that, apart from duplicating a bunch of code, you're also
missing out on a bunch of optimizations.

The Driver.xst file and related info is discussed in
http://search.cpan.org/~timb/DBI/lib/DBI/DBD.pm

Take a look at others drivers, like DBD::Sybase and/or DBD::Oracle, for more 
examples.

If you're desparate for a quick fix you can use this code instead:

        SV **svp = hv_fetch((HV*)SvRV(h), "CachedKids", 10, 0);
        if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) {
            hv_clear((HV*)SvRV(*svp));
        }

but you're likely to bump into similar issues in later versions.

Driver.xst is the way to go.

Tim.

Tim,

Would you mind expanding on this a little for me. Someone on MAC OS X is getting "invalid lvalue in assignment" on the lines in ODBC.xsi containing

DBIc_CACHED_KIDS(imp_dbh) = Nullhv

which I notice may resolve to Nullhv = Nullhv.

Is DBD::ODBC doing the wrong thing?

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

On Tue, May 15, 2007 at 10:56:13AM -0500, Swetha Patel wrote:
   Hi Mr. Bunce,

   I work for IBM, and was trying to update the DBD::DB2, so that it works with 
DBI 1.55. In doing so I
   came accross a compile error
   "DB2.xs", line 115.9: 1506-025 (S) Operand must be a modifiable lvalue.
   Line 115 is: DBIc_CACHED_KIDS(imp_dbh) = Nullhv.

   In our code it has effectd these three lines (in DB2.xs):

   if (DBIc_CACHED_KIDS(imp_dbh)) {
   SvREFCNT_dec(DBIc_CACHED_KIDS(imp_dbh));
   DBIc_CACHED_KIDS(imp_dbh) = Nullhv;
   }

   I noticed that DBIc_CACHED_KIDS in DBI 1.53 was a macro for _imp2com(imp, 
cached_kids).
   And _imp2com(p,f) is a macro for ((p)->com.f).

   So in effect DBIc_CACHED_KIDS(imp_dbh) became imp->com.cached_kids in DBI 
1.53.

   But in DBI 1.55
   #define DBIc_CACHED_KIDS(imp) Nullhv
   And in effect in DBI 1.55 it becomes
   Nullhv = Nullhv;
   And hence the compile error.
   I am not sure what imp->com.cached_kids is used for.
   I have also done a diff on the two versions of DBI.xs, and noticed that 
these three lines where deleted
   in the new DBI.xs, although there were some other things added.
   Any information on this change and information regarding the replacement for 
this change is greatly
   appreciated.

   Thanks,
   Swetha Patel
   [EMAIL PROTECTED]



Reply via email to