NOT operator for SQLA

4 messages Options
Embed this post
Permalink
Ivan Fomichev

NOT operator for SQLA

Reply Threaded More More options
Print post
Permalink
Hello,

Is there a conceptual obstacle to introduce NOT operator, that accepts
hashref as an argument, like this:

  my ($where, @bind) = $sql->where(
      {
          -not => {
              id => {
                  '>' => 5,
                  '<' => 10,
              }
          }
      }
  );
  is_deeply(
      [$where, @bind],
      [' WHERE ( NOT ( ( id < ? AND id > ? ) ) )', 10, 5],
      '-not');


Regards,
Ivan

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Alexander Hartmaier

Re: NOT operator for SQLA

Reply Threaded More More options
Print post
Permalink
Am Donnerstag, den 30.07.2009, 08:16 +0200 schrieb Ivan Fomichev:

> Hello,
>
> Is there a conceptual obstacle to introduce NOT operator, that accepts
> hashref as an argument, like this:
>
>   my ($where, @bind) = $sql->where(
>       {
>           -not => {
>               id => {
>                   '>' => 5,
>                   '<' => 10,
>               }
>           }
>       }
>   );
>   is_deeply(
>       [$where, @bind],
>       [' WHERE ( NOT ( ( id < ? AND id > ? ) ) )', 10, 5],
>       '-not');
>
>
> Regards,
> Ivan

Remember that DBIx::Class uses SQL::Abstract which has the -not_between
operator you can use for that.

--
BR Alex


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Ivan Fomichev

Re: NOT operator for SQLA

Reply Threaded More More options
Print post
Permalink
> Remember that DBIx::Class uses SQL::Abstract which has the -not_between
> operator you can use for that.

I didn't mean a solution for this abstract particular case.

Regards, Ivan

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Peter Rabbitson-2

Re: NOT operator for SQLA

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ivan Fomichev
Ivan Fomichev wrote:

> Hello,
>
> Is there a conceptual obstacle to introduce NOT operator, that accepts
> hashref as an argument, like this:
>
>   my ($where, @bind) = $sql->where(
>       {
>           -not => {
>               id => {
>                   '>' => 5,
>                   '<' => 10,
>               }
>           }
>       }
>   );
>   is_deeply(
>       [$where, @bind],
>       [' WHERE ( NOT ( ( id < ? AND id > ? ) ) )', 10, 5],
>       '-not');
>
>

nigel started some work on that, but something unexpected cropped up.
Ask him on irc what the deal with the branch is (or let us know if it
is ready for prime time as-is):

http://dev.catalyst.perl.org/svnweb/bast/log/SQL-Abstract/1.x/branches/bool_operator/

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...