bug fixes
This commit is contained in:
+3
-2
@@ -882,10 +882,11 @@ class drop(ast_node):
|
||||
for a in tbl_obj.alias:
|
||||
self.context.tables_byname.pop(a, None)
|
||||
# TODO: delete in postproc engine
|
||||
self.context.tables_byname.pop(tbl_name)
|
||||
self.context.tables.remove(tbl_obj)
|
||||
self.context.tables_byname.pop(tbl_name, None)
|
||||
self.context.tables.discard(tbl_obj)
|
||||
self.sql += 'TABLE IF EXISTS ' + tbl_name
|
||||
return
|
||||
|
||||
elif 'if_exists' not in node or not node['if_exists']:
|
||||
print(f'Error: table {tbl_name} not found.')
|
||||
self.sql = ''
|
||||
|
||||
+7
-1
@@ -307,9 +307,15 @@ class expr(ast_node):
|
||||
self.opname = node
|
||||
if type(node) is int:
|
||||
if (node >= 2**63 - 1 or node <= -2**63):
|
||||
self.type = HgeT
|
||||
elif (node >= 2**31 - 1 or node <= -2**31):
|
||||
self.type = LongT
|
||||
else:
|
||||
elif node >= 2**15 - 1 or node <= -2**15:
|
||||
self.type = IntT
|
||||
elif node >= 2**7 - 1 or node <= -2**7:
|
||||
self.type = ShortT
|
||||
else:
|
||||
self.type = ByteT
|
||||
elif type(node) is float:
|
||||
self.type = DoubleT
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ class TableInfo:
|
||||
self.order = [] # assumptions
|
||||
|
||||
cxt.tables_byname[self.table_name] = self # construct reverse map
|
||||
|
||||
cxt.tables.add(self)
|
||||
|
||||
def add_cols(self, cols, new = True):
|
||||
for c in enlist(cols):
|
||||
self.add_col(c, new)
|
||||
@@ -137,7 +138,7 @@ class Context:
|
||||
def __init__(self):
|
||||
self.tables_byname = dict()
|
||||
self.col_byname = dict()
|
||||
self.tables : List[TableInfo] = []
|
||||
self.tables : Set[TableInfo] = set()
|
||||
self.cols = []
|
||||
self.datasource = None
|
||||
self.module_stubs = ''
|
||||
@@ -166,7 +167,7 @@ class Context:
|
||||
self.ccode += c + '\n'
|
||||
def add_table(self, table_name, cols):
|
||||
tbl = TableInfo(table_name, cols, self)
|
||||
self.tables.append(tbl)
|
||||
self.tables.add(tbl)
|
||||
return tbl
|
||||
def remove_scan(self, scan, str_scan):
|
||||
self.emitc(str_scan)
|
||||
|
||||
Reference in New Issue
Block a user