Query helper for database driversThis helper methods for database queries are used from the database SQL driver to do the actual work. More...
#include "db_key.h"#include "db_op.h"#include "db_val.h"#include "db_con.h"#include "db_row.h"#include "db_res.h"#include "db_cap.h"

Go to the source code of this file.
Each function uses some functions from the actual driver with function pointers to the concrete, specific implementation.
Definition in file db_query.h.
| int db_do_delete | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_op_t * | _o, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str, | |||
| int(*)(const db1_con_t *_h, const str *_c) | submit_query | |||
| ) |
This method evaluates the actual arguments for the database operation and setups the string that is used for the delete operation in the db module. Then its submit the query for the operation. It uses for its work the implementation in the concrete database module.
| _h | structure representing database connection | |
| _k | key names | |
| _o | operators | |
| _v | values of the keys that must match | |
| _n | number of key/value pairs that are compared, if zero then the whole table is deleted | |
| (*val2str) | function pointer to the db specific val conversion function | |
| (*submit_query) | function pointer to the db specific query submit function |
Definition at line 234 of file db_query.c.
References CON_TABLE, db_print_where(), _str::len, and _str::s.
Referenced by db_mysql_delete(), and db_postgres_delete().


| int db_do_insert | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str, | |||
| int(*)(const db1_con_t *_h, const str *_c) | submit_query | |||
| ) |
This method evaluates the actual arguments for the database operation and setups the string that is used for the insert operation in the db module. Then its submit the query for the operation. It uses for its work the implementation in the concrete database module.
| _h | structure representing database connection | |
| _k | key names | |
| _v | values of the keys | |
| _n | number of key/value pairs | |
| (*val2str) | function pointer to the db specific val conversion function | |
| (*submit_query) | function pointer to the db specific query submit function |
Definition at line 220 of file db_query.c.
Referenced by db_mysql_insert(), and db_postgres_insert().

| int db_do_insert_delayed | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str, | |||
| int(*)(const db1_con_t *_h, const str *_c) | submit_query | |||
| ) |
This method evaluates the actual arguments for the database operation and setups the string that is used for the insert delayed operation in the db module. Then its submit the query for the operation. It uses for its work the implementation in the concrete database module.
| _h | structure representing database connection | |
| _k | key names | |
| _v | values of the keys | |
| _n | number of key/value pairs | |
| (*val2str) | function pointer to the db specific val conversion function | |
| (*submit_query) | function pointer to the db specific query submit function |
Definition at line 227 of file db_query.c.
Referenced by db_mysql_insert_delayed().

| int db_do_query | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_op_t * | _op, | |||
| const db_val_t * | _v, | |||
| const db_key_t * | _c, | |||
| const int | _n, | |||
| const int | _nc, | |||
| const db_key_t | _o, | |||
| db1_res_t ** | _r, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str, | |||
| int(*)(const db1_con_t *_h, const str *_c) | submit_query, | |||
| int(*)(const db1_con_t *_h, db1_res_t **_r) | store_result | |||
| ) |
This method evaluates the actual arguments for the database query and setups the string that is used for the query in the db module. Then its submit the query and stores the result if necessary. It uses for its work the implementation in the concrete database module.
| _h | structure representing database connection | |
| _k | key names, if not present the whole table will be returned | |
| _op | operators | |
| _v | values of the keys that must match | |
| _c | column names that should be returned | |
| _n | number of key/value pairs that are compared, if zero then no comparison is done | |
| _nc | number of colums that should be returned | |
| _o | order by the specificied column, optional | |
| _r | the result that is returned, set to NULL if you want to use fetch_result later | |
| (*val2str) | function pointer to the db specific val conversion function | |
| (*submit_query) | function pointer to the db specific query submit function | |
| (*store_result) | function pointer to the db specific store result function |
Referenced by db_mysql_query(), and db_postgres_query().

| int db_do_raw_query | ( | const db1_con_t * | _h, | |
| const str * | _s, | |||
| db1_res_t ** | _r, | |||
| int(*)(const db1_con_t *_h, const str *_c) | submit_query, | |||
| int(*)(const db1_con_t *_h, db1_res_t **_r) | store_result | |||
| ) |
This method evaluates the actual arguments for the database raw query and setups the string that is used for the query in the db module. Then its submit the query and stores the result if necessary. It uses for its work the implementation in the concrete database module.
| _h | structure representing database connection | |
| _s | char holding the raw query | |
| _r | the result that is returned | |
| (*submit_query) | function pointer to the db specific query submit function | |
| (*store_result) | function pointer to the db specific store result function |
Definition at line 146 of file db_query.c.
Referenced by db_mysql_raw_query(), and db_postgres_raw_query().

| int db_do_replace | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str, | |||
| int(*)(const db1_con_t *_h, const str *_c) | submit_query | |||
| ) |
This helper method evaluates the actual arguments for the database operation and setups the string that is used for the replace operation in the db module. Then its submit the query for the operation. It uses for its work the implementation in the concrete database module.
| _h | structure representing database connection | |
| _k | key names, if not present the whole table will be returned | |
| _v | values of the keys that must match | |
| _n | number of key/value pairs that are compared, if zero then no comparison is done | |
| (*val2str) | function pointer to the db specific val conversion function | |
| (*submit_query) | function pointer to the db specific query submit function |
Definition at line 323 of file db_query.c.
References CON_TABLE, db_print_columns(), db_print_values(), _str::len, and _str::s.
Referenced by db_mysql_replace().


| int db_do_update | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_op_t * | _o, | |||
| const db_val_t * | _v, | |||
| const db_key_t * | _uk, | |||
| const db_val_t * | _uv, | |||
| const int | _n, | |||
| const int | _un, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str, | |||
| int(*)(const db1_con_t *_h, const str *_c) | submit_query | |||
| ) |
This method evaluates the actual arguments for the database operation and setups the string that is used for the update operation in the db module. Then its submit the query for the operation. It uses for its work the implementation in the concrete database module.
| _h | structure representing database connection | |
| _k | key names, if not present the whole table will be returned | |
| _o | operators | |
| _v | values of the keys that must match | |
| _uk,: | updated columns | |
| _uv,: | updated values of the columns | |
| _n | number of key/value pairs that are compared, if zero then no comparison is done | |
| _un,: | number of columns that should be updated | |
| (*val2str) | function pointer to the db specific val conversion function | |
| (*submit_query) | function pointer to the db specific query submit function |
Definition at line 277 of file db_query.c.
References CON_TABLE, db_print_set(), db_print_where(), _str::len, and _str::s.
Referenced by db_mysql_update(), and db_postgres_update().


| int db_query_init | ( | void | ) |
This initialises the db_query module, and should be called before any functions in db_query are called.
Definition at line 368 of file db_query.c.
Referenced by db_api_init().

1.7.1