Class SchemaNames
- NodePattern aka Label
- RelationshipPattern aka Type
- PropertyLookup
A schema name must be escaped in statements with backticks - also known as grave accents - (`) when it contains
content that is not a valid identifier or if the name is a reserved word.
Backticks themselves must be escaped with a backtick itself: ``.
We always treat two consecutive backticks as escaped backticks. An odd number of backticks will
always lead to another backtick being inserted so that the single one will be escaped proper. As a concrete example
this means an input like ``` will be sanitised and quoted as ``````. These are one leading and one
closing backtick as this schema name needs to be quoted plus one more to escape the outlier. When used as a label or
type, the resulting label will be ``.
This utility can be used standalone, the distributed module does not have any dependencies. Shading is ok as well, there is no encapsulation to break.
- Since:
- 2022.8.0
- Author:
- Michael J. Simons
-
Method Summary
Modifier and TypeMethodDescriptionSanitizes the given input to be used as a valid schema name, adds quotes if necessarySanitizes the given input to be used as a valid schema nameSanitizes the given input to be used as a valid schema name
-
Method Details
-
sanitize
Sanitizes the given input to be used as a valid schema name, adds quotes if necessary- Parameters:
value- The value to sanitize- Returns:
- A value that is safe to be used in string concatenation, an empty optional indicates a value that cannot be safely quoted
-
sanitize
Sanitizes the given input to be used as a valid schema name- Parameters:
value- The value to sanitizeenforceQuotes- If quotation should be enforced, even when not necessary- Returns:
- A value that is safe to be used in string concatenation, an empty optional indicates a value that cannot be safely quoted
-
sanitize
Sanitizes the given input to be used as a valid schema name- Parameters:
value- The value to sanitizeenforceQuotes- If quotation should be enforced, even when not necessarymajor- Neo4j major version, use a value < 0 to assume the latest major versionminor- Neo4j minor version, use a value < 0 to assume any minor version- Returns:
- A value that is safe to be used in string concatenation, an empty optional indicates a value that cannot be safely quoted
-