Re: search on Oracle CHAR primary key column

[prev] [thread] [next] [Date index for 2004/08/27]

From: Jim Brandt
Subject: Re: search on Oracle CHAR primary key column
Date: 19:28 on 27 Aug 2004
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

search on Oracle CHAR primary key column
Jim Brandt 14:19 on 25 Aug 2004

Re: search on Oracle CHAR primary key column
Adam Przygienda 15:25 on 25 Aug 2004

Re: search on Oracle CHAR primary key column
Jay Strauss 15:32 on 25 Aug 2004

Re: search on Oracle CHAR primary key column
Jim Brandt 14:43 on 26 Aug 2004

Re: search on Oracle CHAR primary key column
Tim Bunce 15:56 on 26 Aug 2004

Re: search on Oracle CHAR primary key column
Jim Brandt 19:28 on 27 Aug 2004

Re: search on Oracle CHAR primary key column
Tony Bowden 10:05 on 30 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52