mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
Add a direct execute method to res_odbc (closes issue #10722)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82393 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -77,6 +77,28 @@ static odbc_status odbc_obj_disconnect(struct odbc_obj *obj);
|
||||
static int odbc_register_class(struct odbc_class *class, int connect);
|
||||
|
||||
|
||||
SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT (*exec_cb)(struct odbc_obj *obj, void *data), void *data)
|
||||
{
|
||||
int attempt;
|
||||
SQLHSTMT stmt;
|
||||
|
||||
for (attempt = 0; attempt < 2; attempt++) {
|
||||
stmt = exec_cb(obj, data);
|
||||
|
||||
if (stmt) {
|
||||
break;
|
||||
} else {
|
||||
obj->up = 0;
|
||||
ast_log(LOG_WARNING, "SQL Exec Direct failed. Attempting a reconnect...\n");
|
||||
|
||||
odbc_obj_disconnect(obj);
|
||||
odbc_obj_connect(obj);
|
||||
}
|
||||
}
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_cb)(struct odbc_obj *obj, void *data), void *data)
|
||||
{
|
||||
int res = 0, i, attempt;
|
||||
|
Reference in New Issue
Block a user