mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-14 19:57:03 +00:00
res_odbc: Use SQL_SUCCEEDED() macro where applicable.
This is just a cleanup of some repetitive code.
This commit is contained in:
@@ -151,14 +151,14 @@ static int load_config(void)
|
||||
lentable = strlen(table);
|
||||
|
||||
res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
if (!SQL_SUCCEEDED(res)) {
|
||||
ast_log(LOG_WARNING, "SQL Alloc Handle failed on connection '%s'!\n", connection);
|
||||
ast_odbc_release_obj(obj);
|
||||
continue;
|
||||
}
|
||||
|
||||
res = SQLColumns(stmt, NULL, 0, NULL, 0, (unsigned char *)table, SQL_NTS, (unsigned char *)"%", SQL_NTS);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
if (!SQL_SUCCEEDED(res)) {
|
||||
ast_log(LOG_ERROR, "Unable to query database columns on connection '%s'. Skipping.\n", connection);
|
||||
ast_odbc_release_obj(obj);
|
||||
continue;
|
||||
@@ -318,13 +318,13 @@ static SQLHSTMT generic_prepare(struct odbc_obj *obj, void *data)
|
||||
unsigned char state[10], diagnostic[256];
|
||||
|
||||
res = SQLAllocHandle (SQL_HANDLE_STMT, obj->con, &stmt);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
if (!SQL_SUCCEEDED(res)) {
|
||||
ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res = ast_odbc_prepare(obj, stmt, sql);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
if (!SQL_SUCCEEDED(res)) {
|
||||
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
||||
SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
|
||||
for (i = 0; i < numfields; i++) {
|
||||
|
||||
Reference in New Issue
Block a user