[Dbix-class] Cross product joins
Gavin Carr
gavin at openfusion.com.au
Sun Jan 11 10:47:17 GMT 2009
Is there a way to do cross-product joins in DBIx::Class i.e. joins
without a relationship and without the ON/USING clauses? e.g.
SELECT s.name, distance(s.location, p.centre)
FROM store s CROSS JOIN postcode p
WHERE p.postcode = '12345';
'join' doesn't seem like it will work since there's no db relationship
between these tables at all, and my 'from' fu is failing me - the
following:
$rs = $schema->resultset('Store')->search({
'p.postcode' => $postcode,
}, {
alias => 's',
from => [
{ s => 'store' },
[
{ p => 'postcode', -join_type => 'cross' },
[],
{}, # or undef, or omitted
],
],
});
generates a hanging ON clause:
ERROR: syntax error at or near "WHERE" at character 239 [for Statement
"SELECT [...] FROM store s JOIN postcode p ON WHERE ( p.postcode = ? )"
with ParamValues: 1='12345']
Am I doing something wrong here, or is this just not supported?
(DBIx::Class 0.08010, in case that matters)
Cheers,
Gavin
More information about the DBIx-Class
mailing list