@@ -10,11 +10,23 @@ public struct SQLRow {
10
10
let statement : SQLStatement // Storing as strong reference doesn't seem to affect performance
11
11
var ref : OpaquePointer { statement. ref }
12
12
13
- #warning("TODO: document")
13
+ /// Returns a single column of the current result row of a query.
14
+ ///
15
+ /// If the SQL statement does not currently point to a valid row, or if the
16
+ /// column index is out of range, the result is undefined.
17
+ ///
18
+ /// - parameter index: The leftmost column of the result set has the index 0.
14
19
public subscript< T: SQLDataType > ( index: Int ) -> T {
15
20
T . sqlColumn ( statement: ref, index: Int32 ( index) )
16
21
}
17
22
23
+ /// Returns a single column of the current result row of a query. If the
24
+ /// value is `Null`, returns `nil.`
25
+ ///
26
+ /// If the SQL statement does not currently point to a valid row, or if the
27
+ /// column index is out of range, the result is undefined.
28
+ ///
29
+ /// - parameter index: The leftmost column of the result set has the index 0.
18
30
public subscript< T: SQLDataType > ( index: Int ) -> T ? {
19
31
if sqlite3_column_type ( ref, Int32 ( index) ) == SQLITE_NULL {
20
32
return nil
@@ -23,10 +35,12 @@ public struct SQLRow {
23
35
}
24
36
}
25
37
38
+ /// Returns a single column of the current result row of a query.
26
39
public subscript< T: SQLDataType > ( name: String ) -> T {
27
40
fatalError ( )
28
41
}
29
42
43
+ /// Returns a single column of the current result row of a query.
30
44
public subscript< T: SQLDataType > ( name: String ) -> T ? {
31
45
fatalError ( )
32
46
}
0 commit comments