Skip to content

Structure

SQLIdentifier

A fundamental syntactical expression - a quoted identifier (also often referred to as a “name” or “object name”).
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

Instance Properties

  • string
    The 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

  • SQLExpression
  • Swift.ExpressibleByExtendedGraphemeClusterLiteral
  • Swift.ExpressibleByStringLiteral
  • Swift.ExpressibleByUnicodeScalarLiteral
  • Swift.Sendable
  • Swift.SendableMetatype

See Also

Syntactic Expressions

  • SQLBinaryExpression
    A fundamental syntactical expression - a left and right operand joined by an infix operator.
  • SQLBinaryOperator
    SQL binary expression operators.
  • SQLBind
    A parameterizied value bound to the SQL query.
  • SQLFunction
    A call to a function available in SQL, expressed as a name and a (possibly empty) list of arguments.
  • SQLGroupExpression
    A fundamental syntactical expression - an arbitrary expression or list of expressions, surroudned by parenthesis.
  • SQLList
    A fundamental syntactical expression - a list of subexpresions with a specified “separator” subexpression.
  • SQLLiteral
    A fundamental syntactical expression - one of several various kinds of literal SQL expressions.
  • SQLRaw
    A fundamental syntactical expression - an arbitrary string of raw SQL with no escaping or formating of any kind.