<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
Hello,<br />I'd like to generate some SQL like:<br /><br />WHERE age >= 25<br />ORDER BY dept_id = ? DESC, name ASC<br /><br />The intention is, for example, to have all records with dept_id=10 on top (so the boolean expression dept_id=10 has value 1), then the others.<br /><br />I could not do it with SQL::Abstract without patching it: the patch is attached.<br /><br />This is the code<br /><br />
<pre>my $a = SQL::Abstract->new;<br />my $id=10;<br />my ($b,@bind)=$a->where({age => {">=", 25 }},<br /> [<br /> { -desc => \["dept_id=?" => ($id)] },<br /> { -asc => 'name' }<br /> ]);<br />print $b . "\n" . qq(@bind) . "\n"</pre>
<br />With the patch, @bind is (25, 10), the desired result, without the patch it is (25).<br /><br />Could you please apply the patch? Or specify a different solution not involving patching the code?<br /><br />Regards,<br />Fabrizio<br />
</body></html>
<br><br/><br/>Connetti gratis il mondo con la nuova indoona: hai la chat, le chiamate, le video chiamate e persino le chiamate di gruppo.<br />
E chiami gratis anche i numeri fissi e mobili nel mondo!<br />
Scarica subito l’app Vai su <a href='https://www.indoona.com/' target='_Blank'>https://www.indoona.com/</a><br/><br/>