## Example The following JSON is an example for this standardized configuration component: ```json [ { "Code": "rle001" , "SortingOrder": "A001" , "RegexPattern": "select name from sys\\.databases where HAS_PERMS_BY_NAME\\('\\[' \\+ replace\\(name,'\\]','\\]\\]'\\) \\+ '\\]', 'DATABASE', 'SELECT'\\) = 1" , "Replacement": "select 'master'" , "NextCodeOnMatch": "EXIT" , "NextCodeOnNoMatch": null } , { "Code": "EXIT" , "SortingOrder": "EXIT" , "RegexPattern": "dummy" , "Replacement": "dummy" , "NextCodeOnMatch": null , "NextCodeOnNoMatch": null , "ExitSuccess": true } ] ``` ## Definition ### `QueryRewriteRules` The query rewrites consist of a list of rules: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "QueryRewriteRules.schema.json", "title": "QueryRewriteRules", "description": "Collection of query rewrite rules.", "type": "array", "items": { "$ref": "QueryRewriteRule.schema.json" } } ``` ### `QueryRewriteRule` ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "QueryRewriteRule.schema.json", "title": "QueryRewriteRule", "description": "Query rewrite rule.", "type": "object", "additionalProperties": false, "properties": { "MetadataType": { "type": [ "string", "null" ], "default": "Invantive.UniversalSQL.Server.Integration.QueryRewriteRule", "description": "Type.", "readOnly": true }, "Code": { "type": [ "string", "null" ], "description": "Unique code of the query rewrite rule." }, "SortingOrder": { "type": [ "string", "null" ], "description": "Alphanumeric sorting order that determines the order to apply the rules." }, "IsEnabled": { "type": "boolean", "default": true, "description": "Whether the rule is enabled." }, "RegexPattern": { "type": [ "string", "null" ], "description": "Regular expression pattern." }, "IgnoreCase": { "type": "boolean", "default": false, "description": "Whether to ignore case." }, "Multiline": { "type": "boolean", "default": false, "description": "Whether to apply as multiline." }, "Singleline": { "type": "boolean", "default": false, "description": "Whether to apply as single line." }, "IgnorePatternWhitespace": { "type": "boolean", "default": false, "description": "Whether to ignore pattern whitespace." }, "MaximumApplications": { "type": "integer", "default": -1, "description": "The maximum number of applications (-1 means "replace all occurrences")." }, "Replacement": { "type": [ "string", "null" ], "description": "The replacement." }, "NextCodeOnNoMatch": { "type": [ "string", "null" ], "description": "Code of next query rewrite rule on no match." }, "NextCodeOnMatch": { "type": [ "string", "null" ], "description": "Code of next query rewrite rule on match." }, "ExitError": { "type": "boolean", "default": false, "description": "Whether to stop rewriting rules with an error on match." }, "ExitErrorMessage": { "type": [ "string", "null" ], "description": "Message to shown on an exit from processing with error." }, "ExitSuccess": { "type": "boolean", "default": false, "description": "Whether to stop rewriting rules with success on match." } } } ```