Skip to content

Commit cef6655

Browse files
committed
Document SQLRow
1 parent c3cc108 commit cef6655

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Sources/SwiftSQL/SQLRow.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@ public struct SQLRow {
1010
let statement: SQLStatement // Storing as strong reference doesn't seem to affect performance
1111
var ref: OpaquePointer { statement.ref }
1212

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.
1419
public subscript<T: SQLDataType>(index: Int) -> T {
1520
T.sqlColumn(statement: ref, index: Int32(index))
1621
}
1722

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.
1830
public subscript<T: SQLDataType>(index: Int) -> T? {
1931
if sqlite3_column_type(ref, Int32(index)) == SQLITE_NULL {
2032
return nil
@@ -23,10 +35,12 @@ public struct SQLRow {
2335
}
2436
}
2537

38+
/// Returns a single column of the current result row of a query.
2639
public subscript<T: SQLDataType>(name: String) -> T {
2740
fatalError()
2841
}
2942

43+
/// Returns a single column of the current result row of a query.
3044
public subscript<T: SQLDataType>(name: String) -> T? {
3145
fatalError()
3246
}

0 commit comments

Comments
 (0)