Closed bigpresh closed 12 years ago
OK, this support has been added, and a new developer release, version 1.60_01, pushed to CPAN.
@bor, if you have a moment, would you mind trying out the new release and seeing if it suits your needs and works well?
The new features pass the new tests I added to exercise them, so I'm quite confident all is well, but I'd like to see CPAN testers reports too, and also hear whether they're good for you.
A second developer release, 1.60_02, went out last night. CPAN testers results for the previous one looked good, but I'd forgotten to add the new t/02-handle.t
to the MANIFEST, so not all the new tests were being run. D'oh!
I'll wait for sufficient CPAN testers results for 1.60_02, and if it looks good, ship it.
Stable release 1.70 went to CPAN just now, containing these new features.
sorry, no time for test I'll try now 1.70 and report then
order_by works fine for me, thank you
@bor on IRC requested support for "order by" clauses in the
quick_select
convenience method.I think the cleanest way to handle this is to repurpose the optional 3rd arg to quick_select() to be a hashref of options (but still supporting the current documented usage of an arrayref of column names), so you could say e.g.:
database->quick_select('people', { gender => 'male' }, { order_by => 'age' });
I think it would make sense to roughly follow SQL::Abstract's approach to this:
https://metacpan.org/module/SQL::Abstract#ORDER-BY-CLAUSES
So, you could say
sort_by => 'age'
,sort_by => [ qw(age height)]
,sort_by => { desc => age }
, etc.Passing an arrayref of column names as the 3rd arg would still be accepted for backwards compatibility, but the new documented way would be to pass a hashref containing a
columns
option, e.g.:database->quick_select('people', { gender => 'male' }, { columns => [ qw(name email)] });