mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Documentation
This commit is contained in:
1 parent
aa8b1f39b3
commit
07dbee52cd
1 file changed
+4
-4
@@ -707,10 +707,10 @@ Generally speaking, you can extract the type you need, *provided it can be conve
|
||||
- **Invalid conversions throw a fatal error.**
|
||||
|
||||
```swift
|
||||
let row = Row.fetchOne(db, "SELECT 'foo'")!
|
||||
row.value(atIndex: 0) as String // "foo"
|
||||
row.value(atIndex: 0) as Date? // fatal error: could not convert "foo" to Date.
|
||||
row.value(atIndex: 0) as Date // fatal error: could not convert "foo" to Date.
|
||||
let row = Row.fetchOne(db, "SELECT 'Mom’s birthday'")!
|
||||
row.value(atIndex: 0) as String // "Mom’s birthday"
|
||||
row.value(atIndex: 0) as Date? // fatal error: could not convert "Mom’s birthday" to Date.
|
||||
row.value(atIndex: 0) as Date // fatal error: could not convert "Mom’s birthday" to Date.
|
||||
```
|
||||
|
||||
This fatal error can be avoided with the [DatabaseValueConvertible.fromDatabaseValue()](#custom-value-types) method.
|
||||
|
||||
Reference in new issue
Block a user