Revision 6900
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/sql.py | ||
---|---|---|
469 | 469 |
self.db.commit() |
470 | 470 |
|
471 | 471 |
def col_info(self, col, cacheable=True): |
472 |
module = util.root_module(db.db)
|
|
472 |
module = util.root_module(self.db)
|
|
473 | 473 |
if module == 'psycopg2': |
474 |
qual_table = sql_gen.Literal(col.table.to_str(db))
|
|
474 |
qual_table = sql_gen.Literal(col.table.to_str(self))
|
|
475 | 475 |
col_name_str = sql_gen.Literal(col.name) |
476 | 476 |
try: |
477 |
type_, type_is_array, default, nullable = row(run_query(db, '''\
|
|
477 |
type_, is_array, default, nullable = row(run_query(self, '''\
|
|
478 | 478 |
SELECT |
479 | 479 |
format_type(COALESCE(NULLIF(typelem, 0), pg_type.oid), -1) AS type |
480 | 480 |
, typcategory = 'A' AS type_is_array |
... | ... | |
489 | 489 |
''' |
490 | 490 |
, cacheable=True, log_level=4)) |
491 | 491 |
except StopIteration: raise sql_gen.NoUnderlyingTableException(col) |
492 |
if type_is_array: type_ = sql_gen.ArrayType(type_)
|
|
492 |
if is_array: type_ = sql_gen.ArrayType(type_) |
|
493 | 493 |
else: |
494 | 494 |
table = sql_gen.Table('columns', 'information_schema') |
495 | 495 |
cols = [sql_gen.Col('data_type'), sql_gen.Col('udt_name'), |
Also available in: Unified diff
sql.py: DbConn.col_info(): Fixed bug where self needs to be used everywhere that db normally is, because this is a DbConn method rather than a global function