fixed limit doesn't work for queries w/o postproc.
This commit is contained in:
+2
-3
@@ -424,7 +424,7 @@ class projection(ast_node):
|
||||
else:
|
||||
self.context.ccode = ''
|
||||
if self.limit != 0 and not self.outfile:
|
||||
self.context.direct_output()
|
||||
self.context.direct_output(self.limit)
|
||||
|
||||
class select_distinct(projection):
|
||||
first_order = 'select_distinct'
|
||||
@@ -1554,8 +1554,7 @@ class passthru_sql(ast_node):
|
||||
context.queries.append('Q' + sql.strip('\r\n\t ;') + ';')
|
||||
lq = sq.lower()
|
||||
if lq.startswith('select'):
|
||||
context.queries.append('O')
|
||||
|
||||
context.direct_output()
|
||||
|
||||
class user_module_function(OperatorBase):
|
||||
def __init__(self, name, nargs, ret_type, context : Context):
|
||||
|
||||
@@ -250,8 +250,12 @@ class Context:
|
||||
self.ccode = ''
|
||||
self.finalize_query()
|
||||
|
||||
def direct_output(self):
|
||||
self.queries.append('O')
|
||||
def direct_output(self, limit = -1, sep = ' ', end = '\n'):
|
||||
if type(limit) is not int or limit > 2**32 - 1 or limit < 0:
|
||||
limit = 2**32 - 1
|
||||
limit = limit.to_bytes(4, 'little').decode('latin-1')
|
||||
self.queries.append(
|
||||
'O' + limit + sep + end)
|
||||
|
||||
def abandon_postproc(self):
|
||||
self.ccode = ''
|
||||
|
||||
Reference in New Issue
Block a user