|
| int | kdbc_next (kdbc_result *rs) |
| | Advance to the next row.
|
| int | kdbc_col_count (kdbc_result *rs) |
| | Get the number of columns in the result set.
|
| const char * | kdbc_col_name (kdbc_result *rs, int col) |
| | Get a column name by index.
|
| const char * | kdbc_col_label (kdbc_result *rs, int col) |
| | Get a column label (alias) by index.
|
| kdbc_type | kdbc_col_type (kdbc_result *rs, int col) |
| | Get the type of a column value in the current row.
|
| int | kdbc_is_null (kdbc_result *rs, int col) |
| | Check if a column value is NULL.
|
| int64_t | kdbc_get_long (kdbc_result *rs, int col) |
| | Get a column value as a 64-bit integer.
|
| double | kdbc_get_double (kdbc_result *rs, int col) |
| | Get a column value as a double.
|
| const char * | kdbc_get_string (kdbc_result *rs, int col) |
| | Get a column value as a UTF-8 string.
|
| const void * | kdbc_get_blob (kdbc_result *rs, int col, size_t *out_len) |
| | Get a column value as a binary blob.
|
| int | kdbc_get_timestamp (kdbc_result *rs, int col, int *year, int *month, int *day, int *hour, int *minute, int *second, int *usec) |
| | Get a column value as a timestamp (date + time).
|
| int | kdbc_get_date (kdbc_result *rs, int col, int *year, int *month, int *day) |
| | Get a column value as a date (no time component).
|
| int | kdbc_get_time (kdbc_result *rs, int col, int *hour, int *minute, int *second, int *usec) |
| | Get a column value as a time (no date component).
|
| void | kdbc_result_close (kdbc_result *rs) |
| | Close a result set and free resources.
|
Navigate rows and retrieve column values from query results.
All column indices are 1-indexed. String and blob pointers are valid until the next kdbc_next() call or kdbc_result_close().
printf("%lld: %s\n", (long long)id, name);
}
kdbc_result * kdbc_execute_query(kdbc_conn *conn, const char *sql)
Execute a non-parameterized SELECT directly.
int kdbc_next(kdbc_result *rs)
Advance to the next row.
void kdbc_result_close(kdbc_result *rs)
Close a result set and free resources.
int64_t kdbc_get_long(kdbc_result *rs, int col)
Get a column value as a 64-bit integer.
const char * kdbc_get_string(kdbc_result *rs, int col)
Get a column value as a UTF-8 string.
int kdbc_is_null(kdbc_result *rs, int col)
Check if a column value is NULL.
struct kdbc_result kdbc_result
Opaque result set handle.
Definition kdbc.h:47
Get the type of a column value in the current row.
Lets a caller retrieve a value with the getter that matches the column instead of guessing from the text form — a text column holding digits is KDBC_TYPE_STRING, not a number, and a binary column is KDBC_TYPE_BLOB rather than whatever its bytes look like as text.
Databases that type values per row rather than per column (SQLite) report the type of the value in the current row, so call this after kdbc_next.
- Parameters
-
| rs | A result set. |
| col | Column index (1-indexed). |
- Returns
- The column type, or KDBC_TYPE_STRING when the index is invalid or the driver cannot report one.