Hi John (and others),

I've just finished scrolling through your existing discussion started  
here:

http://sourceforge.net/mailarchive/message.php?msg_id=15184811

I also have a bytea column that i'm trying to get data in and out of.  
I've always known in the past that when dealing with postgres and  
bytea columns, you can't simply do $dbh->quote($val) or use a  
placeholder for bytea columns. The only way is to do a bind_param for  
every param. Which as you have already discussed, could be quite a  
lot of overhead. I'd be interested in how much though, because I  
wouldn't be surprised if that is what DBI is actually doing  
internally when you pass all your bind_params to execute(). It  
doesn't look to me like the PG_BYTEA() stuff will ever be fixed.

Anyway, as you guys discussed, I have no problems when i do something  
like this:

__PACKAGE__->meta->setup(
     table        => 'foo',
     columns      => [
        id    => { type => 'integer', not_null => 1 },
         image => { type => 'blob', methods => { get_set =>  
'_image' } },
);

sub _image {
     my $self = shift;
     return pack('H*', $self->_image) unless @_;
     return $self->_image(unpack('H*', shift));
}

I initially had that pack/unpack around the other way, but the above  
seems to work. If I print $foo->image to my browser (with the correct  
content type header), it prints the image perfectly.

However, like you guys already said, there is no real point storing  
this in a bytea field as it's really just text, and it's also storing  
25% more data than a bytea field normally would.

I'd be interested to know if you have any plans for proper bytea  
support? Or maybe there is cause here for adding some sort of bytea  
wrapper that packs/unpacks for you transparently? I didn't see the  
null value problem that you guys mentioned in the previous  
discussion, so maybe that has been fixed elsewhere.

OT: Probably worth a different thread, but anywho. I had troubles  
with a column name of "cast" that was quoted properly in my schema,  
but RDBO was not quoting it correctly and throwing SQL errors  
everywhere. Is there some hook where I need to add it? For now I have  
just renamed the column. There is the DBI->quote_identifier method  
that maybe I should be using somewhere?

kind regards,
Danial Pearce

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to