A result set filter gets invoked whenever a result set is being sent by the database server, if the connection is not set up to use batches.
Result set filters can modify the result set, hide or add rows, modify specific values, etc... The only limitations are typically that you do not want to confuse the database client, which expects data to look a certain way.
Each packet represents a row in a result set.
Optional. If specified, only execute the filter if the result set contains at least one column from a table in the specified schema(s). If the given value starts with regex: then the rest of the value is compiled as a Java regular expression. For instance: regex:(accounting)|(acct_\p{Alnum}+)
Optional. If specified, only execute the filter if the result set contains at least one column from the specified table(s). If the given value starts with regex: then the rest of the value is compiled as a Java regular expression.
For instance: regex:(customers)|(cust_[0-9]+)
Optional. If specified, a regular expression that specifies which SQL query should be active for this filter to be executed.
For instance: ^select.+from (customers)|(cust_[0-9]+).*
Optional. If specified, a semicolon-separated list of <name>=<value> pairs, where name is the name of a column, and value is a string representation of a value.
For instance: country=US;state=MN;county=Hennepin
Defaults to and. If Column pattern was specified, and there is more than one <name>=<value> pair, specify whether these should be and'ed or or'ed.
Optional. If specified, specifies which SQL query should be active for this filter to be executed. If the given value starts with regex: then the rest of the value is compiled as a Java regular expression.
For instance: regex:^select.+from (customers)|(cust_[0-9]+).*
What to do if the row matches. The default is code, which executes the JavaScript code, the other option is hide, in which case the row will be ignored and not passed on to the database client.
A list of IP addresses (IP4 and/or IP6) and/or regular expressions for IP addresses.
Example:
12.34.56.78
1234:5678:90ab::01
regex:98\.76\..*
regex:9876:5432:.*
A list of user names and/or regular expressions for user names.
The usual context.packet variable will always be a ResultsetRow packet.
Replacing the contents of the first_name column with its initial:
context.packet.first_name = context.packet.first_name.substring(0,1) + ".";
Removing the value in the salary column:
delete context.packet.salary;