SQLExpressionLiteral
public struct SQLExpressionLiteral : SQLExpression
SQLExpressionLiteral is an expression built from a raw SQL snippet.
SQLExpressionLiteral(sql: "1 + 2")
The SQL literal may contain ?
and colon-prefixed arguments:
SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
-
Undocumented
Declaration
Swift
public var sql: String { get }
-
Undocumented
Declaration
Swift
public var arguments: StatementArguments { get }
-
Creates an SQL literal expression.
SQLExpressionLiteral(sql: "1 + 2") SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2]) SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
Declaration
Swift
public init(sql: String, arguments: StatementArguments = StatementArguments())
-
Creates an SQL literal expression.
SQLExpressionLiteral(literal: SQLLiteral(sql: "1 + 2") SQLExpressionLiteral(literal: SQLLiteral(sql: "? + ?", arguments: [1, 2])) SQLExpressionLiteral(literal: SQLLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2]))
With Swift 5, you can safely embed raw values in your SQL queries, without any risk of syntax errors or SQL injection:
SQLExpressionLiteral(literal: "\(1) + \(2)")
Declaration
Swift
public init(literal sqlLiteral: SQLLiteral)