1 |
/* This file is part of GNU RADIUS. |
/* This file is part of GNU Radius. |
2 |
Copyright (C) 2000,2001 Sergey Poznyakoff |
Copyright (C) 2000,2001,2002,2003 Sergey Poznyakoff |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
GNU Radius is free software; you can redistribute it and/or modify |
5 |
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 |
6 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
7 |
(at your option) any later version. |
(at your option) any later version. |
8 |
|
|
9 |
This program is distributed in the hope that it will be useful, |
GNU Radius is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
GNU General Public License for more details. |
13 |
|
|
14 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software |
along with GNU Radius; if not, write to the Free Software Foundation, |
16 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/ |
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
17 |
|
|
18 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
19 |
# include <config.h> |
# include <config.h> |
32 |
#define NDISP sizeof(sql_dispatch_tab)/sizeof(sql_dispatch_tab[0]) |
#define NDISP sizeof(sql_dispatch_tab)/sizeof(sql_dispatch_tab[0]) |
33 |
|
|
34 |
int |
int |
35 |
disp_sql_interface_index(name) |
disp_sql_interface_index(char *name) |
|
char *name; |
|
36 |
{ |
{ |
37 |
int i; |
int i; |
38 |
|
|
44 |
} |
} |
45 |
|
|
46 |
SQL_DISPATCH_TAB * |
SQL_DISPATCH_TAB * |
47 |
disp_sql_entry(type) |
disp_sql_entry(int type) |
|
int type; |
|
48 |
{ |
{ |
49 |
insist(type < SQLT_MAX); |
insist(type < SQLT_MAX); |
50 |
if (type == 0) { |
if (type == 0) { |
57 |
} |
} |
58 |
|
|
59 |
int |
int |
60 |
disp_sql_reconnect(type, conn_type, conn) |
disp_sql_reconnect(int type, int conn_type, struct sql_connection *conn) |
|
int type; |
|
|
int conn_type; |
|
|
struct sql_connection *conn; |
|
61 |
{ |
{ |
62 |
if (!conn) |
if (!conn) |
63 |
return -1; |
return -1; |
67 |
} |
} |
68 |
|
|
69 |
void |
void |
70 |
disp_sql_drop(type, conn) |
disp_sql_drop(int type, struct sql_connection *conn) |
|
int type; |
|
|
struct sql_connection *conn; |
|
71 |
{ |
{ |
72 |
if (conn && conn->connected) |
if (conn && conn->connected) |
73 |
disp_sql_entry(type)->disconnect(conn, 1); |
disp_sql_entry(type)->disconnect(conn, 1); |
74 |
} |
} |
75 |
|
|
76 |
void |
void |
77 |
disp_sql_disconnect(type, conn) |
disp_sql_disconnect(int type, struct sql_connection *conn) |
|
int type; |
|
|
struct sql_connection *conn; |
|
78 |
{ |
{ |
79 |
if (conn && conn->connected) |
if (conn && conn->connected) |
80 |
disp_sql_entry(type)->disconnect(conn, 0); |
disp_sql_entry(type)->disconnect(conn, 0); |
81 |
} |
} |
82 |
|
|
83 |
int |
int |
84 |
disp_sql_query(type, conn, query, report_cnt) |
disp_sql_query(int type, struct sql_connection *conn, |
85 |
int type; |
char *query, int *report_cnt) |
|
struct sql_connection *conn; |
|
|
char *query; |
|
|
int *report_cnt; |
|
86 |
{ |
{ |
87 |
int rc; |
int rc; |
88 |
|
|
95 |
} |
} |
96 |
|
|
97 |
char * |
char * |
98 |
disp_sql_getpwd(type, conn, query) |
disp_sql_getpwd(int type, struct sql_connection *conn, char *query) |
|
int type; |
|
|
struct sql_connection *conn; |
|
|
char *query; |
|
99 |
{ |
{ |
100 |
if (!conn) |
if (!conn) |
101 |
return NULL; |
return NULL; |
103 |
} |
} |
104 |
|
|
105 |
void * |
void * |
106 |
disp_sql_exec(type, conn, query) |
disp_sql_exec(int type, struct sql_connection *conn, char *query) |
|
int type; |
|
|
struct sql_connection *conn; |
|
|
char *query; |
|
107 |
{ |
{ |
108 |
return disp_sql_entry(type)->exec_query(conn, query); |
return disp_sql_entry(type)->exec_query(conn, query); |
109 |
} |
} |
110 |
|
|
111 |
char * |
char * |
112 |
disp_sql_column(type, data, ncol) |
disp_sql_column(int type, void *data, int ncol) |
|
int type; |
|
|
void *data; |
|
|
int ncol; |
|
113 |
{ |
{ |
114 |
return disp_sql_entry(type)->column(data, ncol); |
return disp_sql_entry(type)->column(data, ncol); |
115 |
} |
} |
116 |
|
|
117 |
int |
int |
118 |
disp_sql_next_tuple(type, conn, data) |
disp_sql_next_tuple(int type, struct sql_connection *conn, void *data) |
|
int type; |
|
|
struct sql_connection *conn; |
|
|
void *data; |
|
119 |
{ |
{ |
120 |
if (!conn) |
if (!conn) |
121 |
return -1; |
return -1; |
124 |
|
|
125 |
/*ARGSUSED*/ |
/*ARGSUSED*/ |
126 |
void |
void |
127 |
disp_sql_free(type, conn, data) |
disp_sql_free(int type, struct sql_connection *conn, void *data) |
|
int type; |
|
|
struct sql_connection *conn; |
|
|
void *data; |
|
128 |
{ |
{ |
129 |
if (conn) |
if (conn) |
130 |
disp_sql_entry(type)->free(conn, data); |
disp_sql_entry(type)->free(conn, data); |