Revision 3500
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_io.py | ||
---|---|---|
107 | 107 |
RETURN value::'''+type_+'''; |
108 | 108 |
''')) |
109 | 109 |
body.lang='plpgsql' |
110 |
def_ = sql_gen.FunctionDef(function, type_, body,
|
|
111 |
[sql_gen.FunctionParam('value', 'text')], modifiers) |
|
110 |
sql.define_func(db, sql_gen.FunctionDef(function, type_, body,
|
|
111 |
[sql_gen.FunctionParam('value', 'text')], modifiers))
|
|
112 | 112 |
|
113 |
# Create function |
|
114 |
while True: |
|
115 |
try: |
|
116 |
sql.run_query(db, def_.to_str(db), recover=True, cacheable=True, |
|
117 |
log_ignore_excs=(sql.DuplicateException,)) |
|
118 |
break # successful |
|
119 |
except sql.DuplicateException: |
|
120 |
function.name = sql.next_version(function.name) |
|
121 |
# try again with next version of name |
|
122 |
|
|
123 | 113 |
return sql_gen.FunctionCall(function, col) |
124 | 114 |
|
125 | 115 |
def cast_temp_col(db, type_, col, errors_table=None): |
Also available in: Unified diff
sql_io.py: data_exception_handler(): Refactored to use new sql.define_func()