[Dbix-class] 2-argument SQL agregates

Matt S Trout dbix-class at trout.me.uk
Tue Mar 28 19:10:45 CEST 2006


Doran L. Barton wrote:
> Matt S Trout wrote:
>> Doran L. Barton wrote:
>>> I specifically need to use the TO_CHAR() function which takes a field
>>> name and a format string:
>>>
>>> 	SELECT foo, TO_CHAR('bar', 'Month DD YYYYY') FROM Artist
>> { TO_CHAR => [ 'bar', 'Month DD YYYY' ] } ?
>>
>> Always try the obvious thing first (this assumes you have quoting turned on. 
>> if you don't, you probably want \"'Month DD YYYY'")
> 
> That's what I thought, but it wasn't working. I've updated to DBIx::Class 
> 0.06 (was running an older version) and still having problems. Let me expose 
> more of the environment:
> 
> 	Fedora Core Linux 4 (i386) (Perl 5.8.6)
> 	PostgreSQL 8.0.7 backend
> 	DBD::Pg 1.47
> 
> Here is the error showing up in the logs now when I try using the above code 
> to include a TO_CHAR(arg1, arg2) in the code:
> 
> 	Cannot mix placeholder styles ":foo" and "?" at 
> /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/DBD/Pg.pm line 188.
> 
> Any other suggestions?

Yeah. read the Storage::DBI docs for its debugging options so we can see what 
query it's sending to the DBD. If that looks right, turn on DBI->trace so we 
can see what DBD::Pg thinks it's sending to the server. Postgres should also 
log invalid statements with appropriate options set, although I don't remember 
the incantation off-hand.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list