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

Toby Corkindale tjc at wintrmute.net
Tue May 9 14:04:13 CEST 2006


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.. ;)

tjc

On Tue, May 09, 2006 at 12:40:51PM +0100, Toby Corkindale wrote:
> On Mon, May 08, 2006 at 08:23:10PM +0100, Matt S Trout wrote:
> > Toby Corkindale wrote:
> > > Hi,
> > > I'm trying to do some work with large objects (blobs) in PostgreSQL, via a
> > > DBIx::Class::Schema-based database.
> > > Is this the correct way to get at the $dbh to use?
> > > my $dbh = $c->model('DB')->schema->storage->_dbh;
> > 
> > No, ->dbh is the method you'd want.
> > 
> > More importantly, why do you need to get at the dbh for this anyway?
> 
> I want access to read/write/seek/tell on the blob fh.
> 
> Is there a DBIx class method to do this already? I couldn't find anything with
> Google or CPAN when I was searching yesterday, but sometimes it's all about
> just knowing the right thing to search for..
> 
> tjc

-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --keyserver www.co.uk.pgp.net --recv-key B1CCF88E)



More information about the Dbix-class mailing list