Documentation

This commit is contained in:
Gwendal Roué committed 2021-07-30 14:25:49 +02:00
1 parent dc3fac95db
commit fe95d07062
1 file changed
+2 -3
+2 -3
View File
@@ -1892,12 +1892,11 @@ while let statement = try statements.next() {
}
```
You can turn the [cursor](#cursors) returned from `allStatements` into a regular Swift array, but make sure all individual statements can compile even if the previous ones were not run:
You can turn the [cursor](#cursors) returned from `allStatements` into a regular Swift array, but in this case make sure all individual statements can compile even if the previous ones were not run:
```swift
// OK
let statements = try Array(db.allStatements(sql: "SELECT ...; SELECT ...;"))
let statements = try Array(db.allStatements(sql: "INSERT ...; UPDATE ...;"))
let statements = try Array(db.allStatements(sql: "INSERT ...; UPDATE ...; SELECT ...;"))
// Will fail since the insert statement won't compile until the table is created
let statements = try Array(db.allStatements(sql: "CREATE TABLE player ...; INSERT INTO player ...;"))