def generar3D(self, tabla, arbol): super().generar3D(tabla, arbol) code = [] t0 = c3d.getTemporal() code.append(c3d.asignacionString(t0, "SELECT ")) sizeCol = len(self.lista) contador = 1 for el in self.lista: code += el.generar3D(tabla, arbol) if contador != sizeCol: t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append( c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\", \"", "STRING"), ClassOP_ARITMETICO.SUMA)) contador += 1 t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append( c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\";\"", "STRING"), ClassOP_ARITMETICO.SUMA)) code.append(c3d.asignacionTemporalStack(t1)) code.append(c3d.aumentarP()) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla, arbol) code = [] code.append(c3d.asignacionH()) code.append(c3d.aumentarP()) t0 = c3d.getTemporal() code.append( c3d.asignacionString(t0, "CREATE TABLE " + self.tabla + " (\\n")) sizeCol = len(self.campos) contador = 1 for col in self.campos: if isinstance(col, Campo): sizeCol -= 1 elif not isinstance(col, Campo): lista = col.generar3D(tabla, arbol) code += lista tLast = c3d.getLastTemporal() if contador != sizeCol: t3 = c3d.getTemporal() code.append( c3d.operacion(t3, Identificador(tLast), Valor('",\\n"', "STRING"), OP_ARITMETICO.SUMA)) contador += 1 tLast = t3 t2 = c3d.getTemporal() code.append( c3d.operacion(t2, Identificador(t0), Identificador(tLast), OP_ARITMETICO.SUMA)) t0 = t2 for col in self.copy_campos: t1 = c3d.getTemporal() code.append( c3d.operacion(t1, Identificador(t0), Valor('",\\n"', "STRING"), OP_ARITMETICO.SUMA)) lista = col.generar3D() code += lista t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() if self.herencia != None: code.append( c3d.operacion( t1, Identificador(t0), Valor('"\\n) INHERITS (' + self.herencia + '"', "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() code.append( c3d.operacion(t1, Identificador(t0), Valor('");"', "STRING"), OP_ARITMETICO.SUMA)) code.append(c3d.asignacionTemporalStack(t1)) code.append(c3d.LlamFuncion('call_funcion_intermedia')) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append(c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\"WIDTH_BUCKET(" + str(self.valor.generar3D(tabla, arbol)) + "," + str(self.min.generar3D(tabla, arbol)) + "," + str(self.max.generar3D(tabla, arbol)) + "," + str(self.count.generar3D(tabla, arbol)) + ")\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append(c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\"ATAN2(" + str(self.opIzq.generar3D(tabla, arbol)) + "," + str(self.opDer.generar3D(tabla, arbol)) + ")\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append(c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\"DATE_PART('" + self.identificador + "', INTERVAL '" + self.valor + "')\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append(c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\"CURRENT_DATE\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] code.append(c3d.asignacionH()) code.append(c3d.aumentarP()) t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append(c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\"CBRT(" + str(self.valor.generar3D(tabla, arbol)) + ")\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla, arbol) code = [] t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append( c3d.operacion( t1, ClassIdentificador(t0), ClassValor( "\"EXTRACT(" + self.tiempo + " FROM TIMESTAMP '" + self.caracter + "')\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() if self.lcol == "*": code.append(c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\"*\"", "STRING"), ClassOP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() if self.lcol2 != None: code.append(c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\" FROM " + self.lcol2[0].id + "\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self): code = [] code.append(c3d.asignacionH()) code.append(c3d.aumentarP()) t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() if self.id != None: code.append( c3d.operacion( t1, ClassIdentificador(t0), ClassValor("\"" + str(self.id) + " \"", "STRING"), ClassOP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() code.append( c3d.operacion( t1, ClassIdentificador(t0), ClassValor("\"" + self.toString().replace('_', ' ') + "(\"", "STRING"), ClassOP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() for cont in range(len(self.expresion)): code.append( c3d.operacion( t1, ClassIdentificador(t0), ClassValor('"' + self.expresion[cont] + '"', "STRING"), ClassOP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() if cont + 1 != len(self.expresion): code.append( c3d.operacion(t1, ClassIdentificador(t0), ClassValor('","', "STRING"), ClassOP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() code.append( c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\")\\n\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] code.append(c3d.asignacionH()) code.append(c3d.aumentarP()) t0 = c3d.getTemporal() code.append(c3d.asignacionString(t0, "UPDATE " + self.identificador.generar3D(tabla, arbol) + " SET ")) for col in self.listaDeColumnas: '''code.append(c3d.operacion(t1, Identificador(t0), Valor(" \" ADD COLUMN " + col.id + " " + col.tipo.toString() + "\" ", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal()''' code += col.generar3D(tabla, arbol) t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() code.append(c3d.operacion(t1, Identificador(t0), Valor("\";\"", "STRING"), OP_ARITMETICO.SUMA)) code.append(c3d.asignacionTemporalStack(t1)) code.append(c3d.LlamFuncion('call_funcion_intermedia')) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla, arbol) code = [] t0 = c3d.getTemporal() code.append(c3d.asignacionString(t0, "INSERT INTO " + self.valor)) t1 = c3d.getTemporal() if self.lcol != None: code.append( c3d.operacion(t1, Identificador(t0), Valor(" \" (\" ", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() sizeCol = len(self.lcol) contador = 1 for col in self.lcol: code.append( c3d.operacion(t1, Identificador(t0), Valor("\"" + col + "\"", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() if contador != sizeCol: code.append( c3d.operacion(t1, Identificador(t0), Valor("\", \"", "STRING"), OP_ARITMETICO.SUMA)) else: code.append( c3d.operacion(t1, Identificador(t0), Valor("\")\"", "STRING"), OP_ARITMETICO.SUMA)) contador += 1 t0 = t1 t1 = c3d.getTemporal() code.append( c3d.operacion(t1, Identificador(t0), Valor(" \" VALUES (\" ", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 sizeCol = len(self.lexpre) contador = 1 for col in self.lexpre: result = col.generar3D(tabla, arbol) if not isinstance(result, list): t1 = c3d.getTemporal() code.append( c3d.operacion(t1, Identificador(t0), Valor("\"" + str(result) + "\"", "STRING"), OP_ARITMETICO.SUMA)) '''if col != None: code.append(c3d.operacion(t1, Identificador(t0), Valor("\"" + str(col.generar3D(tabla, arbol)) + "\"", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() if contador != sizeCol: code.append(c3d.operacion(t1, Identificador(t0), Valor("\", \"", "STRING"), OP_ARITMETICO.SUMA))''' t0 = t1 t1 = c3d.getTemporal() else: code += result t0 = c3d.getLastTemporal() t1 = c3d.getTemporal() if contador != sizeCol: code.append( c3d.operacion(t1, Identificador(t0), Valor("\", \"", "STRING"), OP_ARITMETICO.SUMA)) else: code.append( c3d.operacion(t1, Identificador(t0), Valor("\");\"", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 contador += 1 code.append(c3d.asignacionTemporalStack(t0)) code.append(c3d.aumentarP()) return code