From c47316a84691ecfda4875ed5dc71c3c735ed667e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 18 Mar 2021 19:25:07 +0100 Subject: [PATCH] Documentation --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5e2adf91a..b8988f127 100644 --- a/README.md +++ b/README.md @@ -1741,14 +1741,12 @@ updateStatement.arguments = ["name": "Arthur", "score": 1000] selectStatement.arguments = ["Arthur"] ``` -Alternatively, you can create a statement with an [SQLLiteral] in which can safely embed raw values without any risk of syntax errors or SQL injection: +Alternatively, you can create a prepared statement with [SQL Interpolation]: ```swift -let name = "O'Brien" -let score = 1000 -let updateStatement = try db.makeUpdateStatement(literal: """ - INSERT INTO player (name, score) VALUES (\(name), \(score)) - """) +let updateStatement = try db.makeUpdateStatement(literal: "...") +let selectStatement = try db.makeSelectStatement(literal: "...") +// ~~~~~~~ ``` Update statements can be executed: