1 |
/* This file is part of GNU RADIUS. |
/* This file is part of GNU Radius. |
2 |
Copyright (C) 2001 Vlad Lungu |
Copyright (C) 2001 Vlad Lungu |
3 |
based on postgresql.c (C) 2000,2001 Sergey Pozniakoff |
based on postgresql.c (C) 2000,2001 Sergey Pozniakoff |
4 |
|
|
5 |
This program is free software; you can redistribute it and/or modify |
GNU Radius is free software; you can redistribute it and/or modify |
6 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
7 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
8 |
(at your option) any later version. |
(at your option) any later version. |
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
GNU Radius is distributed in the hope that it will be useful, |
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
GNU General Public License for more details. |
GNU General Public License for more details. |
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
16 |
along with this program; if not, write to the Free Software |
along with GNU Radius; if not, write to the Free Software |
17 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/ |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/ |
18 |
|
|
19 |
#define RADIUS_MODULE_ODBC_C |
#define RADIUS_MODULE_ODBC_C |
54 |
static int rad_odbc_next_tuple(struct sql_connection *conn, void *data); |
static int rad_odbc_next_tuple(struct sql_connection *conn, void *data); |
55 |
static void rad_odbc_free(struct sql_connection *conn, void *data); |
static void rad_odbc_free(struct sql_connection *conn, void *data); |
56 |
|
|
57 |
void |
static void |
58 |
rad_odbc_diag(handle_type, handle, what) |
rad_odbc_diag(SQLSMALLINT handle_type, SQLHANDLE handle, char *what) |
|
SQLSMALLINT handle_type; |
|
|
SQLHANDLE handle; |
|
|
char *what; |
|
59 |
{ |
{ |
60 |
char state[16]; |
char state[16]; |
61 |
SQLINTEGER nerror; |
SQLINTEGER nerror; |
75 |
|
|
76 |
/* ************************************************************************* */ |
/* ************************************************************************* */ |
77 |
/* Interface routines */ |
/* Interface routines */ |
78 |
int |
static int |
79 |
rad_odbc_reconnect(type, conn) |
rad_odbc_reconnect(int type, struct sql_connection *conn) |
|
int type; |
|
|
struct sql_connection *conn; |
|
80 |
{ |
{ |
81 |
|
|
82 |
ODBCconn *oconn; |
ODBCconn *oconn; |
137 |
return 0; |
return 0; |
138 |
} |
} |
139 |
|
|
140 |
void |
static void |
141 |
rad_odbc_disconnect(conn, drop) |
rad_odbc_disconnect(struct sql_connection *conn, |
142 |
struct sql_connection *conn; |
int drop /* currently unused */) |
|
int drop; /* currently unused */ |
|
143 |
{ |
{ |
144 |
ODBCconn *odata; |
ODBCconn *odata; |
145 |
if (!conn->data) |
if (!conn->data) |
152 |
conn->connected = 0; |
conn->connected = 0; |
153 |
} |
} |
154 |
|
|
155 |
int |
static int |
156 |
rad_odbc_query(conn, query, return_count) |
rad_odbc_query(struct sql_connection *conn, char *query, int *return_count) |
|
struct sql_connection *conn; |
|
|
char *query; |
|
|
int *return_count; |
|
157 |
{ |
{ |
158 |
ODBCconn *odata; |
ODBCconn *odata; |
159 |
long result; |
long result; |
192 |
return 0; |
return 0; |
193 |
} |
} |
194 |
|
|
195 |
char * |
static char * |
196 |
rad_odbc_getpwd(conn, query) |
rad_odbc_getpwd(struct sql_connection *conn, char *query) |
|
struct sql_connection *conn; |
|
|
char *query; |
|
197 |
{ |
{ |
198 |
ODBCconn *odata; |
ODBCconn *odata; |
199 |
long result; |
long result; |
267 |
int nfields; |
int nfields; |
268 |
} EXEC_DATA; |
} EXEC_DATA; |
269 |
|
|
270 |
void * |
static void * |
271 |
rad_odbc_exec(conn, query) |
rad_odbc_exec(struct sql_connection *conn, char *query) |
|
struct sql_connection *conn; |
|
|
char *query; |
|
272 |
{ |
{ |
273 |
|
|
274 |
ODBCconn *odata; |
ODBCconn *odata; |
312 |
return (void*)data; |
return (void*)data; |
313 |
} |
} |
314 |
|
|
315 |
char * |
static char * |
316 |
rad_odbc_column(data, ncol) |
rad_odbc_column(void *data, int ncol) |
|
void *data; |
|
|
int ncol; |
|
317 |
{ |
{ |
318 |
SQLCHAR buffer[1024]; |
SQLCHAR buffer[1024]; |
319 |
long result; |
long result; |
339 |
} |
} |
340 |
|
|
341 |
/*ARGSUSED*/ |
/*ARGSUSED*/ |
342 |
int |
static int |
343 |
rad_odbc_next_tuple(conn, data) |
rad_odbc_next_tuple(struct sql_connection *conn, void *data) |
|
struct sql_connection *conn; |
|
|
void *data; |
|
344 |
{ |
{ |
345 |
long result; |
long result; |
346 |
EXEC_DATA *edata = (EXEC_DATA*)data; |
EXEC_DATA *edata = (EXEC_DATA*)data; |
364 |
} |
} |
365 |
|
|
366 |
/*ARGSUSED*/ |
/*ARGSUSED*/ |
367 |
void |
static void |
368 |
rad_odbc_free(conn, data) |
rad_odbc_free(struct sql_connection *conn, void *data) |
|
struct sql_connection *conn; |
|
|
void *data; |
|
369 |
{ |
{ |
370 |
EXEC_DATA *edata = (EXEC_DATA*)data; |
EXEC_DATA *edata = (EXEC_DATA*)data; |
371 |
|
|