Project

General

Profile

« Previous | Next » 

Revision 2857

sql_gen.py: CompareCond.to_str(): Use ensure_not_null()'s new type_ param to apply same function to both sides but not if the right side is already NOT NULL

View differences:

sql_gen.py
409 409
        # Handle nullable columns
410 410
        check_null = False
411 411
        if not passthru_null_ref[0]: # NULLs compare equal
412
            try: left_non_null = ensure_not_null(db, left_value)
412
            try: left_value = ensure_not_null(db, left_value)
413 413
            except ensure_not_null_excs: # fall back to alternate method
414 414
                check_null = equals and isinstance(right_value, Col)
415 415
            else:
416
                if left_non_null is not left_value: # wrapped, so wrap both
417
                    left_value = left_non_null
418
                    right_value = EnsureNotNull(right_value, left_value.type)
416
                if isinstance(left_value, EnsureNotNull):
417
                    right_value = ensure_not_null(db, right_value,
418
                        left_value.type) # apply same function to both sides
419 419
        
420 420
        if equals and is_null(right_value): operator = 'IS'
421 421
        

Also available in: Unified diff