Data Structures | Defines | Typedefs | Functions

srdb1/db_res.h File Reference

Data structure that represents a result from a query. More...

#include "db_key.h"
#include "db_val.h"
Include dependency graph for srdb1/db_res.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

Defines

Typedefs

Functions


Detailed Description

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.


Typedef Documentation

typedef struct db1_res db1_res_t

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). *


Function Documentation

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.

Parameters:
_r filled result set
cols number of columns
Returns:
zero on success, negative on errors

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().

Here is the caller graph for this function:

int db_allocate_rows ( db1_res_t _res  )  [inline]
Parameters:
_res result set
Returns:
zero on success, negative on errors

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().

Here is the caller graph for this function:

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.

Parameters:
_r the result that should be released
Returns:
zero on success, negative on errors

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().

Here is the caller graph for this function:

int db_free_result ( db1_res_t _r  )  [inline]
Returns:
zero on success, negative on errors

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int db_free_rows ( db1_res_t _r  )  [inline]
Parameters:
_r the result that should be released
Returns:
zero on success, negative on errors

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().

Here is the call graph for this function:

Here is the caller graph for this function:

db1_res_t* db_new_result ( void   )  [inline]
Returns:
a pointer to the new result on success, NULL on errors

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().

Here is the caller graph for this function: