def sql(sqlquery): import locale from lib import pptable global test_connection language, output_encoding = locale.getdefaultlocale() if output_encoding == None: output_encoding = "UTF8" test_cursor = test_connection.cursor() e = test_cursor.execute(sqlquery.decode(output_encoding)) try: desc = test_cursor.getdescription() print pptable.indent([[x[0] for x in desc]] + [x for x in e], hasHeader=True), except apsw.ExecutionCompleteError: print '', test_cursor.close()
def sql(sqlquery): import locale from lib import pptable global test_connection language, output_encoding = locale.getdefaultlocale() if output_encoding==None: output_encoding="UTF8" test_cursor=test_connection.cursor() e=test_cursor.execute(sqlquery.decode(output_encoding)) try: desc=test_cursor.getdescription() print pptable.indent([[x[0] for x in desc]]+[x for x in e], hasHeader=True), except apsw.ExecutionCompleteError: print '', test_cursor.close()