#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <ctype.h>
#include "rlm_sql.h"
Go to the source code of this file.
|
sql_rcode_t | rlm_sql_fetch_row (rlm_sql_row_t *out, rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle) |
| Call the driver's sql_fetch_row function. More...
|
|
void | rlm_sql_print_error (rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t *handle, bool force_debug) |
| Retrieve any errors from the SQL driver. More...
|
|
sql_rcode_t | rlm_sql_query (rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle, char const *query) |
| Call the driver's sql_query method, reconnecting if necessary. More...
|
|
void | rlm_sql_query_log (rlm_sql_t const *inst, char const *filename, char const *query) |
|
sql_rcode_t | rlm_sql_select_query (rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle, char const *query) |
| Call the driver's sql_select_query method, reconnecting if necessary. More...
|
|
int | sql_get_map_list (TALLOC_CTX *ctx, rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle, map_list_t *out, char const *query, fr_dict_attr_t const *list) |
|
void * | sql_mod_conn_create (TALLOC_CTX *ctx, void *instance, fr_time_delta_t timeout) |
|
◆ LOG_PREFIX
Definition at line 29 of file sql.c.
◆ rlm_sql_fetch_row()
Call the driver's sql_fetch_row function.
Calls the driver's sql_fetch_row logging any errors. On success, will write row data to (*handle)->row
.
- Parameters
-
out | Where to write row data. |
inst | Instance of rlm_sql_t. |
request | The Current request, may be NULL. |
handle | Handle to retrieve errors for. |
- Returns
-
Definition at line 299 of file sql.c.
◆ rlm_sql_print_error()
Retrieve any errors from the SQL driver.
Retrieves errors from the driver from the last operation and writes them to to request/global log, in the ERROR, WARN, INFO and DEBUG categories.
- Parameters
-
inst | Instance of rlm_sql. |
request | Current request, may be NULL. |
handle | Handle to retrieve errors for. |
force_debug | Force all errors to be logged as debug messages. |
Definition at line 337 of file sql.c.
◆ rlm_sql_query()
Call the driver's sql_query method, reconnecting if necessary.
- Note
- Caller must call
(inst->driver->sql_finish_query)(handle, &inst->config);
after they're done with the result.
- Parameters
-
handle | to query the database with. *handle should not be NULL, as this indicates previous reconnection attempt has failed. |
request | Current request. |
inst | rlm_sql_t instance data. |
query | to execute. Should not be zero length. |
- Returns
-
Definition at line 392 of file sql.c.
◆ rlm_sql_query_log()
void rlm_sql_query_log |
( |
rlm_sql_t const * |
inst, |
|
|
char const * |
filename, |
|
|
char const * |
query |
|
) |
| |
◆ rlm_sql_select_query()
Call the driver's sql_select_query method, reconnecting if necessary.
- Note
- Caller must call
(inst->driver->sql_finish_select_query)(handle, &inst->config);
after they're done with the result.
- Parameters
-
inst | rlm_sql_t instance data. |
request | Current request. |
handle | to query the database with. *handle should not be NULL, as this indicates previous reconnection attempt has failed. |
query | to execute. Should not be zero length. |
- Returns
-
Definition at line 493 of file sql.c.
◆ sql_get_map_list()
◆ sql_mod_conn_create()
void* sql_mod_conn_create |
( |
TALLOC_CTX * |
ctx, |
|
|
void * |
instance, |
|
|
fr_time_delta_t |
timeout |
|
) |
| |
Definition at line 65 of file sql.c.
◆ sql_rcode_description_table
Initial value:= {
}
#define L(_str)
Helper for initialising arrays of string literals.
@ RLM_SQL_QUERY_INVALID
Query syntax error.
@ RLM_SQL_ALT_QUERY
Key constraint violation, use an alternative query.
@ RLM_SQL_RECONNECT
Stale connection, should reconnect.
@ RLM_SQL_ERROR
General connection/server error.
@ RLM_SQL_NO_MORE_ROWS
No more rows available.
Definition at line 45 of file sql.c.
◆ sql_rcode_description_table_len
Definition at line 53 of file sql.c.
◆ sql_rcode_table
Initial value:
Definition at line 55 of file sql.c.
◆ sql_rcode_table_len
Definition at line 63 of file sql.c.