If RLM_SQL_ALT_QUERY is treated as an error, then redundant SQL xlats
will try the same query again on each database host (with the same
result).
To handle switching to a different query if an INSERT fails due to key
contraints, then the return value of the xlat, which is the number of
affected rows should be checked instead.
fr_assert(query_ctx->type == SQL_QUERY_OTHER);
- if (query_ctx->rcode != RLM_SQL_OK) {
+ switch (query_ctx->rcode) {
+ case RLM_SQL_QUERY_INVALID:
+ case RLM_SQL_ERROR:
+ case RLM_SQL_RECONNECT:
RERROR("SQL query failed: %s", fr_table_str_by_value(sql_rcode_description_table,
query_ctx->rcode, "<INVALID>"));
rlm_sql_print_error(inst, request, query_ctx, false);
ret = XLAT_ACTION_FAIL;
goto finish;
+
+ default:
+ break;
}
numaffected = (inst->driver->sql_affected_rows)(query_ctx, &inst->config);