]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_config_odbc: Prevent Realtime fallback on record-not-found (SQL_NO_DATA)
authorAlexei Gradinari <alex2grad@gmail.com>
Tue, 15 Jul 2025 21:56:39 +0000 (17:56 -0400)
committerAsterisk Development Team <asteriskteam@digium.com>
Wed, 10 Sep 2025 19:55:23 +0000 (19:55 +0000)
commitd676259dbb33b01ebe0c7024568f8033646c2ad1
tree2ffe48201d58c193eedb6f824c393f4533c858ca
parent4924fa3c1ddeb32e4c77a5bb7412a4fd784c9a4c
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
(cherry picked from commit df7fa2d1fdc01a92bf9c0c891a3e7909ef2a2ea6)
include/asterisk/config.h
main/config.c
res/res_config_odbc.c