#
# Testing with a process similar to iPhone 5
#
TYPE=REPORT
URL=http://mycaldav/caldav.php/user1/home/
HEAD

AUTH=user1:user1

HEADER=User-Agent: iOS/10.7.2 (11C35) dataaccessd/1.0
HEADER=Content-Type: text/xml
HEADER=Depth: 1

#
BEGINDATA
<?xml version="1.0" encoding="UTF-8"?>
<C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav">
  <A:prop xmlns:A="DAV:">
    <A:getetag/>
    <A:getcontenttype/>
  </A:prop>
  <C:filter>
    <C:comp-filter name="VCALENDAR">
      <C:comp-filter name="VEVENT">
        <C:time-range start="20110922T000000Z"/>
      </C:comp-filter>
    </C:comp-filter>
  </C:filter>
</C:calendar-query>
ENDDATA

#
QUERY
SELECT caldav_data.dav_name, dtstart, rrule
  FROM calendar_item JOIN caldav_data USING(dav_id)
 WHERE caldav_data.dav_name ~ '^/user1/home/'
   AND caldav_data.caldav_type = 'VEVENT'
   AND (rrule IS NOT NULL OR dtstart IS NULL
        OR ( (dtend IS NULL AND dtstart > '20110922T000000Z')
              OR dtend > '20110922T000000Z'
           )
       )
ENDQUERY
