You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -421,6 +421,17 @@ The following arguments are strictly optional and may be used either in `Query`'
421
421
* *limit*: `None` by default (ie "no limit"), this option can be an integer >= 1 if specified, and limits the returned row enumeration to the requested number of results. Often used with *offset*, as defined above.
422
422
* *case-sensitive* is normally `True`. If it is set to `False`, the condition string will be uppercased, and the query will be executed without regard to case. This allows for more permissive matching on the names of resources, collections, data objects, etc.
423
423
* *options* is a bitmask of extra options, and defaults to a value of 0. `genquery.Option.NO_DISTINCT` is one such extra option, as is RETURN_TOTAL_ROW_COUNT (although in the latter case, using the `Query` object's `row_count` method should be preferred.)
424
+
* *parser* defines which GenQuery parser to use for querying the catalog. The following values are supported:
425
+
- `Parser.GENQUERY1` configures the `Query` object to use GenQuery1 (i.e. the traditional parser). This is the default.
426
+
- `Parser.GENQUERY2` configures the `Query` object to use GenQuery2. GenQuery2 is an experimental parser with several enhancements over GenQuery1.
427
+
- When using the GenQuery2 parser, the following applies:
428
+
- The `output` constructor parameter is ignored.
429
+
- The `case_sensitive` constructor parameter is ignored.
430
+
- The `options` constructor parameter is ignored.
431
+
- The `total_rows` member function of the `Query` class always returns `None`.
432
+
* *order_by* is a string holding the sorting instructions for a GenQuery2 query. The string must be a comma-delimited list of GenQuery2 columns (or expressions). For example, `order_by='COLL_NAME, DATA_NAME'`. For more examples, see [How do I sort data using the Query class and GenQuery2?](#how-do-i-sort-data-using-the-query-class-and-genquery2). Defaults to an empty string. Only recognized by the GenQuery2 parser.
433
+
434
+
When the processing of a GenQuery2 resultset is complete, it is best practice to call the `close()` member function. Doing this will instruct the server to immediately free any resources allocated to the `Query` object. This is extremely important when multiple `Query` objects are executed within a single rule.
424
435
425
436
## Questions and Answers
426
437
@@ -502,3 +513,42 @@ Upon invoking `nrep_rule`, a message very similar to the one that follows will a
502
513
"server_zone":"tempZone"
503
514
}
504
515
```
516
+
517
+
## How do I escape embedded single quotes using the Query class and GenQuery2?
518
+
519
+
GenQuery2 provides two ways to escape embedded single quotes. They are as follows:
520
+
- Use a single quote to escape a single quote as defined by the SQL standard
521
+
- Or, use the hexadecimal encoding
522
+
523
+
Below, we demonstrate each escape mechanism on the data object name, `'_quotes_around_me_'`.
0 commit comments