Skip to content

Commit 2d4950c

Browse files
committed
Add SQLStatement.isReadOnly
1 parent 68b324a commit 2d4950c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/SwiftSQL/SQLStatement.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public final class SQLStatement {
5959
sqlite3_stmt_busy(ref) != 0
6060
}
6161

62+
/// Returns true if the statement makes no direct changes to the content of the database file.
63+
///
64+
/// - note: For more information see [documentation](https://www.sqlite.org/c3ref/stmt_readonly.html).
65+
public var isReadOnly: Bool {
66+
sqlite3_stmt_readonly(ref) != 0
67+
}
68+
6269
init(db: SQLConnection, ref: OpaquePointer) {
6370
self.db = db
6471
self.ref = ref

0 commit comments

Comments
 (0)