On 7/27/06 2:31 PM, Jonathan Vanasco wrote:
> what i did notice was a lot of confusion i had from the docs:  the
> only place I could find OR / AND under the Manager was in reference
> to update/delete, in which the parameters are specifically nested in
> a where clause.

In the documentation for get_objects:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Manager.pm#get
_objects

under the "query" parameter it says:

"For the complete list of valid parameter names and values, see the
documentation for the query parameter of the build_select function in the
Rose::DB::Object::QueryBuilder module."

Then, in the QueryBuilder docs:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/QueryBuilder.p
m#build_select

under where it says this:

"Nested boolean logic is possible using the special keywords and and or"

there's this example query:

      query   =>
      [
        or =>
        [
          and => [ category => undef, type => 'aux' ],
          category => [ 'sports', 'science' ],
        ],
        type     => 'news',
        title    => { like => [ '%million%',
                                '%resident%' ] },
      ],

Note that the arguments to "or => ..." and "and => ..." are a references to
arrays of parameters in the same form that they would appear if they were
arguments to the top-level query.  For example:

    # WHERE foo = 'bar' AND bee = 123
    query =>
    [
      foo => 'bar',
      bee => 123,
    ]

Query conditions are "and"ed by default (this is controlled by the "logic"
parameter).  To "or" those two conditions, just wrap them in a prefix "or =>
..."

    # WHERE foo = 'bar' OR bee = 123
    query =>
    [
      or =>
      [
        foo => 'bar',
        bee => 123,
      ],
    ]

(there are also nested boolean logic examples in the tutorial)
-John



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to