res_odbc: Use SQL_SUCCEEDED() macro where applicable.

This is just a cleanup of some repetitive code.
This commit is contained in:
Sean Bright
2025-12-17 17:08:58 -05:00
parent 0e8a22caf0
commit aff11dca5f
6 changed files with 53 additions and 53 deletions

View File

@@ -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++) {