Structure
SQLIdentifier
struct SQLIdentifier
Overview
Most identifiers in SQL are references to various objects - tables, columns, functions, indexes, constraints, etc.; if something is not a keyword, punctuation, or a literal, it is more likely than not an identifier.
In most SQL dialects, quoting is only required for identifiers if they contain characters not otherwise allowed in identifiers in that dialect or conflict with an SQL keyword, but may optionally be included even when not needed. For the sake of maximum correctness, maximum consistency, and avoiding the need to do expensive checks to check for invalid characters, SQLIdentifier adds quoting unconditionally.
To avoid the risk of accidental SQL injection vulnerabilities, in addition to quoting, identifiers are scanned for the identifier quote character(s) themselves; if found, they are escaped appropriately (by doubling any embedded quoting character(s), a syntax supported by all known dialects).
Topics
Initializers
init(_:)Create an identifier with a string.init(stringLiteral:)Creates an instance initialized to the given string value.
Instance Properties
stringThe actual identifier itself, unescaped and unquoted.
Instance Methods
serialize(to:)Invoked when a request is made to serialize the expression to raw SQL.
Relationships
Conforms To
SQLExpressionSwift.ExpressibleByExtendedGraphemeClusterLiteralSwift.ExpressibleByStringLiteralSwift.ExpressibleByUnicodeScalarLiteralSwift.SendableSwift.SendableMetatype
See Also
Syntactic Expressions
SQLBinaryExpressionA fundamental syntactical expression - a left and right operand joined by an infix operator.SQLBinaryOperatorSQL binary expression operators.SQLBindA parameterizied value bound to the SQL query.SQLFunctionA call to a function available in SQL, expressed as a name and a (possibly empty) list of arguments.SQLGroupExpressionA fundamental syntactical expression - an arbitrary expression or list of expressions, surroudned by parenthesis.SQLListA fundamental syntactical expression - a list of subexpresions with a specified “separator” subexpression.SQLLiteralA fundamental syntactical expression - one of several various kinds of literal SQL expressions.SQLRawA fundamental syntactical expression - an arbitrary string of raw SQL with no escaping or formating of any kind.