|
|
@ -360,6 +360,7 @@ static int odbc_register_class(struct odbc_class *class, int connect)
|
|
|
|
if (connect) {
|
|
|
|
if (connect) {
|
|
|
|
/* Request and release builds a connection */
|
|
|
|
/* Request and release builds a connection */
|
|
|
|
obj = ast_odbc_request_obj(class->name, 0);
|
|
|
|
obj = ast_odbc_request_obj(class->name, 0);
|
|
|
|
|
|
|
|
if (obj)
|
|
|
|
ast_odbc_release_obj(obj);
|
|
|
|
ast_odbc_release_obj(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -431,9 +432,10 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
|
|
|
|
ast_mutex_init(&obj->lock);
|
|
|
|
ast_mutex_init(&obj->lock);
|
|
|
|
obj->parent = class;
|
|
|
|
obj->parent = class;
|
|
|
|
if (odbc_obj_connect(obj) == ODBC_FAIL) {
|
|
|
|
if (odbc_obj_connect(obj) == ODBC_FAIL) {
|
|
|
|
ast_log(LOG_WARNING, "Failed to connect\n");
|
|
|
|
ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
|
|
|
|
ast_mutex_destroy(&obj->lock);
|
|
|
|
ast_mutex_destroy(&obj->lock);
|
|
|
|
free(obj);
|
|
|
|
free(obj);
|
|
|
|
|
|
|
|
obj = NULL;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
AST_LIST_INSERT_HEAD(&class->odbc_obj, obj, list);
|
|
|
|
AST_LIST_INSERT_HEAD(&class->odbc_obj, obj, list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|