<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13711">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_config_odbc: Preserve empty strings returned by the database<br><br>When res_config_odbc (and perhaps other realtime backends) reads a SQL<br>NULL from the database, it coalesces the value to the empty string<br>which prevents it from being returned to the realtime core.<br><br>However, if it instead reads the empty string from the database, it<br>needs a way to encode that fact without having the value omitted<br>entirely. It does this by changing the value to a string with a single<br>space. The realtime code in main/config.c recognizes this special case<br>and _turns the string back into the empty string_ before passing it to<br>realtime API consumers.<br><br>For all of this to work, we need to ensure that we actually pass the<br>single-space-string back to the realtime core, which is currently<br>failing because we are trimming the value before checking its<br>content. So instead we now special case the single-space-string case<br>so that empty values are returned properly.<br><br>ASTERISK-28719 #close<br>Reported by: EDV O-TON<br><br>Change-Id: I673ed8c31ad037aa224e80c78c7a1dc4e4a4e3de<br>---<br>M res/res_config_odbc.c<br>1 file changed, 1 insertion(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c</span><br><span>index fd0078f..45bb214 100644</span><br><span>--- a/res/res_config_odbc.c</span><br><span>+++ b/res/res_config_odbc.c</span><br><span>@@ -303,7 +303,7 @@</span><br><span> } else {</span><br><span> while (stringp) {</span><br><span> chunk = strsep(&stringp, ";");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(ast_strip(chunk))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcmp(chunk, " ") || !ast_strlen_zero(ast_strip(chunk))) {</span><br><span> if (strchr(chunk, '^')) {</span><br><span> decode_chunk(chunk);</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13711">change 13711</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13711"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: I673ed8c31ad037aa224e80c78c7a1dc4e4a4e3de </div>
<div style="display:none"> Gerrit-Change-Number: 13711 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>