[Catalyst] PostgreSQL quoting issues
Marius Kjeldahl
mariusauto-catalyst at kjeldahl.net
Wed Jan 16 14:17:58 GMT 2008
I've got an application where I do the following:
# Look up last calculated transsum if it exists
my $rsts = $c->model ('MintAppDB::TransSum')->find ({
category => $c->req->param ('category'),
sentto => $c->req->param ('sentto'),
iso => $c->req->param ('iso')
});
sentto contains an url style link, for instance
"email:marius at kjeldahl.net". Somewhere when generating SQL for this, it
becomes:
STH: SELECT me.updated, me.category, me.sentto, me.iso, me.amt FROM
mm_transsum me WHERE ( email:marius at kjeldahl.net = ? AND me.category = ? )
It seems Postgres gets confused with my usage of a variable with colon
in it, and the default quoting being done on strings somewhere in
DBD::Pg or DBIx::Class doesn't seem to pursuade Postgres from
interpreting the string with the colon in as a special "variable" field
(or whatever, I haven't looked to deep into this functionality of Postgres).
I've tried calling "quote" manually and use:
sentto => \ $myquotedstring
instead, hoping that manually calling quote from the dbh driver from
DBD::Pg would take care of it, but no such luck.
The error message being generated by Catalyst/DBIx::Class is:
Cannot mix placeholder styles ":foo" and "?"
Does anybody have an idea how I can pursuade Postgres into accepting
this as just a simple string and that Postgres shouldn't try to
interpret anything in it?
Thanks,
Marius K.
More information about the Catalyst
mailing list