Skip Menu |

This queue is for tickets about the DBI CPAN distribution.

Report information
The Basics
Id: 71896
Status: rejected
Priority: 0/
Queue: DBI

People
Owner: Nobody in particular
Requestors: BBYRD [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.612
Fixed in: (no value)



Subject: Can't set DBI::st=HASH(0x1b0cb18)->{ParamValues}: unrecognised attribute name or invalid value
There seems to be an issue with how the ::st STORE/FETCH methods behave vs. ::db/dr/etc. The following code produces the following error: $sth->STORE('ParamValues', { map { $_ => $params->[$_-1]{val} } (1 .. $numParam) }); $sth->STORE('ParamTypes', { map { $_ => $params->[$_-1]{type} } (1 .. $numParam) }); $sth->STORE('ParamArrays', $sth->FETCH('ParamValues')); Can't set DBI::st=HASH(0x1b0cb18)->{ParamValues}: unrecognised attribute name or invalid value at ... Can't set DBI::st=HASH(0x1b0cb18)->{ParamTypes}: unrecognised attribute name or invalid value at ... Can't set DBI::st=HASH(0x1b0cb18)->{ParamArrays}: unrecognised attribute name or invalid value at ... But, using the syntax of "$sth->{'ParamValues'} = blah" seems to work fine. Why are these different? DBI::DBD talks about how important is it to put in the the various statement handle attributes, but says nothing about this difference. Either STORE should be changed to work for these statement parameters, or the DBI::DBD docs should be changed to help driver writers out about this difference.
Among these is the exception for $sth->STORE('NUM_OF_FIELDS', ###), which, if it's set using the object method, gives out the extremely unhelpful error: _set_fbav(ARRAY(0x2d45f88)): array has 5 elements, the statement handle row buffer has 0 (and NUM_OF_FIELDS is -1) at /opt/local/lib/perl5/DBD/FusionTables.pm line 820. Segmentation fault Even though I can still do: $sth->{'NUM_OF_FIELDS'} = scalar @$header; say $sth->FETCH('NUM_OF_FIELDS'); The above would report "5", but there is somehow something special with STORE, so that the XS functions actually know what the value should be. But, if you use STORE on the other ::st fields, then you get the warnings I talked about earlier. Confusing and cryptic...
You've not mentioned the driver you're using. Note that *within a driver* $h->{Foo}=... is a simple hash store so will never fail. That's because *within a driver* the $h is the *inner* hash of the tie. That's why the driver has to use $h- Show quoted text
>STORE(...) to invoke any behavior associated with setting the attribute.
I'll mark this stalled for now. It would probably be better to discuss this on the dbi-dev mailing list.
Closing this for now. Please discuss on dbi-users or dbi-dev mailing lists if you still have a problem. Thanks.