• M
    Fixes: · 9305fc74
    Marc G. Fournier 提交于
    Attached is a patch to allow libpq to determine if a field is null.
    
    This is needed because text fields will return a PQgetlength() of 0
    whether it is '' or NULL.  There is even a comment in the source noting
    the fact.
    
    I have changed the value of the 'len' field for NULL result fields.  If
    the field is null, the len is set to -1 (NULL_LEN).  I have changed
    PQgetlength() to return a 0 length for both '' and NULL.  A new function
    PQgetisnull() returns true or false for NULL.
    
    The only risk is to applications that do not use the suggested
    PQgetlength() call, but read the result 'len' field directly.
    
    As this is not recommended, I think we are safe here.
    
    A separate documentation patch will be sent.
    
    
    Submitted by: Bruce Momjian <maillist@candle.pha.pa.us>
    9305fc74
fe-exec.c 36.1 KB