[Dbix-class] Pg bytea does not work

John Napiorkowski jjn1056 at yahoo.com
Tue Oct 16 22:17:31 GMT 2007


--- Rolf Schaufelberger <rs at plusw.de> wrote:

> Hi, 
> 
> after some more debugging and  writing another test
> program doing a proper 
> connect ( MY::DBClass->clone->connection (@..)  )
> I found the following behaviour:
> 
> The create statement is the first access to the
> database. 
> Now in C:::D::Storage::DBI   $self is stil
> 'C:::D::Storage::DBI'
> it then calls  $self->source_bind_attributes which
> then obiously does the 
> wrong thing. Then it calls _execute, and somewhat
> later it calls 
> _populate_dbh . Now my storage class is ...::Pg, but
> it's too late for 
> bind_attributes. 
> 
> If I modify my program and sone kind of select
> first, it works fine!
> So , how can I force my app to _populate_dbh earlier
> without doing a placebo 
> select ?
> 
> -- 
> Regards
> Rolf Schaufelberger

Just in case anyone finds this thread in the archive
while looking for a solution, the issue we found was
that since the database doesn't get connected until
the statement is executed, any storage specific
modules are not yet loaded.  So the system for adding
the needed attribute bindings doesn't work until after
the first statement is executed.  If that first
statement needs to bind to a bytea column type, then
the code isn't going to work correctly.  It will work
for the second and all the rest.  The current
workaround is to have your schema object call the
'ensure_connected' method to force a database
connection prior to a statement being executed.

We expect to have a this patched in a future version
to do this for you automatically.  

--john



      ____________________________________________________________________________________
Check out the hottest 2008 models today at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html



More information about the DBIx-Class mailing list