Data structure that represents a result from a query. More...
#include "db_key.h"#include "db_val.h"

Go to the source code of this file.
Data structure that represents a result from a database query, it also provides some convenience macros and some memory management functions for result structures.
Definition in file srdb1/db_res.h.
The result can consist of zero or more rows (see db_row_t description).
Note: A variable of type db1_res_t returned by db_query function uses dynamicaly allocated memory, don't forget to call db_free_result if you don't need the variable anymore. You will encounter memory leaks if you fail to do this!
In addition to zero or more rows, each db1_res_t object contains also an array of db_key_t objects. The objects represent keys (names of columns). *
| int db_allocate_columns | ( | db1_res_t * | _r, | |
| const unsigned int | cols | |||
| ) | [inline] |
If no more memory is available for the allocation of the types then the already allocated memory for the names is freed.
| _r | filled result set | |
| cols | number of columns |
Definition at line 146 of file srdb1/db_res.c.
References RES_NAMES, and RES_TYPES.
Referenced by db_mysql_get_columns(), and db_postgres_get_columns().

| int db_allocate_rows | ( | db1_res_t * | _res | ) | [inline] |
| _res | result set |
Definition at line 176 of file srdb1/db_res.c.
References RES_ROW_N, and RES_ROWS.
Referenced by db_mysql_convert_rows(), and db_postgres_convert_rows().

| int db_free_columns | ( | db1_res_t * | _r | ) | [inline] |
This methods assumes that the string values holding the column names are in memory allocated from the database driver, and thus must be not freed here.
| _r | the result that should be released |
Definition at line 73 of file srdb1/db_res.c.
References RES_COL_N, RES_NAMES, and RES_TYPES.
Referenced by db_free_result(), db_mysql_convert_result(), db_mysql_get_columns(), db_postgres_convert_result(), and db_postgres_get_columns().

| int db_free_result | ( | db1_res_t * | _r | ) | [inline] |
Definition at line 126 of file srdb1/db_res.c.
References db_free_columns(), and db_free_rows().
Referenced by db_mysql_fetch_result(), db_mysql_free_result(), db_mysql_store_result(), db_postgres_delete(), db_postgres_fetch_result(), db_postgres_free_result(), db_postgres_insert(), db_postgres_store_result(), and db_postgres_update().


| int db_free_rows | ( | db1_res_t * | _r | ) | [inline] |
| _r | the result that should be released |
Definition at line 44 of file srdb1/db_res.c.
References db_free_row(), RES_ROW_N, and RES_ROWS.
Referenced by db_free_result(), db_mysql_convert_rows(), db_mysql_fetch_result(), db_postgres_convert_rows(), and db_postgres_fetch_result().


| db1_res_t* db_new_result | ( | void | ) | [inline] |
Definition at line 109 of file srdb1/db_res.c.
Referenced by db_mysql_fetch_result(), db_mysql_store_result(), db_postgres_fetch_result(), and db_postgres_store_result().

1.7.1