From a912c5cbe58bdabe66fecdfff735c28dcdc0a407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 18 Mar 2021 18:53:16 +0100 Subject: [PATCH] Documentation --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b90353313..5e2adf91a 100644 --- a/README.md +++ b/README.md @@ -1741,7 +1741,17 @@ updateStatement.arguments = ["name": "Arthur", "score": 1000] selectStatement.arguments = ["Arthur"] ``` -After arguments are set, you can execute the prepared statement: +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: + +```swift +let name = "O'Brien" +let score = 1000 +let updateStatement = try db.makeUpdateStatement(literal: """ + INSERT INTO player (name, score) VALUES (\(name), \(score)) + """) +``` + +Update statements can be executed: ```swift try updateStatement.execute()