Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ccgus/fmdb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ryan <robert.ryan@mindspring.com>2021-03-25 22:26:24 +0300
committerRobert Ryan <robert.ryan@mindspring.com>2021-03-25 22:26:24 +0300
commitc183a1fdce904a188b54ea5864476e4fffb148b2 (patch)
tree78c745cd2e97632aa4cf2484209bd0afcf1e3575 /README.markdown
parent3e5efdf6690cf7dce0a914c370507deee8740d33 (diff)
Add typeForColumn functions
* Add `typeForColumn` and `typeForColumnIndex` methods and tests * Update warnings in `dataForColumn` and `dataForColumnIndex` to describe SQLite behavior re zero-length blobs * Bump version to 2.7.8 This should permit accurate handling of zero-length BLOBs, e.g., in Swift: ```swift let fileURL = URL(fileURLWithPath: NSTemporaryDirectory()) .appendingPathComponent("test.sqlite") do { let db = FMDatabase(url: fileURL) db.open() try db.executeUpdate("CREATE TABLE test (data BLOB)", values: nil) let data = "foo".data(using: .utf8)! let sql = "INSERT INTO test (data) VALUES (?)" try db.executeUpdate(sql, values: [data]) try db.executeUpdate(sql, values: [Data()]) try db.executeUpdate(sql, values: [NSNull()]) let rs = try db.executeQuery("SELECT * FROM test", values: nil) while rs.next() { let type = rs.type(forColumnIndex: 0) switch type { case .blob: if let data = rs.data(forColumnIndex: 0) { print("blob with \(data.count) bytes") } else { print("blob but no data") } case .null: print("Null") default: print("type is \(type)") } } } catch { print(error) } ``` That will produce: ``` blob with 3 bytes blob but no data Null ```
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown2
1 files changed, 1 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown
index c1fef18..6aa06ed 100644
--- a/README.markdown
+++ b/README.markdown
@@ -78,7 +78,7 @@ Declare FMDB as a package dependency.
.package(
name: "FMDB",
url: "https://github.com/ccgus/fmdb",
- .upToNextMinor(from: "2.7.7")),
+ .upToNextMinor(from: "2.7.8")),
```
Use FMDB in target dependencies