Project

General

Profile

« Previous | Next » 

Revision 2861

sql_gen.py: null_sentinels: Removed types where a sentinel doesn't make sense (unknown types, boolean) because types with no sentinel are now handled gracefully by users of ensure_not_null()

View differences:

sql_gen.py
526 526
row_count = CustomCode('count(*)')
527 527

  
528 528
# See <http://www.postgresql.org/docs/8.3/static/datatype-numeric.html>
529
null_sentinels = {'USER-DEFINED': None, 'boolean': False, 'integer': 2147483647,
530
    'text': r'\N', 'character varying': r'\N'}
529
null_sentinels = {'integer': 2147483647, 'text': r'\N',
530
    'character varying': r'\N'}
531 531

  
532 532
class EnsureNotNull(FunctionCall):
533 533
    def __init__(self, value, type_):
......
601 601
        if type_ == None: type_ = typed_col.type
602 602
        nullable = typed_col.nullable
603 603
    
604
    if nullable and null_sentinels[type_] != None:
605
        col = EnsureNotNull(col, type_)
604
    if nullable: col = EnsureNotNull(col, type_)
606 605
    return col

Also available in: Unified diff