The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
rlm_sql_null.c
Go to the documentation of this file.
1 /*
2  * sql_null.c SQL Module
3  *
4  * Version: $Id: dcaa4bffaf6e32a3c99cc7b5754ded24bc503665 $
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  * @copyright 2012 Alan DeKok (aland@freeradius.org)
21  */
22 
23 RCSID("$Id: dcaa4bffaf6e32a3c99cc7b5754ded24bc503665 $")
24 
25 #include <freeradius-devel/server/base.h>
26 
27 #include "rlm_sql.h"
28 
29 
30 static const void *fake = "fake";
31 
34 {
35  memcpy(&handle->conn, &fake, sizeof(handle->conn));
36  return 0;
37 }
38 
40  UNUSED rlm_sql_config_t const *config, UNUSED char const *query)
41 {
42  return 0;
43 }
44 
46 {
47  return 0;
48 }
49 
51  UNUSED rlm_sql_config_t const *config, UNUSED char const *query)
52 {
53  return 0;
54 }
55 
57 {
58  return 0;
59 }
60 
63 {
64  *out = NULL;
65 
66  return RLM_SQL_NO_MORE_ROWS;
67 }
68 
70 {
71  return 0;
72 }
73 
74 /** Stub function for retrieving errors, should not be called
75  *
76  */
77 static size_t sql_error(UNUSED TALLOC_CTX *ctx, UNUSED sql_log_entry_t out[], UNUSED size_t outlen,
79 {
80  return 0;
81 }
82 
84 {
85  return 0;
86 }
87 
89 {
90  return 0;
91 }
92 
94 {
95  return 1;
96 }
97 
98 /* Exported to rlm_sql */
101  .common = {
102  .magic = MODULE_MAGIC_INIT,
103  .name = "sql_null"
104  },
105  .number = 1,
106  .sql_socket_init = sql_socket_init,
107  .sql_query = sql_query,
108  .sql_select_query = sql_select_query,
109  .sql_num_fields = sql_num_fields,
110  .sql_num_rows = sql_num_rows,
111  .sql_fetch_row = sql_fetch_row,
112  .sql_free_result = sql_free_result,
113  .sql_error = sql_error,
114  .sql_finish_query = sql_finish_query,
115  .sql_finish_select_query = sql_finish_select_query,
116  .sql_affected_rows = sql_affected_rows
117 };
#define RCSID(id)
Definition: build.h:444
#define UNUSED
Definition: build.h:313
static fr_time_delta_t timeout
Definition: dhcpclient.c:54
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:65
static const conf_parser_t config[]
Definition: base.c:188
Prototypes and functions for the SQL module.
void * conn
Database specific connection handle.
Definition: rlm_sql.h:136
sql_rcode_t
Action to take at end of an SQL query.
Definition: rlm_sql.h:42
@ RLM_SQL_NO_MORE_ROWS
No more rows available.
Definition: rlm_sql.h:48
char ** rlm_sql_row_t
Definition: rlm_sql.h:57
Definition: rlm_sql.h:59
static const void * fake
Definition: rlm_sql_null.c:30
static sql_rcode_t sql_query(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config, UNUSED char const *query)
Definition: rlm_sql_null.c:39
rlm_sql_driver_t rlm_sql_null
Definition: rlm_sql_null.c:100
static sql_rcode_t sql_finish_select_query(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Definition: rlm_sql_null.c:88
static sql_rcode_t sql_finish_query(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Definition: rlm_sql_null.c:83
static sql_rcode_t sql_socket_init(rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config, UNUSED fr_time_delta_t timeout)
Definition: rlm_sql_null.c:32
static int sql_affected_rows(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Definition: rlm_sql_null.c:93
static int sql_num_rows(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Definition: rlm_sql_null.c:56
static int sql_num_fields(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Definition: rlm_sql_null.c:45
static sql_rcode_t sql_select_query(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config, UNUSED char const *query)
Definition: rlm_sql_null.c:50
static size_t sql_error(UNUSED TALLOC_CTX *ctx, UNUSED sql_log_entry_t out[], UNUSED size_t outlen, UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Stub function for retrieving errors, should not be called.
Definition: rlm_sql_null.c:77
static sql_rcode_t sql_fetch_row(rlm_sql_row_t *out, UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Definition: rlm_sql_null.c:61
static sql_rcode_t sql_free_result(UNUSED rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t const *config)
Definition: rlm_sql_null.c:69
module_t common
Common fields for all loadable modules.
Definition: rlm_sql.h:183
A time delta, a difference in time measured in nanoseconds.
Definition: time.h:80
static size_t char ** out
Definition: value.h:984