Revision 5331
Added by Aaron Marcuse-Kubitza about 12 years ago
sql_gen.py | ||
---|---|---|
1064 | 1064 |
@throws ensure_not_null_excs |
1065 | 1065 |
''' |
1066 | 1066 |
col = remove_col_rename(col) |
1067 |
nullable = True |
|
1068 | 1067 |
try: typed_col = db.col_info(underlying_col(col)) |
1069 | 1068 |
except NoUnderlyingTableException: |
1070 |
if is_literal(col) and not is_null(col): nullable = False |
|
1071 |
elif type_ == None: raise |
|
1069 |
if type_ == None and is_null(col): raise |
|
1072 | 1070 |
else: |
1073 | 1071 |
if type_ == None: type_ = typed_col.type |
1074 | 1072 |
elif type_ != typed_col.type: col = Cast(type_, col) |
1075 |
nullable = typed_col.nullable |
|
1076 | 1073 |
|
1077 |
if nullable:
|
|
1074 |
if is_nullable(db, col):
|
|
1078 | 1075 |
try: col = EnsureNotNull(col, type_) |
1079 | 1076 |
except KeyError, e: |
1080 | 1077 |
# Warn of no null sentinel for type, even if caller catches error |
Also available in: Unified diff
sql_gen.py: ensure_not_null(): Use is_nullable() instead of determining nullability itself, for clarity