Re: search on Oracle CHAR primary key column
[prev]
[thread]
[next]
[Date index for 2004/08/27]
I looked into this a bit, and it appears the data_type method does
eventually use bind_param, but this only gets used in _insert_row.
Would it be possible to insert a similar call into sth_to_objects like
below?
my (%data, @rows);
$class->_bind_param($sth, $cols); <-------
eval {
$sth->execute(@$args) unless $sth->{Active};
$sth->bind_columns(\(@data{ @{ $sth->{NAME_lc} } }));
push @rows, {%data} while $sth->fetch;
};
I got a somewhat hacked sample working, but ran into some issues:
1) I wasn't sure where to get the current column list, so I passed it
from _do_search. There might be a better way.
2) I couldn't get the DBI bind_param method inside _bind_param to use
$type properly. I could only get it to work when I did this:
sub _bind_param {
my ($class, $sth, $keys) = @_;
my $datatype = $class->__data_type or return;
for my $i (0 .. $#$keys) {
if (my $type = $datatype->{ $keys->[$i] }) {
$sth->bind_param( $i+1, undef, {TYPE => SQL_CHAR}); <-------
}
}
}
But we're on an old version of DBI, so that might be the problem.
Would it be worth it for me to pursue a patch of some sort?
Thanks,
Jim
On Aug 26, 2004, at 11:56 AM, Tim Bunce wrote:
>> I found a reference to the data_type method on the kwiki:
>>
>> http://www.class-dbi.com/cgi-bin/wiki/index.cgi?WorkingWithBlobs
>>
>> but was unable to get it to work.
>
> That's probably the right approach though, so start debugging CDBI...
==========================================
Jim Brandt
Administrative Computing Services
University at Buffalo