2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Mark Spencer <markster@digium.com>
8 * res_odbc.c <ODBC resource manager>
9 * Copyright (C) 2004 - 2005 Anthony Minessale II <anthmct@yahoo.com>
11 * See http://www.asterisk.org for more information about
12 * the Asterisk project. Please do not directly contact
13 * any of the maintainers of this project for assistance;
14 * the project provides a web site, mailing lists and IRC
15 * channels for your use.
17 * This program is free software, distributed under the terms of
18 * the GNU General Public License Version 2. See the LICENSE file
19 * at the top of the source tree.
24 * \brief ODBC resource manager
26 * \author Mark Spencer <markster@digium.com>
27 * \author Anthony Minessale II <anthmct@yahoo.com>
29 * \arg See also: \ref cdr_odbc
33 <depend>unixodbc</depend>
39 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
41 #include "asterisk/file.h"
42 #include "asterisk/channel.h"
43 #include "asterisk/config.h"
44 #include "asterisk/pbx.h"
45 #include "asterisk/module.h"
46 #include "asterisk/cli.h"
47 #include "asterisk/lock.h"
48 #include "asterisk/res_odbc.h"
49 #include "asterisk/time.h"
53 AST_LIST_ENTRY(odbc_class) list;
60 unsigned int haspool:1; /* Boolean - TDS databases need this */
61 unsigned int limit:10; /* Gives a limit of 1023 maximum */
62 unsigned int count:10; /* Running count of pooled connections */
63 unsigned int delme:1; /* Purge the class */
64 unsigned int backslash_is_escape:1; /* On this database, the backslash is a native escape sequence */
65 unsigned int idlecheck; /* Recheck the connection if it is idle for this long */
66 AST_LIST_HEAD(, odbc_obj) odbc_obj;
69 AST_LIST_HEAD_STATIC(odbc_list, odbc_class);
71 static odbc_status odbc_obj_connect(struct odbc_obj *obj);
72 static odbc_status odbc_obj_disconnect(struct odbc_obj *obj);
73 static int odbc_register_class(struct odbc_class *class, int connect);
76 SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT (*exec_cb)(struct odbc_obj *obj, void *data), void *data)
81 for (attempt = 0; attempt < 2; attempt++) {
82 stmt = exec_cb(obj, data);
88 ast_log(LOG_WARNING, "SQL Exec Direct failed. Attempting a reconnect...\n");
90 odbc_obj_disconnect(obj);
91 odbc_obj_connect(obj);
98 SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_cb)(struct odbc_obj *obj, void *data), void *data)
100 int res = 0, i, attempt;
101 SQLINTEGER nativeerror=0, numfields=0;
102 SQLSMALLINT diagbytes=0;
103 unsigned char state[10], diagnostic[256];
106 for (attempt = 0; attempt < 2; attempt++) {
107 /* This prepare callback may do more than just prepare -- it may also
108 * bind parameters, bind results, etc. The real key, here, is that
109 * when we disconnect, all handles become invalid for most databases.
110 * We must therefore redo everything when we establish a new
112 stmt = prepare_cb(obj, data);
115 res = SQLExecute(stmt);
116 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO) && (res != SQL_NO_DATA)) {
117 if (res == SQL_ERROR) {
118 SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
119 for (i = 0; i < numfields; i++) {
120 SQLGetDiagRec(SQL_HANDLE_STMT, stmt, i + 1, state, &nativeerror, diagnostic, sizeof(diagnostic), &diagbytes);
121 ast_log(LOG_WARNING, "SQL Execute returned an error %d: %s: %s (%d)\n", res, state, diagnostic, diagbytes);
123 ast_log(LOG_WARNING, "Oh, that was good. There are really %d diagnostics?\n", (int)numfields);
129 ast_log(LOG_WARNING, "SQL Execute error %d! Attempting a reconnect...\n", res);
130 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
135 * While this isn't the best way to try to correct an error, this won't automatically
136 * fail when the statement handle invalidates.
138 ast_odbc_sanity_check(obj);
141 obj->last_used = ast_tvnow();
143 } else if (attempt == 0)
144 ast_odbc_sanity_check(obj);
150 int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt)
153 SQLINTEGER nativeerror=0, numfields=0;
154 SQLSMALLINT diagbytes=0;
155 unsigned char state[10], diagnostic[256];
157 res = SQLExecute(stmt);
158 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO) && (res != SQL_NO_DATA)) {
159 if (res == SQL_ERROR) {
160 SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
161 for (i = 0; i < numfields; i++) {
162 SQLGetDiagRec(SQL_HANDLE_STMT, stmt, i + 1, state, &nativeerror, diagnostic, sizeof(diagnostic), &diagbytes);
163 ast_log(LOG_WARNING, "SQL Execute returned an error %d: %s: %s (%d)\n", res, state, diagnostic, diagbytes);
165 ast_log(LOG_WARNING, "Oh, that was good. There are really %d diagnostics?\n", (int)numfields);
171 /* This is a really bad method of trying to correct a dead connection. It
172 * only ever really worked with MySQL. It will not work with any other
173 * database, since most databases prepare their statements on the server,
174 * and if you disconnect, you invalidate the statement handle. Hence, if
175 * you disconnect, you're going to fail anyway, whether you try to execute
176 * a second time or not.
178 ast_log(LOG_WARNING, "SQL Execute error %d! Attempting a reconnect...\n", res);
179 ast_mutex_lock(&obj->lock);
181 ast_mutex_unlock(&obj->lock);
182 odbc_obj_disconnect(obj);
183 odbc_obj_connect(obj);
184 res = SQLExecute(stmt);
187 obj->last_used = ast_tvnow();
193 int ast_odbc_sanity_check(struct odbc_obj *obj)
195 char *test_sql = "select 1";
199 if (!ast_strlen_zero(obj->parent->sanitysql))
200 test_sql = obj->parent->sanitysql;
203 res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
204 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
207 res = SQLPrepare(stmt, (unsigned char *)test_sql, SQL_NTS);
208 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
211 res = SQLExecute(stmt);
212 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
217 SQLFreeHandle (SQL_HANDLE_STMT, stmt);
220 if (!obj->up) { /* Try to reconnect! */
221 ast_log(LOG_WARNING, "Connection is down attempting to reconnect...\n");
222 odbc_obj_disconnect(obj);
223 odbc_obj_connect(obj);
228 static int load_odbc_config(void)
230 static char *cfg = "res_odbc.conf";
231 struct ast_config *config;
232 struct ast_variable *v;
234 const char *dsn, *username, *password, *sanitysql;
235 int enabled, pooling, limit, bse;
236 unsigned int idlecheck;
237 int connect = 0, res = 0;
238 struct ast_flags config_flags = { 0 };
240 struct odbc_class *new;
242 config = ast_config_load(cfg, config_flags);
244 ast_log(LOG_WARNING, "Unable to load config file res_odbc.conf\n");
247 for (cat = ast_category_browse(config, NULL); cat; cat=ast_category_browse(config, cat)) {
248 if (!strcasecmp(cat, "ENV")) {
249 for (v = ast_variable_browse(config, cat); v; v = v->next) {
250 setenv(v->name, v->value, 1);
251 ast_log(LOG_NOTICE, "Adding ENV var: %s=%s\n", v->name, v->value);
254 /* Reset all to defaults for each class of odbc connections */
255 dsn = username = password = sanitysql = NULL;
257 connect = idlecheck = 0;
261 for (v = ast_variable_browse(config, cat); v; v = v->next) {
262 if (!strcasecmp(v->name, "pooling")) {
263 if (ast_true(v->value))
265 } else if (!strcasecmp(v->name, "limit")) {
266 sscanf(v->value, "%d", &limit);
267 if (ast_true(v->value) && !limit) {
268 ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat);
270 } else if (ast_false(v->value)) {
271 ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Disabling ODBC class '%s'.\n", v->value, cat);
275 } else if (!strcasecmp(v->name, "idlecheck")) {
276 sscanf(v->value, "%d", &idlecheck);
277 } else if (!strcasecmp(v->name, "enabled")) {
278 enabled = ast_true(v->value);
279 } else if (!strcasecmp(v->name, "pre-connect")) {
280 connect = ast_true(v->value);
281 } else if (!strcasecmp(v->name, "dsn")) {
283 } else if (!strcasecmp(v->name, "username")) {
285 } else if (!strcasecmp(v->name, "password")) {
287 } else if (!strcasecmp(v->name, "sanitysql")) {
288 sanitysql = v->value;
289 } else if (!strcasecmp(v->name, "backslash_is_escape")) {
290 bse = ast_true(v->value);
294 if (enabled && !ast_strlen_zero(dsn)) {
295 new = ast_calloc(1, sizeof(*new));
303 ast_copy_string(new->name, cat, sizeof(new->name));
305 ast_copy_string(new->dsn, dsn, sizeof(new->dsn));
307 new->username = ast_strdup(username);
309 new->password = ast_strdup(password);
311 ast_copy_string(new->sanitysql, sanitysql, sizeof(new->sanitysql));
313 SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &new->env);
314 res = SQLSetEnvAttr(new->env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
316 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
317 ast_log(LOG_WARNING, "res_odbc: Error SetEnv\n");
318 SQLFreeHandle(SQL_HANDLE_ENV, new->env);
323 new->haspool = pooling;
327 ast_log(LOG_WARNING, "Pooling without also setting a limit is pointless. Changing limit from 0 to 5.\n");
332 new->backslash_is_escape = bse ? 1 : 0;
333 new->idlecheck = idlecheck;
335 odbc_register_class(new, connect);
336 ast_log(LOG_NOTICE, "Registered ODBC class '%s' dsn->[%s]\n", cat, dsn);
340 ast_config_destroy(config);
344 static char *handle_cli_odbc_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
346 struct odbc_class *class;
347 struct odbc_obj *current;
354 e->command = "odbc show";
356 "Usage: odbc show [class]\n"
357 " List settings of a particular ODBC class or,\n"
358 " if not specified, all classes.\n";
363 length = strlen(a->word);
364 AST_LIST_LOCK(&odbc_list);
365 AST_LIST_TRAVERSE(&odbc_list, class, list) {
366 if (!strncasecmp(a->word, class->name, length) && ++which > a->n) {
367 ret = ast_strdup(class->name);
371 if (!ret && !strncasecmp(a->word, "all", length) && ++which > a->n) {
372 ret = ast_strdup("all");
374 AST_LIST_UNLOCK(&odbc_list);
378 ast_cli(a->fd, "\nODBC DSN Settings\n");
379 ast_cli(a->fd, "-----------------\n\n");
380 AST_LIST_LOCK(&odbc_list);
381 AST_LIST_TRAVERSE(&odbc_list, class, list) {
382 if ((a->argc == 2) || (a->argc == 3 && !strcmp(a->argv[2], "all")) || (!strcmp(a->argv[2], class->name))) {
384 ast_cli(a->fd, " Name: %s\n DSN: %s\n", class->name, class->dsn);
386 if (class->haspool) {
387 ast_cli(a->fd, " Pooled: Yes\n Limit: %d\n Connections in use: %d\n", class->limit, class->count);
389 AST_LIST_TRAVERSE(&(class->odbc_obj), current, list) {
390 ast_cli(a->fd, " - Connection %d: %s\n", ++count, current->used ? "in use" : current->up && ast_odbc_sanity_check(current) ? "connected" : "disconnected");
393 /* Should only ever be one of these */
394 AST_LIST_TRAVERSE(&(class->odbc_obj), current, list) {
395 ast_cli(a->fd, " Pooled: No\n Connected: %s\n", current->up && ast_odbc_sanity_check(current) ? "Yes" : "No");
398 ast_cli(a->fd, "\n");
401 AST_LIST_UNLOCK(&odbc_list);
406 static struct ast_cli_entry cli_odbc[] = {
407 AST_CLI_DEFINE(handle_cli_odbc_show, "List ODBC DSN(s)")
410 static int odbc_register_class(struct odbc_class *class, int connect)
412 struct odbc_obj *obj;
414 AST_LIST_LOCK(&odbc_list);
415 AST_LIST_INSERT_HEAD(&odbc_list, class, list);
416 AST_LIST_UNLOCK(&odbc_list);
419 /* Request and release builds a connection */
420 obj = ast_odbc_request_obj(class->name, 0);
422 ast_odbc_release_obj(obj);
427 ast_log(LOG_WARNING, "Attempted to register a NULL class?\n");
432 void ast_odbc_release_obj(struct odbc_obj *obj)
434 /* For pooled connections, this frees the connection to be
435 * reused. For non-pooled connections, it does nothing. */
439 int ast_odbc_backslash_is_escape(struct odbc_obj *obj)
441 return obj->parent->backslash_is_escape;
444 struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
446 struct odbc_obj *obj = NULL;
447 struct odbc_class *class;
449 AST_LIST_LOCK(&odbc_list);
450 AST_LIST_TRAVERSE(&odbc_list, class, list) {
451 if (!strcmp(class->name, name))
454 AST_LIST_UNLOCK(&odbc_list);
459 AST_LIST_LOCK(&class->odbc_obj);
460 if (class->haspool) {
461 /* Recycle connections before building another */
462 AST_LIST_TRAVERSE(&class->odbc_obj, obj, list) {
469 if (!obj && (class->count < class->limit)) {
471 obj = ast_calloc(1, sizeof(*obj));
473 AST_LIST_UNLOCK(&class->odbc_obj);
476 ast_mutex_init(&obj->lock);
478 if (odbc_obj_connect(obj) == ODBC_FAIL) {
479 ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
480 ast_mutex_destroy(&obj->lock);
486 AST_LIST_INSERT_TAIL(&class->odbc_obj, obj, list);
490 /* Non-pooled connection: multiple modules can use the same connection. */
491 AST_LIST_TRAVERSE(&class->odbc_obj, obj, list) {
492 /* Non-pooled connection: if there is an entry, return it */
497 /* No entry: build one */
498 obj = ast_calloc(1, sizeof(*obj));
500 AST_LIST_UNLOCK(&class->odbc_obj);
503 ast_mutex_init(&obj->lock);
505 if (odbc_obj_connect(obj) == ODBC_FAIL) {
506 ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
507 ast_mutex_destroy(&obj->lock);
511 AST_LIST_INSERT_HEAD(&class->odbc_obj, obj, list);
515 AST_LIST_UNLOCK(&class->odbc_obj);
518 ast_odbc_sanity_check(obj);
519 } else if (obj->parent->idlecheck > 0 && ast_tvdiff_ms(ast_tvnow(), obj->last_used) / 1000 > obj->parent->idlecheck)
520 odbc_obj_connect(obj);
525 static odbc_status odbc_obj_disconnect(struct odbc_obj *obj)
528 ast_mutex_lock(&obj->lock);
530 res = SQLDisconnect(obj->con);
532 if (res == ODBC_SUCCESS) {
533 ast_log(LOG_WARNING, "res_odbc: disconnected %d from %s [%s]\n", res, obj->parent->name, obj->parent->dsn);
535 ast_log(LOG_WARNING, "res_odbc: %s [%s] already disconnected\n",
536 obj->parent->name, obj->parent->dsn);
539 ast_mutex_unlock(&obj->lock);
543 static odbc_status odbc_obj_connect(struct odbc_obj *obj)
548 unsigned char msg[200], stat[10];
550 SQLINTEGER enable = 1;
551 char *tracefile = "/tmp/odbc.trace";
553 ast_mutex_lock(&obj->lock);
555 res = SQLAllocHandle(SQL_HANDLE_DBC, obj->parent->env, &obj->con);
557 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
558 ast_log(LOG_WARNING, "res_odbc: Error AllocHDB %d\n", res);
559 ast_mutex_unlock(&obj->lock);
562 SQLSetConnectAttr(obj->con, SQL_LOGIN_TIMEOUT, (SQLPOINTER *) 10, 0);
563 SQLSetConnectAttr(obj->con, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER *) 10, 0);
565 SQLSetConnectAttr(obj->con, SQL_ATTR_TRACE, &enable, SQL_IS_INTEGER);
566 SQLSetConnectAttr(obj->con, SQL_ATTR_TRACEFILE, tracefile, strlen(tracefile));
570 odbc_obj_disconnect(obj);
571 ast_log(LOG_NOTICE, "Re-connecting %s\n", obj->parent->name);
573 ast_log(LOG_NOTICE, "Connecting %s\n", obj->parent->name);
576 res = SQLConnect(obj->con,
577 (SQLCHAR *) obj->parent->dsn, SQL_NTS,
578 (SQLCHAR *) obj->parent->username, SQL_NTS,
579 (SQLCHAR *) obj->parent->password, SQL_NTS);
581 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
582 SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, stat, &err, msg, 100, &mlen);
583 ast_mutex_unlock(&obj->lock);
584 ast_log(LOG_WARNING, "res_odbc: Error SQLConnect=%d errno=%d %s\n", res, (int)err, msg);
587 ast_log(LOG_NOTICE, "res_odbc: Connected to %s [%s]\n", obj->parent->name, obj->parent->dsn);
589 obj->last_used = ast_tvnow();
592 ast_mutex_unlock(&obj->lock);
596 static int reload(void)
598 static char *cfg = "res_odbc.conf";
599 struct ast_config *config;
600 struct ast_variable *v;
602 const char *dsn, *username, *password, *sanitysql;
603 int enabled, pooling, limit, bse;
604 unsigned int idlecheck;
605 int connect = 0, res = 0;
606 struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
608 struct odbc_class *new, *class;
609 struct odbc_obj *current;
611 /* First, mark all to be purged */
612 AST_LIST_LOCK(&odbc_list);
613 AST_LIST_TRAVERSE(&odbc_list, class, list) {
617 config = ast_config_load(cfg, config_flags);
618 if (config != NULL && config != CONFIG_STATUS_FILEUNCHANGED) {
619 for (cat = ast_category_browse(config, NULL); cat; cat=ast_category_browse(config, cat)) {
620 if (!strcasecmp(cat, "ENV")) {
621 for (v = ast_variable_browse(config, cat); v; v = v->next) {
622 setenv(v->name, v->value, 1);
623 ast_log(LOG_NOTICE, "Adding ENV var: %s=%s\n", v->name, v->value);
627 /* Reset all to defaults for each class of odbc connections */
628 dsn = username = password = sanitysql = NULL;
630 connect = idlecheck = 0;
634 for (v = ast_variable_browse(config, cat); v; v = v->next) {
635 if (!strcasecmp(v->name, "pooling")) {
637 } else if (!strcasecmp(v->name, "limit")) {
638 sscanf(v->value, "%d", &limit);
639 if (ast_true(v->value) && !limit) {
640 ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat);
642 } else if (ast_false(v->value)) {
643 ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Disabling ODBC class '%s'.\n", v->value, cat);
647 } else if (!strcasecmp(v->name, "idlecheck")) {
648 sscanf(v->value, "%ud", &idlecheck);
649 } else if (!strcasecmp(v->name, "enabled")) {
650 enabled = ast_true(v->value);
651 } else if (!strcasecmp(v->name, "pre-connect")) {
652 connect = ast_true(v->value);
653 } else if (!strcasecmp(v->name, "dsn")) {
655 } else if (!strcasecmp(v->name, "username")) {
657 } else if (!strcasecmp(v->name, "password")) {
659 } else if (!strcasecmp(v->name, "sanitysql")) {
660 sanitysql = v->value;
661 } else if (!strcasecmp(v->name, "backslash_is_escape")) {
662 bse = ast_true(v->value);
666 if (enabled && !ast_strlen_zero(dsn)) {
667 /* First, check the list to see if it already exists */
668 AST_LIST_TRAVERSE(&odbc_list, class, list) {
669 if (!strcmp(class->name, cat)) {
678 new = ast_calloc(1, sizeof(*new));
687 ast_copy_string(new->name, cat, sizeof(new->name));
689 ast_copy_string(new->dsn, dsn, sizeof(new->dsn));
691 /* Safely replace username */
692 if (class && class->username)
693 freeme = class->username;
695 new->username = ast_strdup(username);
701 /* Safely replace password */
702 if (class && class->password)
703 freeme = class->password;
705 new->password = ast_strdup(password);
712 ast_copy_string(new->sanitysql, sanitysql, sizeof(new->sanitysql));
715 SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &new->env);
716 res = SQLSetEnvAttr(new->env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
718 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
719 ast_log(LOG_WARNING, "res_odbc: Error SetEnv\n");
720 SQLFreeHandle(SQL_HANDLE_ENV, new->env);
721 AST_LIST_UNLOCK(&odbc_list);
727 new->haspool = pooling;
731 ast_log(LOG_WARNING, "Pooling without also setting a limit is pointless. Changing limit from 0 to 5.\n");
736 new->backslash_is_escape = bse;
737 new->idlecheck = idlecheck;
740 ast_log(LOG_NOTICE, "Refreshing ODBC class '%s' dsn->[%s]\n", cat, dsn);
742 odbc_register_class(new, connect);
743 ast_log(LOG_NOTICE, "Registered ODBC class '%s' dsn->[%s]\n", cat, dsn);
748 ast_config_destroy(config);
751 /* Purge classes that we know can go away (pooled with 0, only) */
752 AST_LIST_TRAVERSE_SAFE_BEGIN(&odbc_list, class, list) {
753 if (class->delme && class->haspool && class->count == 0) {
754 while ((current = AST_LIST_REMOVE_HEAD(&class->odbc_obj, list))) {
755 odbc_obj_disconnect(current);
756 ast_mutex_destroy(¤t->lock);
760 AST_LIST_REMOVE_CURRENT(list);
762 ast_free(class->username);
764 ast_free(class->password);
768 AST_LIST_TRAVERSE_SAFE_END;
769 AST_LIST_UNLOCK(&odbc_list);
774 static int unload_module(void)
776 /* Prohibit unloading */
780 static int load_module(void)
782 if (load_odbc_config() == -1)
783 return AST_MODULE_LOAD_DECLINE;
784 ast_cli_register_multiple(cli_odbc, sizeof(cli_odbc) / sizeof(struct ast_cli_entry));
785 ast_log(LOG_NOTICE, "res_odbc loaded.\n");
789 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "ODBC resource",
791 .unload = unload_module,