a fix for bug 8251; the var_val needs to accept longer strings or mass confusion...
[asterisk/asterisk.git] / res / res_config_odbc.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
8  * Copyright (C) 2004 - 2005 Anthony Minessale II <anthmct@yahoo.com>
9  *
10  * See http://www.asterisk.org for more information about
11  * the Asterisk project. Please do not directly contact
12  * any of the maintainers of this project for assistance;
13  * the project provides a web site, mailing lists and IRC
14  * channels for your use.
15  *
16  * This program is free software, distributed under the terms of
17  * the GNU General Public License Version 2. See the LICENSE file
18  * at the top of the source tree.
19  */
20
21 /*! \file
22  *
23  * \brief odbc+odbc plugin for portable configuration engine
24  *
25  * \author Mark Spencer <markster@digium.com>
26  * \author Anthony Minessale II <anthmct@yahoo.com>
27  *
28  * \arg http://www.unixodbc.org
29  */
30
31 /*** MODULEINFO
32         <depend>unixodbc</depend>
33  ***/
34
35 #include "asterisk.h"
36
37 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
38
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <unistd.h>
42 #include <string.h>
43
44 #include "asterisk/file.h"
45 #include "asterisk/logger.h"
46 #include "asterisk/channel.h"
47 #include "asterisk/pbx.h"
48 #include "asterisk/config.h"
49 #include "asterisk/module.h"
50 #include "asterisk/lock.h"
51 #include "asterisk/options.h"
52 #include "asterisk/res_odbc.h"
53 #include "asterisk/utils.h"
54
55 static struct ast_variable *realtime_odbc(const char *database, const char *table, va_list ap)
56 {
57         struct odbc_obj *obj;
58         SQLHSTMT stmt;
59         char sql[1024];
60         char coltitle[256];
61         char rowdata[2048];
62         char *op;
63         const char *newparam, *newval;
64         char *stringp;
65         char *chunk;
66         SQLSMALLINT collen;
67         int res;
68         int x;
69         struct ast_variable *var=NULL, *prev=NULL;
70         SQLULEN colsize;
71         SQLSMALLINT colcount=0;
72         SQLSMALLINT datatype;
73         SQLSMALLINT decimaldigits;
74         SQLSMALLINT nullable;
75         SQLINTEGER indicator;
76         va_list aq;
77         
78         va_copy(aq, ap);
79         
80         
81         if (!table)
82                 return NULL;
83
84         obj = ast_odbc_request_obj(database, 0);
85         if (!obj)
86                 return NULL;
87
88         res = SQLAllocHandle (SQL_HANDLE_STMT, obj->con, &stmt);
89         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
90                 ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
91                 ast_odbc_release_obj(obj);
92                 return NULL;
93         }
94
95         newparam = va_arg(aq, const char *);
96         if (!newparam)  {
97                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
98                 ast_odbc_release_obj(obj);
99                 return NULL;
100         }
101         newval = va_arg(aq, const char *);
102         if (!strchr(newparam, ' ')) op = " ="; else op = "";
103         snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?", table, newparam, op);
104         while((newparam = va_arg(aq, const char *))) {
105                 if (!strchr(newparam, ' ')) op = " ="; else op = "";
106                 snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?", newparam, op);
107                 newval = va_arg(aq, const char *);
108         }
109         va_end(aq);
110         res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
111         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
112                 ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
113                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
114                 ast_odbc_release_obj(obj);
115                 return NULL;
116         }
117         
118         /* Now bind the parameters */
119         x = 1;
120
121         while((newparam = va_arg(ap, const char *))) {
122                 newval = va_arg(ap, const char *);
123                 SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
124         }
125         
126         res = ast_odbc_smart_execute(obj, stmt);
127
128         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
129                 ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
130                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
131                 ast_odbc_release_obj(obj);
132                 return NULL;
133         }
134
135         res = SQLNumResultCols(stmt, &colcount);
136         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
137                 ast_log(LOG_WARNING, "SQL Column Count error!\n[%s]\n\n", sql);
138                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
139                 ast_odbc_release_obj(obj);
140                 return NULL;
141         }
142
143         res = SQLFetch(stmt);
144         if (res == SQL_NO_DATA) {
145                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
146                 ast_odbc_release_obj(obj);
147                 return NULL;
148         }
149         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
150                 ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
151                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
152                 ast_odbc_release_obj(obj);
153                 return NULL;
154         }
155         for (x = 0; x < colcount; x++) {
156                 rowdata[0] = '\0';
157                 collen = sizeof(coltitle);
158                 res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen, 
159                                         &datatype, &colsize, &decimaldigits, &nullable);
160                 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
161                         ast_log(LOG_WARNING, "SQL Describe Column error!\n[%s]\n\n", sql);
162                         if (var)
163                                 ast_variables_destroy(var);
164                         ast_odbc_release_obj(obj);
165                         return NULL;
166                 }
167
168                 indicator = 0;
169                 res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), &indicator);
170                 if (indicator == SQL_NULL_DATA)
171                         continue;
172
173                 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
174                         ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
175                         if (var)
176                                 ast_variables_destroy(var);
177                         ast_odbc_release_obj(obj);
178                         return NULL;
179                 }
180                 stringp = rowdata;
181                 while(stringp) {
182                         chunk = strsep(&stringp, ";");
183                         if (!ast_strlen_zero(ast_strip(chunk))) {
184                                 if (prev) {
185                                         prev->next = ast_variable_new(coltitle, chunk);
186                                         if (prev->next)
187                                                 prev = prev->next;
188                                         } else 
189                                                 prev = var = ast_variable_new(coltitle, chunk);
190                                         
191                         }
192                 }
193         }
194
195
196         SQLFreeHandle (SQL_HANDLE_STMT, stmt);
197         ast_odbc_release_obj(obj);
198         return var;
199 }
200
201 static struct ast_config *realtime_multi_odbc(const char *database, const char *table, va_list ap)
202 {
203         struct odbc_obj *obj;
204         SQLHSTMT stmt;
205         char sql[1024];
206         char coltitle[256];
207         char rowdata[2048];
208         const char *initfield=NULL;
209         char *op;
210         const char *newparam, *newval;
211         char *stringp;
212         char *chunk;
213         SQLSMALLINT collen;
214         int res;
215         int x;
216         struct ast_variable *var=NULL;
217         struct ast_config *cfg=NULL;
218         struct ast_category *cat=NULL;
219         struct ast_realloca ra;
220         SQLULEN colsize;
221         SQLSMALLINT colcount=0;
222         SQLSMALLINT datatype;
223         SQLSMALLINT decimaldigits;
224         SQLSMALLINT nullable;
225         SQLINTEGER indicator;
226
227         va_list aq;
228         va_copy(aq, ap);
229         
230         
231         if (!table)
232                 return NULL;
233         memset(&ra, 0, sizeof(ra));
234
235         obj = ast_odbc_request_obj(database, 0);
236         if (!obj)
237                 return NULL;
238
239         res = SQLAllocHandle (SQL_HANDLE_STMT, obj->con, &stmt);
240         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
241                 ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
242                 ast_odbc_release_obj(obj);
243                 return NULL;
244         }
245
246         newparam = va_arg(aq, const char *);
247         if (!newparam)  {
248                 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
249                 ast_odbc_release_obj(obj);
250                 return NULL;
251         }
252         initfield = ast_strdupa(newparam);
253         if ((op = strchr(initfield, ' '))) 
254                 *op = '\0';
255         newval = va_arg(aq, const char *);
256         if (!strchr(newparam, ' ')) op = " ="; else op = "";
257         snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?", table, newparam, op);
258         while((newparam = va_arg(aq, const char *))) {
259                 if (!strchr(newparam, ' ')) op = " ="; else op = "";
260                 snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?", newparam, op);
261                 newval = va_arg(aq, const char *);
262         }
263         if (initfield)
264                 snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ORDER BY %s", initfield);
265         va_end(aq);
266         res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
267         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
268                 ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
269                 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
270                 ast_odbc_release_obj(obj);
271                 return NULL;
272         }
273         
274         /* Now bind the parameters */
275         x = 1;
276
277         while((newparam = va_arg(ap, const char *))) {
278                 newval = va_arg(ap, const char *);
279                 SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
280         }
281                 
282         res = ast_odbc_smart_execute(obj, stmt);
283
284         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
285                 ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
286                 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
287                 ast_odbc_release_obj(obj);
288                 return NULL;
289         }
290
291         res = SQLNumResultCols(stmt, &colcount);
292         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
293                 ast_log(LOG_WARNING, "SQL Column Count error!\n[%s]\n\n", sql);
294                 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
295                 ast_odbc_release_obj(obj);
296                 return NULL;
297         }
298
299         cfg = ast_config_new();
300         if (!cfg) {
301                 ast_log(LOG_WARNING, "Out of memory!\n");
302                 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
303                 ast_odbc_release_obj(obj);
304                 return NULL;
305         }
306
307         while ((res=SQLFetch(stmt)) != SQL_NO_DATA) {
308                 var = NULL;
309                 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
310                         ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
311                         continue;
312                 }
313                 cat = ast_category_new("");
314                 if (!cat) {
315                         ast_log(LOG_WARNING, "Out of memory!\n");
316                         continue;
317                 }
318                 for (x=0;x<colcount;x++) {
319                         rowdata[0] = '\0';
320                         collen = sizeof(coltitle);
321                         res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen, 
322                                                 &datatype, &colsize, &decimaldigits, &nullable);
323                         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
324                                 ast_log(LOG_WARNING, "SQL Describe Column error!\n[%s]\n\n", sql);
325                                 ast_category_destroy(cat);
326                                 continue;
327                         }
328
329                         indicator = 0;
330                         res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), &indicator);
331                         if (indicator == SQL_NULL_DATA)
332                                 continue;
333
334                         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
335                                 ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
336                                 ast_category_destroy(cat);
337                                 continue;
338                         }
339                         stringp = rowdata;
340                         while(stringp) {
341                                 chunk = strsep(&stringp, ";");
342                                 if (!ast_strlen_zero(ast_strip(chunk))) {
343                                         if (initfield && !strcmp(initfield, coltitle))
344                                                 ast_category_rename(cat, chunk);
345                                         var = ast_variable_new(coltitle, chunk);
346                                         ast_variable_append(cat, var);
347                                 }
348                         }
349                 }
350                 ast_category_append(cfg, cat);
351         }
352
353         SQLFreeHandle(SQL_HANDLE_STMT, stmt);
354         ast_odbc_release_obj(obj);
355         return cfg;
356 }
357
358 static int update_odbc(const char *database, const char *table, const char *keyfield, const char *lookup, va_list ap)
359 {
360         struct odbc_obj *obj;
361         SQLHSTMT stmt;
362         char sql[256];
363         SQLLEN rowcount=0;
364         const char *newparam, *newval;
365         int res;
366         int x;
367         va_list aq;
368         
369         va_copy(aq, ap);
370         
371         if (!table)
372                 return -1;
373
374         obj = ast_odbc_request_obj(database, 0);
375         if (!obj)
376                 return -1;
377
378         res = SQLAllocHandle (SQL_HANDLE_STMT, obj->con, &stmt);
379         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
380                 ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
381                 ast_odbc_release_obj(obj);
382                 return -1;
383         }
384
385         newparam = va_arg(aq, const char *);
386         if (!newparam)  {
387                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
388                 ast_odbc_release_obj(obj);
389                 return -1;
390         }
391         newval = va_arg(aq, const char *);
392         snprintf(sql, sizeof(sql), "UPDATE %s SET %s=?", table, newparam);
393         while((newparam = va_arg(aq, const char *))) {
394                 snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), ", %s=?", newparam);
395                 newval = va_arg(aq, const char *);
396         }
397         va_end(aq);
398         snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " WHERE %s=?", keyfield);
399         
400         res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
401         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
402                 ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
403                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
404                 ast_odbc_release_obj(obj);
405                 return -1;
406         }
407         
408         /* Now bind the parameters */
409         x = 1;
410
411         while((newparam = va_arg(ap, const char *))) {
412                 newval = va_arg(ap, const char *);
413                 SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
414         }
415                 
416         SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(lookup), 0, (void *)lookup, 0, NULL);
417
418         res = ast_odbc_smart_execute(obj, stmt);
419
420         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
421                 ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
422                 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
423                 ast_odbc_release_obj(obj);
424                 return -1;
425         }
426
427         res = SQLRowCount(stmt, &rowcount);
428         SQLFreeHandle (SQL_HANDLE_STMT, stmt);
429         ast_odbc_release_obj(obj);
430
431         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
432                 ast_log(LOG_WARNING, "SQL Row Count error!\n[%s]\n\n", sql);
433                 return -1;
434         }
435
436         if (rowcount >= 0)
437                 return (int)rowcount;
438
439         return -1;
440 }
441
442 struct config_odbc_obj {
443         char *sql;
444         unsigned long id;
445         unsigned long cat_metric;
446         unsigned long var_metric;
447         unsigned long commented;
448         char filename[128];
449         char category[128];
450         char var_name[128];
451         char var_val[1024]; /* changed from 128 to 1024 via bug 8251 */
452         SQLINTEGER err;
453 };
454
455 static SQLHSTMT config_odbc_prepare(struct odbc_obj *obj, void *data)
456 {
457         struct config_odbc_obj *q = data;
458         SQLHSTMT sth;
459         int res;
460
461         res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &sth);
462         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
463                 if (option_verbose > 3)
464                         ast_verbose( VERBOSE_PREFIX_4 "Failure in AllocStatement %d\n", res);
465                 return NULL;
466         }
467
468         res = SQLPrepare(sth, (unsigned char *)q->sql, SQL_NTS);
469         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
470                 if (option_verbose > 3)
471                         ast_verbose( VERBOSE_PREFIX_4 "Error in PREPARE %d\n", res);
472                 SQLFreeHandle(SQL_HANDLE_STMT, sth);
473                 return NULL;
474         }
475
476         SQLBindCol(sth, 1, SQL_C_ULONG, &q->id, sizeof(q->id), &q->err);
477         SQLBindCol(sth, 2, SQL_C_ULONG, &q->cat_metric, sizeof(q->cat_metric), &q->err);
478         SQLBindCol(sth, 3, SQL_C_ULONG, &q->var_metric, sizeof(q->var_metric), &q->err);
479         SQLBindCol(sth, 4, SQL_C_ULONG, &q->commented, sizeof(q->commented), &q->err);
480         SQLBindCol(sth, 5, SQL_C_CHAR, q->filename, sizeof(q->filename), &q->err);
481         SQLBindCol(sth, 6, SQL_C_CHAR, q->category, sizeof(q->category), &q->err);
482         SQLBindCol(sth, 7, SQL_C_CHAR, q->var_name, sizeof(q->var_name), &q->err);
483         SQLBindCol(sth, 8, SQL_C_CHAR, q->var_val, sizeof(q->var_val), &q->err);
484
485         return sth;
486 }
487
488 static struct ast_config *config_odbc(const char *database, const char *table, const char *file, struct ast_config *cfg, int withcomments)
489 {
490         struct ast_variable *new_v;
491         struct ast_category *cur_cat;
492         int res = 0;
493         struct odbc_obj *obj;
494         char sql[255] = "";
495         unsigned int last_cat_metric = 0;
496         SQLSMALLINT rowcount=0;
497         SQLHSTMT stmt;
498         char last[128] = "";
499         struct config_odbc_obj q;
500
501         memset(&q, 0, sizeof(q));
502
503         if (!file || !strcmp (file, "res_config_odbc.conf"))
504                 return NULL;            /* cant configure myself with myself ! */
505
506         obj = ast_odbc_request_obj(database, 0);
507         if (!obj)
508                 return NULL;
509
510         snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE filename='%s' and commented=0 ORDER BY filename,cat_metric desc,var_metric asc,category,var_name,var_val,id", table, file);
511         q.sql = sql;
512
513         stmt = ast_odbc_prepare_and_execute(obj, config_odbc_prepare, &q);
514
515         if (!stmt) {
516                 ast_log(LOG_WARNING, "SQL select error!\n[%s]\n\n", sql);
517                 ast_odbc_release_obj(obj);
518                 return NULL;
519         }
520
521         res = SQLNumResultCols(stmt, &rowcount);
522
523         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
524                 ast_log(LOG_WARNING, "SQL NumResultCols error!\n[%s]\n\n", sql);
525                 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
526                 ast_odbc_release_obj(obj);
527                 return NULL;
528         }
529
530         if (!rowcount) {
531                 ast_log(LOG_NOTICE, "found nothing\n");
532                 ast_odbc_release_obj(obj);
533                 return cfg;
534         }
535
536         cur_cat = ast_config_get_current_category(cfg);
537
538         while ((res = SQLFetch(stmt)) != SQL_NO_DATA) {
539                 if (!strcmp (q.var_name, "#include")) {
540                         if (!ast_config_internal_load(q.var_val, cfg, 0)) {
541                                 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
542                                 ast_odbc_release_obj(obj);
543                                 return NULL;
544                         }
545                         continue;
546                 } 
547                 if (strcmp(last, q.category) || last_cat_metric != q.cat_metric) {
548                         cur_cat = ast_category_new(q.category);
549                         if (!cur_cat) {
550                                 ast_log(LOG_WARNING, "Out of memory!\n");
551                                 break;
552                         }
553                         strcpy(last, q.category);
554                         last_cat_metric = q.cat_metric;
555                         ast_category_append(cfg, cur_cat);
556                 }
557
558                 new_v = ast_variable_new(q.var_name, q.var_val);
559                 ast_variable_append(cur_cat, new_v);
560         }
561
562         SQLFreeHandle(SQL_HANDLE_STMT, stmt);
563         ast_odbc_release_obj(obj);
564         return cfg;
565 }
566
567 static struct ast_config_engine odbc_engine = {
568         .name = "odbc",
569         .load_func = config_odbc,
570         .realtime_func = realtime_odbc,
571         .realtime_multi_func = realtime_multi_odbc,
572         .update_func = update_odbc
573 };
574
575 static int unload_module (void)
576 {
577         ast_module_user_hangup_all();
578         ast_config_engine_deregister(&odbc_engine);
579         if (option_verbose)
580                 ast_verbose("res_config_odbc unloaded.\n");
581         return 0;
582 }
583
584 static int load_module (void)
585 {
586         ast_config_engine_register(&odbc_engine);
587         if (option_verbose)
588                 ast_verbose("res_config_odbc loaded.\n");
589         return 0;
590 }
591
592 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "ODBC Configuration",
593                 .load = load_module,
594                 .unload = unload_module,
595                 );