[Dbix-class] Accessing $dbh for blobs/large-objects

Tim Bunce Tim.Bunce at pobox.com
Tue May 9 19:17:08 CEST 2006


On Tue, May 09, 2006 at 02:33:16PM +0100, Matt S Trout wrote:
> Toby Corkindale wrote:
> > Following on from discussion on IRC:
> > * Answer: No, D::C doesn't have blob filehandle-alike operations.
> > 
> > A crash-course in BLOBs for the uninitiated:
> > * A BLOB is a "binary large object".
> > * BLOBs can be arbitrarily large - eg. many gigabytes - so you don't really
> >   want to rely on using the normal accessor method (ie. $foo->column), as that
> >   could potentially return more data than you have RAM.
> > * Therefore, databases (well, oracle and postgresql) provide functions to
> >   access this data like filehandles - open/seek/read/write etc.
> > 
> > So, it sounds like I'm volunteering myself to write a D::C::...::BLOB::FH
> > interface at some point, unless there's a better way to do this.. ;)
> 
> No, I think that's an ideal way to do this. Better still it should be 
> possible to encapsulate the database specific stuff behind a method on 
> Storage so that we can paper over the cracks between databases (and use 
> something like IO::String to emulate it for databases that aren't smart 
> enough to provide an interface like this so you can be cross-database 
> but still get the performance advantage if you're using/if you migrate 
> to one that is smart enough).

I agree. The guts of this work should not be DBIx::Class specific,
though there may be a role for a DBIx::Class::... module to provide some glue.

> This sort of code is somewhat irritating to build, but we went through 
> this silliness for last_insert_id (and somebody's kindly contributed 
> patches that handle finding the appropriate storage type for ODBC and 
> code for auto-inc for DB2/400 over ODBC to -current) and it's *so* worth 
> it in terms of the ease of use once it's done.

I trust patches to DBI drivers are being sent to the authors, were relevant.

Tim [not really paying attention]



More information about the Dbix-class mailing list