WHERE clause hash/table for selective replacement

2 messages Options
Embed this post
Permalink
Matt Whipple

WHERE clause hash/table for selective replacement

Reply Threaded More More options
Print post
Permalink
I'm using a simple functionality for which I'm wondering whether there
is an existing better integrated solution available: storing the various
criteria of a WHERE clause within a hash with named keys to allow for
selective modification of pieces of the clause.  For example in pseudocode:

%where =
    date               => today
    client             => some_guy
    product         => thingy

Do a bunch of stuff...

%where =
    date               => last_month
    (retain all the other criteria)


Again...this is fairly simple but was wondering if there's anything
existing to tie it all in to the system transparently.
           

_______________________________________________
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@...
Matt Whipple

Re: WHERE clause hash/table for selective replacement

Reply Threaded More More options
Print post
Permalink
Matt Whipple wrote:

> I'm using a simple functionality for which I'm wondering whether there
> is an existing better integrated solution available: storing the
> various criteria of a WHERE clause within a hash with named keys to
> allow for selective modification of pieces of the clause.  For example
> in pseudocode:
>
> %where =
>    date               => today
>    client             => some_guy
>    product         => thingy
>
> Do a bunch of stuff...
>
> %where =
>    date               => last_month
>    (retain all the other criteria)
>
>
> Again...this is fairly simple but was wondering if there's anything
> existing to tie it all in to the system transparently.
>          
I realized belatedly that my pseudocode doesn't really help in
differentiating what I'm looking for from standard behavior (and the
mailman issue had me worried that I had a bunch of RTFM replies waiting
for me).  The labels /keys themselves are not related to the underlying
DB and the values would be full SQL::Abstract criteria.  Actually, for
now, disregard the whole question since I don't know whether it would be
useful often enough to warrant (and it's easily enough done manually).

> _______________________________________________
> 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@...


_______________________________________________
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@...