| | 9 | [[Image(rfilter.png)]] |
| | 10 | |
| | 11 | They contain the queries and filters to extract the data from the database. |
| | 12 | |
| | 13 | At the time an S3Resource gets defined, a S3ResourceFilter is automatically added to it. This default filter (so called "master query") covers: |
| | 14 | |
| | 15 | - available records (i.e. not deleted) |
| | 16 | - accessible records (i.e. access permitted) |
| | 17 | - selected records by record ID and/or UID |
| | 18 | - joined records (e.g. components) |
| | 19 | |
| | 20 | It is possible to extend this filter during the request: |
| | 21 | |
| | 22 | - by a URL query |
| | 23 | - by the {{{S3Resource.add_filter()}}} method |
| | 24 | |
| | 25 | S3ResourceFilters can filter for both real fields in the database table as well as virtual (computed) fields. |
| | 26 | |
| | 27 | == Design == |
| | 28 | |
| | 29 | S3ResourceFilters consist of a hierarchical set of web2py Query and S3ResourceQuery objects, where: |
| | 30 | |
| | 31 | - Query instances represent the DAL queries ("query") |
| | 32 | - S3ResourceQuery instances represent virtual field filters ("vfltr") |
| | 33 | |
| | 34 | The process for the extraction of rows from the database is as follows: |