|
|
|
@ -518,7 +518,7 @@ static int update_odbc(const char *database, const char *table, const char *keyf
|
|
|
|
|
}
|
|
|
|
|
va_arg(aq, const char *);
|
|
|
|
|
|
|
|
|
|
if (tableptr && !(column = ast_odbc_find_column(tableptr, newparam))) {
|
|
|
|
|
if (tableptr && !ast_odbc_find_column(tableptr, newparam)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Key field '%s' does not exist in table '%s@%s'. Update will fail\n", newparam, table, database);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -587,7 +587,6 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
va_list ap;
|
|
|
|
|
struct odbc_cache_tables *tableptr = ast_odbc_find_table(ups->database, ups->table);
|
|
|
|
|
struct odbc_cache_columns *column;
|
|
|
|
|
|
|
|
|
|
if (!sql) {
|
|
|
|
|
if (tableptr) {
|
|
|
|
@ -619,7 +618,7 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
|
|
|
|
|
|
|
|
|
|
while ((newparam = va_arg(ap, const char *))) {
|
|
|
|
|
newval = va_arg(ap, const char *);
|
|
|
|
|
if ((column = ast_odbc_find_column(tableptr, newparam))) {
|
|
|
|
|
if (ast_odbc_find_column(tableptr, newparam)) {
|
|
|
|
|
ast_str_append(&sql, 0, "%s%s=? ", first ? "" : ", ", newparam);
|
|
|
|
|
SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
|
|
|
|
|
first = 0;
|
|
|
|
@ -637,7 +636,7 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
|
|
|
|
|
|
|
|
|
|
while ((newparam = va_arg(ap, const char *))) {
|
|
|
|
|
newval = va_arg(ap, const char *);
|
|
|
|
|
if (!(column = ast_odbc_find_column(tableptr, newparam))) {
|
|
|
|
|
if (!ast_odbc_find_column(tableptr, newparam)) {
|
|
|
|
|
va_end(ap);
|
|
|
|
|
ast_log(LOG_ERROR, "One or more of the criteria columns '%s' on '%s@%s' for this update does not exist!\n", newparam, ups->table, ups->database);
|
|
|
|
|
ast_odbc_release_table(tableptr);
|
|
|
|
|