Project

General

Profile

« Previous | Next » 

Revision 3706

sql_gen.py: Added to_text() and helper value null_as_str

View differences:

lib/sql_gen.py
961 961
    def __init__(self, *args):
962 962
        FunctionCall.__init__(self, InternalFunction('NULLIF'), *args)
963 963

  
964
null_as_str = Cast('text', 'NULL')
965

  
966
def to_text(value): return Coalesce(Cast('text', value), null_as_str)
967

  
964 968
# See <http://www.postgresql.org/docs/8.3/static/datatype-numeric.html>
965 969
null_sentinels = {
966 970
    'character varying': r'\N',

Also available in: Unified diff