def main(): print ("dsad") io = general() #io.initPage(2) io.write() eval = evaluator() eval.execute( """ create table table_name ( column_name1 data_type(size), column_name2 data_type(size), column_name3 data_type(size), ); """ ) tblm = manager() tblm.createTable("students2", [["id", "integer"], ["phone", "string"]]) ctlg2 = catalogCore() ctlg2.loadCatalog("students2") ctlg2.printCtlg() ins = insert() #ins.insertRecord("students2", ["26", "terce32441iro"]) #for x in range(25, 82): # ins.insertRecord("students3", [str(x), "terce3PG32323o" + str(x)]) sel = select() upd = update() #sel.selection("students2", []) upd.update("students2", [['phone', 'terceiro2221see']], [['phone', 'terceiro2221seesss']]) sel.selection("students2", [['phone', 'terce32441iro']]) print("321-----") #sel.selection("students2", []) #sel.selection("students3", []) #sel.join("students2", "students3", sel.selection("students2", []), sel.selection("students3", []), "id") main_pool.forceBuffer() print(main_pool.pool) from query.parser.sqlparse import parser pt = parser() #print(pt.parse("select * from x where x = 3 and y = 9")) #eval.execQuery("insert into students2 values (\"83\", \"gravado\")") print("select") eval.execQuery("select * from students2 where phone = 'gravado'") #where phone = terce32441iro
def main(): print ("dsad") io = general() #io.initPage(2) io.write() eval = evaluator() eval.execute( """ create table table_name ( column_name1 data_type(size), column_name2 data_type(size), column_name3 data_type(size), ); """ ) tblm = manager() tblm.createTable("students2", [["id", "integer"], ["phone", "string"]]) ctlg2 = catalogCore() ctlg2.loadCatalog("students2") ctlg2.printCtlg() ins = insert() #ins.insertRecord("students2", ["26", "terce32441iro"]) #for x in range(25, 82): # ins.insertRecord("students3", [str(x), "terce3PG32323o" + str(x)]) sel = select() upd = update() #sel.selection("students2", []) upd.update("students2", [['phone', 'terceiro2221see']], [['phone', 'terceiro2221seesss']]) sel.selection("students2", [['phone', 'terce32441iro']]) print("321-----") #sel.selection("students2", []) #sel.selection("students3", []) #sel.join("students2", "students3", sel.selection("students2", []), sel.selection("students3", []), "id") main_pool.forceBuffer() print(main_pool.pool) from query.parser.sqlparse import parser pt = parser() #print(pt.parse("select * from x where x = 3 and y = 9")) #eval.execQuery("insert into students2 values (\"83\", \"gravado\")") print("select") eval.execQuery("select * from students2 where id = '26'") #where phone = terce32441iro
def exec(self, query): from query.parser.sqlparse import parser pt = parser() gentokens = pt.parse(query) print("tokens = ", gentokens) print("tokens.command =", gentokens.command) print("tokens.columns =", gentokens.columns) print("tokens.tables =", gentokens.tables) print("tokens.join =", gentokens.join) print("tokens.where =", gentokens.where) if gentokens.command == "select": sel = select() print ( "select detected") sel.selection(gentokens.tables[0], [['phone', 'terce32441iro']])
def execQuery(self, query): from query.parser.sqlparse import parser pt = parser() gentokens = pt.parse(query) print("tokens = ", gentokens) print("tokens.command =", gentokens.command) print("tokens.columns =", gentokens.columns) print("tokens.tables =", gentokens.tables) print("tokens.join =", gentokens.join) print("tokens.where =", gentokens.where) print("tokens.values =", gentokens.insValues) if gentokens.command == "select": sel = select() print ( "select detected") conditions = [] if gentokens.where[0] == "where": print("where detected") for cond in gentokens.where: print ( cond) if isinstance(cond, list): print( "list detected in where") #working for equals only sel.selection(gentokens.tables[0], [gentokens.where[0][0]]) #sel.selection("students2", [['phone', 'terce32441iro']]) elif gentokens.command == "insert": ins = insert() iid = gentokens.insValues print(type(iid)) print(iid) print(len(iid)) print(iid) ins.insertRecord(gentokens.tables[0], iid)
def execQuery(self, query): from query.parser.sqlparse import parser pt = parser() gentokens = pt.parse(query) print("tokens = ", gentokens) print("tokens.command =", gentokens.command) print("tokens.columns =", gentokens.columns) print("tokens.tables =", gentokens.tables) print("tokens.join =", gentokens.join) print("tokens.where =", gentokens.where) print("tokens.values =", gentokens.insValues) if gentokens.command == "select": sel = select() print("select detected") conditions = [] if gentokens.where[0] == "where": print("where detected") for cond in gentokens.where: print(cond) if isinstance(cond, list): print("list detected in where") #working for equals only sel.selection(gentokens.tables[0], [gentokens.where[0][0]]) #sel.selection("students2", [['phone', 'terce32441iro']]) elif gentokens.command == "insert": ins = insert() iid = gentokens.insValues print(type(iid)) print(iid) print(len(iid)) print(iid) ins.insertRecord(gentokens.tables[0], iid)