[asterisk-dev] [Code Review] 3346: [res_config_pgsql] Correct handling of nullable int fields in update_realtime

wdoekes reviewboard at asterisk.org
Mon Mar 17 04:08:32 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3346/#review11243
-----------------------------------------------------------


You're right that this is a bug fix. (We change no working behaviour, we only fix broken behaviour.)

The patch should therefore be against 1.8.


http://svn.asterisk.org/svn/asterisk/branches/11/res/res_config_pgsql.c
<https://reviewboard.asterisk.org/r/3346/#comment20879>

    Good catch :)



http://svn.asterisk.org/svn/asterisk/branches/11/res/res_config_pgsql.c
<https://reviewboard.asterisk.org/r/3346/#comment20878>

    The double occurrence of count++ smells bad.
    
    In both cases we do:
    
    if (count++) {
      ast_str_append(&sql, 0, ", ");
    }
    
    Let's just do that.
    
    
    
    As for the column->type strncmp: perhaps that should be inverted to the only cases where "" *is* legal.
    Peeking in require_pgsql(), we see this:
    
      strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0 || strcmp(column->type, "bpchar") == 0
    
    Otherwise the bug still exists for the crazy fool who uses a float for a port.


- wdoekes


On March 13, 2014, 10:06 a.m., zvision wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3346/
> -----------------------------------------------------------
> 
> (Updated March 13, 2014, 10:06 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-23351
>     https://issues.asterisk.org/jira/browse/ASTERISK-23351
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This patch fixes handling of nullable int columns in update_realtime function. It checks if a value is empty and sets the column to NULL instead of '', which raises an error.
> Additionally, it checks for existence of the keyfield column instead of the first parameter column.
> 
> 
> Diffs
> -----
> 
>   http://svn.asterisk.org/svn/asterisk/branches/11/res/res_config_pgsql.c 410508 
> 
> Diff: https://reviewboard.asterisk.org/r/3346/diff/
> 
> 
> Testing
> -------
> 
> Only tested for successful compilation. Someone needs to confirm that the patch works fine.
> 
> 
> Thanks,
> 
> zvision
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140317/188f7d85/attachment.html>


More information about the asterisk-dev mailing list