[Dbix-class] JOIN question
Bernhard Graf
dbic2 at augensalat.de
Tue Nov 28 22:30:32 GMT 2006
/me wrote:
> The question still is how to modify the code to support constant
> values to express something like
>
> { 'table1.key' => \'!=table2.key', 'table1.maximum => {'<', 23}}
>
> that should result in
>
> table1.key != table2.key AND table1.maximum < "23"
turned out that this cannot be easily achived, because of shortcomings
in SQL::Abstract, which doesn't support placeholders in the FROM-part
of a query.
SQL::Abstract::_recurse_where(), which is also (mis-)used to build the
part between "FROM" and "WHERE", returns an array, where the first
element is the query part that might contain "?" and subsequent values
are the bind-values. The simplest solution would be to replace all
"?"-placeholders in the first argument by the $dbh->quote()'d
subsequent values before feeding the string to SQL::Abstract::select().
At the moment I tend to simply throw_exception() if the ON-part of the
JOIN isn't either a scalar or a scalar reference.
--
Bernhard Graf
More information about the Dbix-class
mailing list