Subject: Updated CAL-QUERY

From: Doug Royer <[email-masked]>
Date: Sun, 20 Oct 2002 18:40:50 -0600

I added cap-val and included the 'PARAM()' call, so we can
select ATTACH types and help with the ATTACH problems.

I moved 'STATE()' to cap-factor because that is the only
place it can be used + I enumerated the values it
can be compared to..

I added the 'param' element as PARAM() is now used twice.

           cal-query  = "SELECT"   SP   cap-val  SP
                        "FROM"     SP   comp-name SP
                        "WHERE"    SP   cap-expr

                      / "SELECT" SP cap-cols SP
                        "FROM"   SP comp-name

                         ; NOTE: there is NO space around the "," on
                         ; the next line
           cap-val    = cap-cols / param
                      / ( cap-val "," cap-val )

                         ; NOTE: there is NO space around the "," on
                         ; the next line
           cap-cols   = cap-col / ( cap-cols "," cap-col)
                        / "*"

           cap-col    = ; Any property name found in the component
                        ; named in the comp-name used in the "FROM" clause.
                        ;
                        ;   SELECT ORGANIZER FROM VEVENT ...
                        ;
                        ; OR
                        ;
                        ; A component name of an existing component contained
                        ; inside of the comp-name used in the "FROM" clause.
                        ;
                        ;   SELECT VALARM FROM VEVENT ...

           comp-name  = "VEVENT"    / "VTODO"   / "VJOURNAL"
                      / "VTIMEZONE" / "VALARM"  / "VFREEBUSY"
                      / "VAGENDA"   / "VCAR"    / "VCALSTORE"
                      / "VQUERY"    / iana-name / x-comp

           cap-expr    = "(" cap-expr ")"
                       / cap-term

           cap-term    = cap-expr SP cap-logical SP cap-expr
                       / cap-factor

           cap-logical = "AND" / "OR"

           cap-factor  = cap-colval SP cap-oper SP col-value
                       / cap-colval SP "NOT LIKE" SP col-value
                       / cap-colval SP "LIKE" SP col-value
                       / cap-colval SP "IS NULL"
                       / cap-colval SP "IS NOT NULL"
                       / col-value SP "NOT IN" cap-colval"
                       / col-value SP "IN" cap-colval"
                       / "STATE()" "=" ( "BOOKED"
                                       / "UNPROCESSED"
                                       / "DELETED" )

           cap-colval  = cap-col /  param

           param       = "PARAM(" cap-col "," cap-param ")"

           cap-param   = ; Any parameter that may be contained in the cap-col
                         ; in the supplied PARAM() function

           col-value   = col-literal
                       / "SELF()"
                       / "CAL-OWNERS()"
                       / "CAL-OWNERS(" cal-address ")"
                       / "CURRENT-TARGET()"

           cal-address = ; A CALID as define by CAP

           col-literal = "'" literal-data "'"

          literal-data = ; Any data that matches the value type of the
                         ; column that is being compared. That is you can
                         ; not compare PRIORITY to "some string" because
                         ; PRIORITY has a value type of integer. If it is
                         ; not preceded by the LIKE element, any '%' and '_'
                         ; characters in the literal data are not treated as
                         ; wildcard characters and do not have to be backslash
                         ; escaped.
                         ;
                         ; OR
                         ;
                         ; If the literal-data is preceded by the LIKE
                         ; element it may also contain the '%' and '_'
                         ; wildcard characters. And if the literal data
                         ; that is comparing contains any '%' or '_'
                         ; characters, they MUST BE backslash escaped as
                         ; described in the notes below in order for them not
                         ; to be treated as wildcard characters.

           cap-oper    = "="
                       / "!="
                       / "&lt;"
                       / "&gt;"
                       / "&lt;="
                       / "&gt;="

           SP          = ; A single white space ascii character
                         ; (value in HEX %x20).

           x-comp      = ; As defined in RFC 2445.

           iana-name   = ; As defined in RFC 2445.

-- 
-
Doug Royer                       Work: (208)612-INET
[email-masked]                   Fax:  (866)594-8574
http://INET-Consulting.com       Cell: (208)520-4044
http://Royer.com/People/Doug