mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
res_config_odbc: Prevent Realtime fallback on record-not-found (SQL_NO_DATA)
This patch fixes an issue in the ODBC Realtime engine where Asterisk incorrectly falls back to the next configured backend when the current one returns SQL_NO_DATA (i.e., no record found). This is a logical error and performance risk in multi-backend configurations. Solution: Introduced CONFIG_RT_NOT_FOUND ((void *)-1) as a special return marker. ODBC Realtime backend now return CONFIG_RT_NOT_FOUND when no data is found. Core engine stops iterating on this marker, avoiding unnecessary fallback. Notes: Other Realtime backends (PostgreSQL, LDAP, etc.) can be updated similarly. This patch only covers ODBC. Fixes: #1305
This commit is contained in:
@@ -126,6 +126,12 @@ typedef int realtime_require(const char *database, const char *table, va_list ap
|
||||
*/
|
||||
typedef int realtime_unload(const char *database, const char *table);
|
||||
|
||||
/*! Special return value indicating a successful query that returned no data.
|
||||
* Used by realtime backends to signal "not found" vs an actual backend failure.
|
||||
* This allows the core engine to differentiate and avoid unnecessary failover.
|
||||
*/
|
||||
#define CONFIG_RT_NOT_FOUND (void *)-1
|
||||
|
||||
/*! \brief Configuration engine structure, used to define realtime drivers */
|
||||
struct ast_config_engine {
|
||||
char *name;
|
||||
|
Reference in New Issue
Block a user