Documentation

This commit is contained in:
Gwendal Roué committed 2016-09-17 05:58:50 +02:00
1 parent aa8b1f39b3
commit 07dbee52cd
1 file changed
+4 -4
+4 -4
View File
@@ -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.