DBD Helper Functions

Database Independent Abstraction Layer for C: libdbi Driver Author's Guide (OUTDATED SEE README!)
Prev | Chapter 2. Driver Functions | Next

# 2.3. DBD Helper Functions

## 2.3.1. _dbd_result_create

    dbi_result_t *_dbd_result_create(dbi_conn_t *conn, void *handle, unsigned int numrows_matched, unsigned int numrows_affected)

Allocates a new dbi_result_t, filling the number of rows matched and affected, storing the database-specific result handle, and allocating room for rows to be stored.

Arguments

  `conn`: The target connection.

  `handle`: The database-specific result handle used internally by the driver.

  `numrows_matched`: The number of rows matched by the query.

  `numrows_affected`: The number of rows affected by the query.

Returns

  A new DBI result object.

## 2.3.2. _dbd_result_set_numfields

    void _dbd_result_set_numfields(dbi_result_t *result, unsigned int numfields)

Sets a result's number of fields and allocates room for field information to be stored.

Arguments

  `result`: The target result.

  `numfields`: The number of fields in the result set.

## 2.3.3. _dbd_result_add_field

    void _dbd_result_add_field(dbi_result_t *result, unsigned int idx, char *name, unsigned short type, unsigned int attribs)

Stores information about the target field into the result set.

Arguments

  `result`: The target result.

  `idx`: The numeric field index.

  `name`: The name of the field.

  `type`: The datatype of the field.

  `attribs`: The attributes of the field.

## 2.3.4. _dbd_row_allocate

    dbi_row_t *_dbd_row_allocate(unsigned int numfields)

Allocates a new row, ready to be filled with data.

Arguments

  `numfields`: The number of fields in the result set.

Returns

  A new DBI row, or NULL on error.

## 2.3.5. _dbd_row_finalize

    void _dbd_row_finalize(dbi_result_t *result, dbi_row_t *row, unsigned int idx)

Associates and stores the row with the result set, once the row's data has been filled.

Arguments

  `result`: The target result set.

  `row`: The target row object.

  `idx`: The index of the row.

## 2.3.6. _dbd_internal_error_handler

    void _dbd_internal_error_handler(dbi_conn_t *conn, const char *errmsg, const int errno)

Saves error message information generated by libdbi (rather than by the database or its API). If an old error message string exists, it will be freed.

Arguments

  `conn`: The target connection.

  `errmsg`: The error message to store. This will be stdup'd by libdbi so it has its own copy.

  `errno`: The error number to store.

Prev | Home | Next
Database Query Functions | Up | GNU Free Documentation License