Hi Mr. Bunce,

Thanks for you help last time.

The fix is working for DBIv1.55. Now, I am trying to make my code backward
compatible with DBIv1.53.

In DBIv1.53  the if statement does not evaluate to true (like it does in
DBIv1.55):

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

Is there an equivalent for the above code in DBIv1.53?

Since, I cannot include the following code (because of compile error when
using with DBIv1.55 - and I need it to work with both DBIv1.55 and
DBIv1.53):

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

I have also tried the following:

if (DBIc_CACHED_KIDS(imp_dbh)) {
   hv_undef( DBIc_CACHED_KIDS(imp_dbh) );
}

But this does not seem to work. Using DBIv1.53 dbh->{CachedKids} does not
evaluate to undef after disconnect.

You do not seem to be using any macros which I can use to distinguish the
two cases.

Any information on this is greatly appreciated.

Thank you,
Swetha



                                                                       
             Tim Bunce                                                 
             <[EMAIL PROTECTED]                                         
             com>                                                       To
                                       Swetha Patel/Lenexa/[EMAIL PROTECTED]   
             05/15/2007 03:32                                           cc
             PM                        [EMAIL PROTECTED], Kellen F   
                                       Bombardier/Lenexa/[EMAIL PROTECTED], 
Manas
                                       Dadarkar/Lenexa/[EMAIL PROTECTED],      
                                       [email protected]                
                                                                   Subject
                                       Re: Updating to DBI 1.55 breaks 
                                       DBD::DB2 due to change in       
                                       DBIc_CACHED_KIDS                
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       




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.

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]

<<inline: graycol.gif>>

<<inline: pic27163.gif>>

<<inline: ecblank.gif>>

Reply via email to