Esempio n. 1
0
 def select(self, instance):
     sql_query = SqlQuery(instance.db)
     status, data = sql_query.get_select_result(instance.sql_content)
     instance.handle_result_execute = json.dumps([str(row) for row in data],
                                                 cls=DateEncoder)
     instance.status = status
     return instance, len(data)
Esempio n. 2
0
 def select(self, instance):
     sql_query = SqlQuery(instance.db)
     sqlcontent = instance.sql_content
     sqlcontent = re.sub(r"/\*[^*]*\*+(?:[^*/][^*]*\*+)*/", "", sqlcontent)
     lines = [line for line in sqlcontent.splitlines() if not re.match("^\s*(--|#)", line)]
     sqlcontent = " ".join([re.split("--|# ", line)[0] for line in lines])
     status, data = sql_query.get_select_result(sqlcontent)
     instance.handle_result_execute = json.dumps([str(row) for row in data], cls=DateEncoder)
     instance.status = status
     return instance, len(data)