[Asterisk-code-review] res_config_odbc: Preserve empty strings returned by the database (asterisk[13])

Sean Bright asteriskteam at digium.com
Wed Jan 29 09:13:46 CST 2020


Sean Bright has uploaded a new patch set (#2). ( https://gerrit.asterisk.org/c/asterisk/+/13722 )

Change subject: res_config_odbc: Preserve empty strings returned by the database
......................................................................

res_config_odbc: Preserve empty strings returned by the database

When res_config_odbc (and perhaps other realtime backends) reads a SQL
NULL from the database, it coalesces the value to the empty string
which prevents it from being returned to the realtime core.

However, if it instead reads the empty string from the database, it
needs a way to encode that fact without having the value omitted
entirely. It does this by changing the value to a string with a single
space. The realtime code in main/config.c recognizes this special case
and _turns the string back into the empty string_ before passing it to
realtime API consumers.

For all of this to work, we need to ensure that we actually pass the
single-space-string back to the realtime core, which is currently
failing because we are trimming the value before checking its
content. So instead we now special case the single-space-string case
so that empty values are returned properly.

ASTERISK-28719 #close
Reported by: EDV O-TON

Change-Id: I673ed8c31ad037aa224e80c78c7a1dc4e4a4e3de
---
M res/res_config_odbc.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/22/13722/2
-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13722
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I673ed8c31ad037aa224e80c78c7a1dc4e4a4e3de
Gerrit-Change-Number: 13722
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-CC: Friendly Automation
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200129/19684530/attachment.html>


More information about the asterisk-code-review mailing list