The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
rlm_sql_unixodbc.c File Reference
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <sqltypes.h>
#include "rlm_sql.h"
#include <sql.h>
#include <sqlext.h>
+ Include dependency graph for rlm_sql_unixodbc.c:

Go to the source code of this file.

Data Structures

struct  rlm_sql_unixodbc_conn_t
 

Macros

#define LOG_PREFIX   "sql - unixodbc"
 

Functions

static int _sql_socket_destructor (rlm_sql_unixodbc_conn_t *conn)
 
static int sql_affected_rows (fr_sql_query_t *query_ctx, rlm_sql_config_t const *config)
 
static USES_APPLE_DEPRECATED_API int sql_check_error (long err_handle, rlm_sql_handle_t *handle, rlm_sql_config_t const *config)
 
static sql_rcode_t sql_check_error (long error_handle, rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
 Checks the error code to determine if the connection needs to be re-esttablished. More...
 
static size_t sql_error (TALLOC_CTX *ctx, sql_log_entry_t out[], NDEBUG_UNUSED size_t outlen, fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 Retrieves any errors associated with the query context. More...
 
static unlang_action_t sql_fetch_row (rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
 
static sql_rcode_t sql_fields (char const **out[], fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
static sql_rcode_t sql_finish_query (fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
static sql_rcode_t sql_finish_select_query (fr_sql_query_t *query_ctx, rlm_sql_config_t const *config)
 
static sql_rcode_t sql_free_result (fr_sql_query_t *query_ctx, rlm_sql_config_t const *config)
 
static sql_rcode_t sql_free_result (fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
static int sql_num_fields (rlm_sql_handle_t *handle, rlm_sql_config_t const *config)
 
static unlang_action_t sql_query (rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
 
static unlang_action_t sql_select_query (rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
 
static sql_rcode_t sql_socket_init (rlm_sql_handle_t *handle, rlm_sql_config_t const *config, fr_time_delta_t timeout)
 

Variables

rlm_sql_driver_t rlm_sql_unixodbc
 

Data Structure Documentation

◆ rlm_sql_unixodbc_conn_t

struct rlm_sql_unixodbc_conn_t

Definition at line 32 of file rlm_sql_unixodbc.c.

Data Fields
void * conn
SQLHDBC dbc
SQLHENV env
rlm_sql_row_t row
SQLHSTMT stmt

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "sql - unixodbc"

Definition at line 24 of file rlm_sql_unixodbc.c.

Function Documentation

◆ _sql_socket_destructor()

static int _sql_socket_destructor ( rlm_sql_unixodbc_conn_t conn)
static

Definition at line 49 of file rlm_sql_unixodbc.c.

+ Here is the caller graph for this function:

◆ sql_affected_rows()

static int sql_affected_rows ( fr_sql_query_t query_ctx,
rlm_sql_config_t const *  config 
)
static

Definition at line 379 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_check_error() [1/2]

static USES_APPLE_DEPRECATED_API int sql_check_error ( long  err_handle,
rlm_sql_handle_t handle,
rlm_sql_config_t const *  config 
)
static
+ Here is the caller graph for this function:

◆ sql_check_error() [2/2]

static sql_rcode_t sql_check_error ( long  error_handle,
rlm_sql_handle_t handle,
UNUSED rlm_sql_config_t const *  config 
)
static

Checks the error code to determine if the connection needs to be re-esttablished.

Parameters
error_handleReturn code from a failed unixodbc call.
handlerlm_sql connection handle.
configrlm_sql config.
Returns

Definition at line 325 of file rlm_sql_unixodbc.c.

◆ sql_error()

static size_t sql_error ( TALLOC_CTX *  ctx,
sql_log_entry_t  out[],
NDEBUG_UNUSED size_t  outlen,
fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Retrieves any errors associated with the query context.

Note
Caller will free any memory allocated in ctx.
Parameters
ctxto allocate temporary error buffers in.
outArray of sql_log_entry_t to fill.
outlenLength of out array.
query_ctxQuery context to retrieve error for.
configrlm_sql config.
Returns
number of errors written to the sql_log_entry_t array.

Definition at line 293 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_fetch_row()

static unlang_action_t sql_fetch_row ( rlm_rcode_t p_result,
UNUSED int *  priority,
UNUSED request_t request,
void *  uctx 
)
static

Definition at line 217 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_fields()

static sql_rcode_t sql_fields ( char const **  out[],
fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Definition at line 179 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_finish_query()

static sql_rcode_t sql_finish_query ( fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Definition at line 264 of file rlm_sql_unixodbc.c.

◆ sql_finish_select_query()

static sql_rcode_t sql_finish_select_query ( fr_sql_query_t query_ctx,
rlm_sql_config_t const *  config 
)
static

Definition at line 241 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_free_result() [1/2]

static sql_rcode_t sql_free_result ( fr_sql_query_t query_ctx,
rlm_sql_config_t const *  config 
)
static
+ Here is the caller graph for this function:

◆ sql_free_result() [2/2]

static sql_rcode_t sql_free_result ( fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Definition at line 273 of file rlm_sql_unixodbc.c.

◆ sql_num_fields()

static int sql_num_fields ( rlm_sql_handle_t handle,
rlm_sql_config_t const *  config 
)
static

Definition at line 167 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sql_query()

static unlang_action_t sql_query ( rlm_rcode_t p_result,
UNUSED int *  priority,
UNUSED request_t request,
void *  uctx 
)
static

Definition at line 119 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sql_select_query()

static unlang_action_t sql_select_query ( rlm_rcode_t p_result,
UNUSED int *  priority,
UNUSED request_t request,
void *  uctx 
)
static

Definition at line 136 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_socket_init()

static sql_rcode_t sql_socket_init ( rlm_sql_handle_t handle,
rlm_sql_config_t const *  config,
fr_time_delta_t  timeout 
)
static

Definition at line 65 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

Variable Documentation

◆ rlm_sql_unixodbc

rlm_sql_driver_t rlm_sql_unixodbc
Initial value:
= {
.common = {
.name = "sql_unixodbc"
},
.sql_socket_init = sql_socket_init,
.sql_query = sql_query,
.sql_select_query = sql_select_query,
.sql_affected_rows = sql_affected_rows,
.sql_fields = sql_fields,
.sql_fetch_row = sql_fetch_row,
.sql_free_result = sql_free_result,
.sql_error = sql_error,
.sql_finish_query = sql_finish_query,
.sql_finish_select_query = sql_finish_select_query
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
static sql_rcode_t sql_free_result(fr_sql_query_t *query_ctx, rlm_sql_config_t const *config)
static sql_rcode_t sql_socket_init(rlm_sql_handle_t *handle, rlm_sql_config_t const *config, fr_time_delta_t timeout)
static sql_rcode_t sql_fields(char const **out[], fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static sql_rcode_t sql_finish_query(fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static sql_rcode_t sql_finish_select_query(fr_sql_query_t *query_ctx, rlm_sql_config_t const *config)
static int sql_affected_rows(fr_sql_query_t *query_ctx, rlm_sql_config_t const *config)
static unlang_action_t sql_fetch_row(rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
static size_t sql_error(TALLOC_CTX *ctx, sql_log_entry_t out[], NDEBUG_UNUSED size_t outlen, fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
Retrieves any errors associated with the query context.
static unlang_action_t sql_select_query(rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
static unlang_action_t sql_query(rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)

Definition at line 394 of file rlm_sql_unixodbc.c.