bigpresh / Dancer-Plugin-Database

Dancer::Plugin::Database - easy database support for Dancer applications
http://search.cpan.org/dist/Dancer-Plugin-Database
37 stars 36 forks source link

Bugfix: Make ORDER clauses work when using WHERE clauses (missing space)... #27

Closed stapelberg closed 12 years ago

stapelberg commented 12 years ago

...

Example:

database->quick_select('nutzer', { pin => undef }, { order_by => 'handle' });

…would result in a MySQL error complaining about NULLORDER (due to missing space between the NULL of the WHERE clause and the ORDER keyword).

bigpresh commented 12 years ago

Ah, good catch, thank you!

Oddly, having added a test for this which I'd expect to fail until I merge your change, it works correctly - looking in to how now, but I will merge this anyway as it's clearly right.

bigpresh commented 12 years ago

Ah - if the WHERE clause used placeholders, all worked as expected, the problem only showed up if the WHERE clause ended with an "IS NULL" etc.

Test added in 3a5cb1f which fails because of this behaviour; now merging this fix and confirming that the test then passes.

bigpresh commented 12 years ago

I've just released 1.81 incorporating this fix - thanks again!