def dot(self): new = Nodo.Nodo("DROP") t = Nodo.Nodo(self.structure) n = Nodo.Nodo(self.name) new.addNode(t) new.addNode(n) return new
def dot(self): new = Nodo.Nodo("CREATE_INDEX") if self.unique: uniqueNode = Nodo.Nodo("UNIQUE") new.addNode(uniqueNode) if self.usingMethod: uhNode = Nodo.Nodo("USING_HASH") new.addNode(uhNode) id1 = Nodo.Nodo(str(self.idIndex)) id2 = Nodo.Nodo(str(self.idTable)) new.addNode(id1) new.addNode(id2) listNode = Nodo.Nodo("INDEX_LIST") new.addNode(listNode) for l in self.optList: if l[0] != None: l1 = Nodo.Nodo(str(l[0])) listNode.addNode(l1) if l[1] != None: l2 = Nodo.Nodo(str(l[1])) listNode.addNode(l2) if l[2]: l3 = Nodo.Nodo("NULLS") listNode.addNode(l3) if l[2][1] != None: l4 = Nodo.Nodo(str(l[2][1])) listNode.addNode(l4) if self.whereCl != None: new.addNode(self.whereCl.dot()) return new
def dot(self): new = Nodo.Nodo("SHOW_DATABASES") if self.like != None: l = Nodo.Nodo("LIKE") ls = Nodo.Nodo(self.like) new.addNode(l) l.addNode(ls) return new
def dot(self): f = Nodo.Nodo(self.function) p = Nodo.Nodo("PARAMS") new = Nodo.Nodo("CALL") new.addNode(f) new.addNode(p) for par in self.params: p.addNode(par.dot()) return new
def dot(self): new = Nodo.Nodo("UPDATE") new.addNode(self.fromcl.dot()) assigNode = Nodo.Nodo("SET") new.addNode(assigNode) for v in self.values: assigNode.addNode(v.dot()) if self.wherecl: new.addNode(self.wherecl.dot()) return new
def dot(self): new = Nodo.Nodo("LIMIT") numN = Nodo.Nodo(str(self.num)) new.addNode(numN) if self.offset != None: off = Nodo.Nodo("OFFSET") new.addNode(off) offId = Nodo.Nodo(str(self.offset)) off.addNode(offId) return new
def dot(self): f = Nodo.Nodo("EXTRACT") p = Nodo.Nodo("PARAMS") new = Nodo.Nodo("CALL") new.addNode(f) new.addNode(p) nstr = Nodo.Nodo(str(self.colData.temp)) nopt = Nodo.Nodo(str(self.opt)) p.addNode(nopt) p.addNode(nstr) return new
def dot(self): new = Nodo.Nodo("ALTER_DATABASE") iddb = Nodo.Nodo(self.name) new.addNode(iddb) optionNode = Nodo.Nodo(self.option) new.addNode(optionNode) valOption = Nodo.Nodo(self.newname) optionNode.addNode(valOption) return new
def dot(self): new = Nodo.Nodo("SELECT") paramNode = Nodo.Nodo("PARAMS") new.addNode(paramNode) if len(self.params) == 0: asterisco = Nodo.Nodo("*") paramNode.addNode(asterisco) else: for p in self.params: paramNode.addNode(p.dot()) return new
def dot(self): new = Nodo.Nodo("CREATE_TYPE") if self.exists: exNode = Nodo.Nodo("IF_NOT_EXISTS") new.addNode(exNode) idNode = Nodo.Nodo(self.name) new.addNode(idNode) paramsNode = Nodo.Nodo("PARAMS") new.addNode(paramsNode) for v in self.values: paramsNode.addNode(v.dot()) return new
def dot(self): f = Nodo.Nodo(self.func) p = Nodo.Nodo("PARAMS") new = Nodo.Nodo("CALL") new.addNode(f) new.addNode(p) if self.colData != "*": p.addNode(self.colData.dot()) else: p.addNode(Nodo.Nodo("*")) return new
def dot(self): new = Nodo.Nodo("FROM") for t in self.tables: if isinstance(t, Select): n = t.dot() new.addNode(n) else: t1 = Nodo.Nodo(t.name) new.addNode(t1) for a in self.aliases: a1 = Nodo.Nodo(a) new.addNode(a1) return new
def dot(self): n1 = self.optNot + " IN" new = Nodo.Nodo(n1) new.addNode(self.colData.dot()) new.addNode(self.subquery.dot()) return new
def dot(self): n1 = self.exp1.dot() n2 = self.exp2.dot() new = Nodo.Nodo(self.operator) new.addNode(n1) new.addNode(n2) return new
def dot(self): new = Nodo.Nodo("INSERT_INTO") t = Nodo.Nodo(self.tabla) par = Nodo.Nodo("PARAMS") new.addNode(t) for p in self.parametros: par.addNode(p.dot()) if self.columns != None: colNode = Nodo.Nodo("COLUMNS") for c in self.columns: colNode.addNode(Nodo.Nodo(str(c))) new.addNode(colNode) new.addNode(par) return new
def dot(self): new = Nodo.Nodo("SELECT") paramNode = Nodo.Nodo("PARAMS") new.addNode(paramNode) if self.distinct: dis = Nodo.Nodo("DISTINCT") new.addNode(dis) if len(self.params) == 0: asterisco = Nodo.Nodo("*") paramNode.addNode(asterisco) else: for p in self.params: paramNode.addNode(p.dot()) new.addNode(self.fromcl.dot()) if self.wherecl != None: new.addNode(self.wherecl.dot()) if self.groupbyCl != None: gb = Nodo.Nodo("GROUP_BY") new.addNode(gb) for g in self.groupbyCl: gb.addNode(g.dot()) if self.havingCl != None: hv = Nodo.Nodo("HAVING") new.addNode(hv) hv.addNode(self.havingCl.dot()) if self.limitCl != None: new.addNode(self.limitCl.dot()) if self.orderByCl != None: new.addNode(self.orderByCl.dot()) return new
def dot(self): f = Nodo.Nodo("date_part") p = Nodo.Nodo("PARAMS") new = Nodo.Nodo("CALL") new.addNode(f) new.addNode(p) ntype = Nodo.Nodo(str(self.type)) nstr = Nodo.Nodo(str(self.str)) nopt = Nodo.Nodo(str(self.opt)) p.addNode(nopt) p.addNode(ntype) p.addNode(nstr) return new
def dot(self): new = Nodo.Nodo("CREATE_DATABASE") if self.exists: ex = Nodo.Nodo("EXISTS") new.addNode(ex) n = Nodo.Nodo(self.name) new.addNode(n) if self.owner != None: ow = Nodo.Nodo("OWNER") own = Nodo.Nodo(self.owner) ow.addNode(own) new.addNode(ow) if self.mode != None: mod = Nodo.Nodo("MODE") mod2 = Nodo.Nodo(str(self.mode)) mod.addNode(mod2) new.addNode(mod) return new
def dot(self): new = Nodo.Nodo("WHERE") new.addNode(self.series.dot()) return new
def dot(self): n1 = self.exp.dot() new = Nodo.Nodo(self.operator) new.addNode(n1) return new
def dot(self): new = Nodo.Nodo("DELETE") new.addNode(self.fromcl.dot()) if self.wherecl: new.addNode(self.wherecl.dot()) return new
def dot(self): new = Nodo.Nodo("=") idNode = Nodo.Nodo(str(self.id)) new.addNode(idNode) new.addNode(self.value.dot()) return new
def dot(self): new = Nodo.Nodo("USE_DATABASE") n = Nodo.Nodo(self.db) new.addNode(n) return new
def dot(self): new = Nodo.Nodo("EXISTS") new.addNode(self.subquery.dot()) return new
def dot(self): new = Nodo.Nodo("ALTER_TABLE") idNode = Nodo.Nodo(str(self.table)) new.addNode(idNode) for p in self.params: operacion = Nodo.Nodo(p[0]) new.addNode(operacion) if p[0] == "ADD": if not p[1][0]: col = Nodo.Nodo(p[1][1]) operacion.addNode(col) typ = Nodo.Nodo(str(p[1][2][0])) operacion.addNode(typ) if p[1][2][1][0] != None: parNode = Nodo.Nodo("PARAMS") typ.addNode(parNode) for p2 in p[1][2][1]: lit = Nodo.Nodo(str(p2)) parNode.addNode(lit) else: if p[1][1][0] == "PRIMARY": primNode = Nodo.Nodo("PRIMARY_KEY") operacion.addNode(primNode) idlist = p[1][1][1] for il in idlist: nl = Nodo.Nodo(str(il)) primNode.addNode(nl) elif p[1][1][0] == "FOREIGN": forNode = Nodo.Nodo("FOREIGN_KEY") operacion.addNode(forNode) idlist = p[1][1][1] for il in idlist: nl = Nodo.Nodo(str(il)) forNode.addNode(nl) refNode = Nodo.Nodo("REFERENCES") forNode.addNode(refNode) idNode = Nodo.Nodo(str(p[1][1][2])) refNode.addNode(idNode) idlist2 = p[1][1][3] for il2 in idlist2: nl2 = Nodo.Nodo(str(il2)) refNode.addNode(nl2) elif p[1][1][0] == "UNIQUE": uniqueNode = Nodo.Nodo("UNIQUE") operacion.addNode(uniqueNode) if p[1][1][2] != None: const = Nodo.Nodo("CONSTRAINT") uniqueNode.addNode(const) idcont = Nodo.Nodo(str(p[1][1][2])) const.addNode(idcont) id2const = Nodo.Nodo(str(p[1][1][1][0])) uniqueNode.addNode(id2const) elif p[0] == "DROP": subOper = Nodo.Nodo(str(p[1][0])) idDrop = Nodo.Nodo(str(p[1][1])) operacion.addNode(subOper) operacion.addNode(idDrop) elif p[0] == "RENAME": rename1 = Nodo.Nodo(str(p[1][0])) rename2 = Nodo.Nodo(str(p[1][1])) operacion.addNode(rename1) operacion.addNode(rename2) elif p[0] == "ALTER": idAlter = Nodo.Nodo(str(p[1][1])) operacion.addNode(idAlter) if p[1][0] == "SET": setNode = Nodo.Nodo("SET") operacion.addNode(setNode) if p[1][2][0] == "DEFAULT": defNode = Nodo.Nodo("DEFAULT") defNode.addNode(p[1][2][1].dot()) setNode.addNode(defNode) elif p[1][2][1]: notnullN = Nodo.Nodo("NOT_NULL") setNode.addNode(notnullN) elif not p[1][2][1]: nullN = Nodo.Nodo("NULL") setNode.addNode(nullN) elif p[1][0] == "TYPE": typeNode = Nodo.Nodo("TYPE") typ2 = Nodo.Nodo(str(p[1][2][0])) typeNode.addNode(typ2) operacion.addNode(typeNode) if p[1][2][1][0] != None: parNode2 = Nodo.Nodo("PARAMS") typ2.addNode(parNode2) for p3 in p[1][2][1]: lit2 = Nodo.Nodo(str(p3)) parNode2.addNode(lit2) return new
def dot(self): new = Nodo.Nodo("TRUNCATE") n = Nodo.Nodo(self.name) new.addNode(n) return new
def dot(self): new = Nodo.Nodo("CREATE_TABLE") if self.exists: ex = Nodo.Nodo("EXISTS") new.addNode(ex) n = Nodo.Nodo(self.name) new.addNode(n) c = Nodo.Nodo("COLUMNS") new.addNode(c) for cl in self.columns: if not cl[0]: id = Nodo.Nodo(cl[1]) c.addNode(id) typ = Nodo.Nodo("TYPE") c.addNode(typ) typ1 = Nodo.Nodo(cl[2][0]) typ.addNode(typ1) par = cl[2][1] if par[0] != None: params = Nodo.Nodo("PARAMS") typ.addNode(params) for parl in par: parl1 = Nodo.Nodo(str(parl)) params.addNode(parl1) colOpts = cl[3] if colOpts != None: coNode = Nodo.Nodo("OPTIONS") c.addNode(coNode) for co in colOpts: if co[0] == "NULL": if co[1]: notNullNode = Nodo.Nodo("NOT_NULL") else: notNullNode = Nodo.Nodo("NULL") coNode.addNode(notNullNode) elif co[0] == "DEFAULT": defaultNode = Nodo.Nodo("DEFAULT") coNode.addNode(defaultNode) litDefaultNode = Nodo.Nodo(str(co[1])) defaultNode.addNode(litDefaultNode) elif co[0] == "PRIMARY": primaryNode = Nodo.Nodo("PRIMARY_KEY") coNode.addNode(primaryNode) elif co[0] == "REFERENCES": referencesNode = Nodo.Nodo("REFERENCES") coNode.addNode(referencesNode) idReferences = Nodo.Nodo(str(co[1])) referencesNode.addNode(idReferences) else: constNode = Nodo.Nodo("CONSTRAINT") coNode.addNode(constNode) else: if cl[1][0] == "UNIQUE": uniqueNode = Nodo.Nodo("UNIQUE") c.addNode(uniqueNode) idlist = cl[1][1] for il in idlist: nl = Nodo.Nodo(str(il)) uniqueNode.addNode(nl) if cl[1][0] == "PRIMARY": primNode = Nodo.Nodo("PRIMARY_KEY") c.addNode(primNode) idlist = cl[1][1] for il in idlist: nl = Nodo.Nodo(str(il)) primNode.addNode(nl) if cl[1][0] == "FOREIGN": forNode = Nodo.Nodo("FOREIGN_KEY") c.addNode(forNode) idlist = cl[1][1] for il in idlist: nl = Nodo.Nodo(str(il)) forNode.addNode(nl) refNode = Nodo.Nodo("REFERENCES") forNode.addNode(refNode) idNode = Nodo.Nodo(str(cl[1][2])) refNode.addNode(idNode) idlist2 = cl[1][3] for il2 in idlist2: nl2 = Nodo.Nodo(str(il2)) refNode.addNode(nl2) if self.inherits != None: inhNode = Nodo.Nodo("INHERITS") new.addNode(inhNode) inhNode2 = Nodo.Nodo(str(self.inherits)) inhNode.addNode(inhNode2) return new
def dot(self): new = Nodo.Nodo("CHECK") new.addNode(Nodo.Nodo(str(self.value))) return new
def dot(self): new = Nodo.Nodo("order_by") return new
def dot(self): new = Nodo.Nodo(str(self.table)) punto = Nodo.Nodo(".*") new.addNode(punto) return new