msouth has asked for the wisdom of the Perl Monks concerning the following question:

Reading code on a new job, I see -nest => [array of stuff] passed in as part of a -where array in a call to SQL::Abstract.

I have searched in vain (ok, I admit that I crippled my search in the beginning by forgetting that "-nest" in google's search box eliminated any results with "nest" in them, but fixing that goof didn't help much) on the internet in general and looked through SQL::Abstract's documentation, but didn't see it.

Is it documented somewhere? What does it do?

Replies are listed 'Best First'.
Re: Is -nest part of SQL::Abstract? If so, is there documentation somewhere?
by choroba (Cardinal) on Jun 04, 2021 at 15:15 UTC
    According to Changes, it is a deprecated operator. An older version should still document it.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Ahhhhhh, I didn't even think about deprecation, thank you so much!
Re: Is -nest part of SQL::Abstract? If so, is there documentation somewhere?
by 1nickt (Canon) on Jun 04, 2021 at 20:48 UTC

    Hi,

    "What does it do?"

    Nothing you can't do with other syntax, as shown by this one-liner which reproduces the output documented for -nest in the old version choroba linked to here.

    $ perl -Mstrict -MSQL::Abstract -wE 'say +(SQL::Abstract->new->select( +"foo", "bar", { user => "nwiger", -or => [ workhrs => { ">" => 20 }, +geo => "Asia" ]}))[0]'
    SELECT bar FROM foo WHERE ( ( workhrs > ? OR geo = ? ) AND user = ? )

    Hope this helps!


    The way forward always starts with a minimal test.