Managing Results

Database Independent Abstraction Layer for C: libdbi Programmer's Guide
Prev | Chapter 4. libdbi API Reference | Next

# 4.6. Managing Results

## 4.6.1. dbi_result_get_conn

``dbi_conn dbi_result_get_conn`(dbi_result Result);`

Returns the connection belonging to the specified result object.

Arguments

  `Result`: The target query result.

Returns

  The connection belonging to the target query result.If an error occurs, the return value is NULL, and the error number is set to DBI_ERROR_BADPTR.

## 4.6.2. dbi_result_free

``int dbi_result_free`(dbi_result Result);`

Frees the result's query, disables all stored field bindings, and releases internally stored variables.

Arguments

  `Result`: The target query result.

Returns

  -1 on failure, zero on success. If a failure was caused by the database client library, the error number is set to the database engine-specific nonzero error code.

## 4.6.3. dbi_result_seek_row

``int dbi_result_seek_row`(dbi_result Result, unsigned long long rowidx);`

Jump to a specific row in a result set.

Arguments

  `Result`: The target query result.

  `rowidx`: The ordinal number of the row to seek to. The first row is at position 1, not zero.

Returns

  1 if successful, or 0 if there was an error. In the latter case, the error number is one of DBI_ERROR_BADPTR, DBI_ERROR_BADIDX, or a database engine-specific nonzero value.

## 4.6.4. dbi_result_first_row

``int dbi_result_first_row`(dbi_result Result);`

Jump to the first row in a result set.

Arguments

  `Result`: The target query result.

Returns

  1 if successful, or 0 if there was an error. In the latter case, the error number is one of DBI_ERROR_BADPTR, DBI_ERROR_BADIDX, or a database engine-specific nonzero value.

## 4.6.5. dbi_result_last_row

``int dbi_result_last_row`(dbi_result Result);`

Jump to the last row in a result set.

Arguments

  `Result`: The target query result.

Returns

  1 if successful, or 0 if there was an error. In the latter case, the error number is one of DBI_ERROR_BADPTR, DBI_ERROR_BADIDX, or a database engine-specific nonzero value.

## 4.6.6. dbi_result_prev_row

``int dbi_result_prev_row`(dbi_result Result);`

Jump to the previous row in a result set.

Arguments

  `Result`: The target query result.

Returns

  1 if successful, or 0 if there is an error. In the latter case, the error number is one of DBI_ERROR_BADPTR, DBI_ERROR_BADIDX, or a database engine-specific nonzero value.

## 4.6.7. dbi_result_next_row

``int dbi_result_next_row`(dbi_result Result);`

Jump to the next row in a result set.

Arguments

  `Result`: The target query result.

Returns

  1 if successful, or 0 if there was an error. In the latter case, the error number is one of DBI_ERROR_BADPTR, DBI_ERROR_BADIDX, or a database engine-specific nonzero value.

## 4.6.8. dbi_result_get_currow

``unsigned long long dbi_result_get_currow`(dbi_result Result);`

Returns the ordinal number of the current row in the specified result set.

Arguments

  `Result`: The target query result.

Returns

  The ordinal number of the row, or 0 if there was an error. The first row has the number 1. In case of an error, the error number is DBI_ERROR_BADPTR.

## 4.6.9. dbi_result_get_numrows

``unsigned long long dbi_result_get_numrows`(dbi_result Result);`

Returns the number of rows in the specified result set.

Arguments

  `Result`: The target query result.

Returns

  The number of rows in the result set, which may be 0 if the query did not return any datasets, or DBI_ROW_ERROR in case of an error. In that case, the error number is DBI_ERROR_BADPTR.

## 4.6.10. dbi_result_get_numrows_affected

``unsigned long long dbi_result_get_numrows_affected`(dbi_result Result);`

Returns the number of rows in the specified result set that were actually modified. Note that not all database servers support this, in which case it will always be zero. See the documentation for each specific driver for details.

Arguments

  `Result`: The target query result.

Returns

  The number of modified rows in the result set which may be 0 if no row was affected by the previous query. Also returns 0 if the database engine does not support this feature. The return value will be DBI_ROW_ERROR in case of an error. In case of an error, the error number is DBI_ERROR_BADPTR.

Prev | Home | Next
Managing Queries | Up | Retrieving Field Meta-data