db_row.h File Reference

Type that represents a row in a database. More...

#include "db_val.h"
#include "db_res.h"

Include dependency graph for db_row.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  db_row

Defines

#define ROW_N(rw)   ((rw)->n)
#define ROW_VALUES(rw)   ((rw)->values)

Typedefs

typedef struct db_row db_row_t

Functions

int db_allocate_row (const db_res_t *_res, db_row_t *_row)
int db_free_row (db_row_t *_r)


Detailed Description

Type that represents a row in a database.

This file holds a type that represents a row in a database, some convenience macros and a function for memory managements.

Definition in file db_row.h.


Define Documentation

#define ROW_N ( rw   )     ((rw)->n)

#define ROW_VALUES ( rw   )     ((rw)->values)


Typedef Documentation

typedef struct db_row db_row_t

Structure holding the result of a query table function. It represents one row in a database table. In other words, the row is an array of db_val_t variables, where each db_val_t variable represents exactly one cell in the table.


Function Documentation

int db_allocate_row ( const db_res_t _res,
db_row_t _row 
) [inline]

Allocate memory for row value.

Parameters:
_res result set
_row filled row
Returns:
zero on success, negative on errors

Definition at line 111 of file db_row.c.

References len, LM_DBG, LM_ERR, pkg_malloc, RES_COL_N, ROW_N, and ROW_VALUES.

Referenced by bdb_append_row(), bdb_convert_row(), db_mysql_convert_row(), db_postgres_convert_row(), db_unixodbc_convert_row(), and dbt_convert_row().

int db_free_row ( db_row_t _r  )  [inline]

Release memory used by a row. This method only frees values that are inside the row if the free flag of the specific value is set. Otherwise this storage must be released when the database specific result free function is called. Only string based values are freed if wanted, null values are skipped.

Parameters:
_r row that should be released
Returns:
zero on success, negative on error

Definition at line 42 of file db_row.c.

References DB_BLOB, DB_STR, DB_STRING, len, LM_DBG, LM_ERR, NULL, pkg_free, ROW_N, ROW_VALUES, s, VAL_BLOB, VAL_FREE, VAL_NULL, VAL_STR, VAL_STRING, and VAL_TYPE.

Referenced by bdb_append_row(), bdb_convert_row(), db_free_rows(), db_mysql_convert_row(), db_postgres_convert_row(), and db_unixodbc_convert_row().


Generated on Tue May 22 14:00:35 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6