Functions | |
| struct evsql_query * | evsql_query (struct evsql *evsql, struct evsql_trans *trans, const char *command, evsql_query_cb query_fn, void *cb_arg) |
| Queue the given query for execution. | |
| struct evsql_query * | evsql_query_params (struct evsql *evsql, struct evsql_trans *trans, const char *command, const struct evsql_query_params *params, evsql_query_cb query_fn, void *cb_arg) |
| Execute the given SQL query using the list of parameter types/values given via evsql_query_params. | |
| struct evsql_query * | evsql_query_exec (struct evsql *evsql, struct evsql_trans *trans, const struct evsql_query_info *query_info, evsql_query_cb query_fn, void *cb_arg,...) |
| Execute the given query_info's SQL query with the values given as variable arguments, using the query_info to resolve the types. | |
| void | evsql_query_abort (struct evsql_trans *trans, struct evsql_query *query) |
| Abort a query returned by Query interface that has not yet completed (query_fn has not been called yet). | |
| void | evsql_query_debug (const char *sql, const struct evsql_query_params *params) |
| Print out a textual dump of the given sql query and params using DEBUG. | |
| struct evsql_query* evsql_query | ( | struct evsql * | evsql, | |
| struct evsql_trans * | trans, | |||
| const char * | command, | |||
| evsql_query_cb | query_fn, | |||
| void * | cb_arg | |||
| ) | [read] |
Queue the given query for execution.
If trans is given (i.e. not NULL), then the transaction must be idle, and the query will be executed in that transaction's context. Otherwise, the query will be executed without a transaction using an idle connection, or enqueued for later execution.
Once the query is complete (got a result, got an error, the connection failed), then query_fn will be called. The callback can use the Result interface functions to manipulate the query results.
The returned evsql_query handle can be passed to evsql_query_abort at any point before query_fn being called.
| evsql | the context handle from Session creation interface | |
| trans | the optional transaction handle from evsql_trans | |
| command | the raw SQL command itself | |
| query_fn | the evsql_query_cb() to call once the query is complete | |
| cb_arg | the void* passed to the above |
| void evsql_query_abort | ( | struct evsql_trans * | trans, | |
| struct evsql_query * | query | |||
| ) |
Abort a query returned by Query interface that has not yet completed (query_fn has not been called yet).
The actual query itself may or may not be aborted (and hence may or may not be executed on the server), but query_fn will not be called anymore, and the query will dispose of itself and any results returned.
If the query is part of a transaction, then trans must be given, and the query must be the query that is currently executing on that trans. The transaction's ready_fn will be called once the query has been aborted and the transaction is now idle again.
| trans | if the query is part of a transaction, then it MUST be given here | |
| query | the in-progress query to abort |
| void evsql_query_debug | ( | const char * | sql, | |
| const struct evsql_query_params * | params | |||
| ) |
Print out a textual dump of the given sql query and params using DEBUG.
| sql | the SQL query command | |
| params | the list of parameter types and values |
| struct evsql_query* evsql_query_exec | ( | struct evsql * | evsql, | |
| struct evsql_trans * | trans, | |||
| const struct evsql_query_info * | query_info, | |||
| evsql_query_cb | query_fn, | |||
| void * | cb_arg, | |||
| ... | ||||
| ) | [read] |
Execute the given query_info's SQL query with the values given as variable arguments, using the query_info to resolve the types.
See evsql_query() for more info about behaviour.
| evsql | the context handle from Session creation interface | |
| trans | the optional transaction handle from evsql_trans | |
| query_info | the SQL query information | |
| query_fn | the evsql_query_cb() to call once the query is complete | |
| cb_arg | the void* passed to the above |
| struct evsql_query* evsql_query_params | ( | struct evsql * | evsql, | |
| struct evsql_trans * | trans, | |||
| const char * | command, | |||
| const struct evsql_query_params * | params, | |||
| evsql_query_cb | query_fn, | |||
| void * | cb_arg | |||
| ) | [read] |
Execute the given SQL query using the list of parameter types/values given via evsql_query_params.
Use the EVSQL_PARAMS macros to declare params, and the Parameter interface functions to populate the values.
See evsql_query() for more info about behaviour.
See the libpq PQexecParams tip for the parameter syntax to use.
| evsql | the context handle from Session creation interface | |
| trans | the optional transaction handle from evsql_trans | |
| command | the SQL command to bind the parameters to | |
| params | the parameter types and values | |
| query_fn | the evsql_query_cb() to call once the query is complete | |
| cb_arg | the void* passed to the above |
1.5.6