Hello John,
What about this rule:
1. if a column is not prefixed, it is the main object.
2. every other column has to be prefixed with the relationship name
I already did this and checked it in. You can still use the "tN" table
names and "tN_" column prefixes if you want, but if not, then just pretend
they don't exist and it behaves as you described above.
Cool. Now only 'sort_by' is missing. What about this:
1. if it's a scalar, use it as it is (use as sql snippet)
2. if it's a arrayref expand the column as for the 'query' parameter
Problem: ASC, DESC
Maybe:
sort_by => ['id'] ==> 't1.id'
sort_by => ['id DESC',
'prices.region',
] ==> 't1.id DESC, t2.region'
So maybe qr/^(\w+)?\.(\w+)(?: (ASC|DESC)?)$/ or something like this, to
detect, if the search order is given.
Or do some DBMS allow other search order instead of ASC or DESC?
One problem remains:
sort_by => 'COUNT(id)'
But this could be done by using the scalar.
Using "fetch_only => 1" may work, but is not documented so you shouldn't
rely on it continuing to work :) You use "fetch_only => [ 't1' ]" instead.
You never have to worry about numbering since t1 is always the primary
table.
Oh, so I had pure luck :-)
I will change to ['t1']...
Bye, Uwe
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object