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("\"ROUND(" + 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("\"CURRENT_TIME\"", "STRING"), ClassOP_ARITMETICO.SUMA)) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla, arbol) code = [] t0 = c3d.getTemporal() if self.tipo.toString() != "enum": code.append( c3d.asignacionString(t0, self.nombre + ' ' + self.tipo.toString())) else: code.append( c3d.asignacionString(t0, self.nombre + ' ' + self.tipo.nombre)) if self.tipo.dimension != None: t1 = c3d.getTemporal() if not isinstance(self.tipo.dimension, list): code.append( c3d.operacion( t1, Identificador(t0), Valor('"(' + str(self.tipo.dimension) + ')"', "STRING"), OP_ARITMETICO.SUMA)) else: code.append( c3d.operacion( t1, Identificador(t0), Valor( '"(' + str(self.tipo.dimension[0]) + ',' + str(self.tipo.dimension[1]) + ')"', "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 if self.constraint != None: for const in self.constraint: t1 = c3d.getTemporal() code.append( c3d.operacion( t1, Identificador(t0), Valor('" ' + const.toString().replace("_", " ") + '"', "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 return code
def generar3D(self, tabla, arbol): super().generar3D(tabla, arbol) code = [] t0 = c3d.getTemporal() code.append(c3d.asignacionString(t0, "SHOW DATABASES")) t1 = c3d.getTemporal() if self.valor != None: code.append( c3d.operacion( t1, Identificador(t0), Valor("\" LIKE " + "\\'" + self.valor + "\\'\" ", "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.aumentarP()) return code
def generar3D(self, tabla, arbol): super().generar3D(tabla,arbol) code = [] t0 = c3d.getTemporal() if self.existe == "IF NOT EXISTS": code.append(c3d.asignacionString(t0, "CREATE DATABASE IF NOT EXISTS " + self.base)) else: code.append(c3d.asignacionString(t0, "CREATE DATABASE " + self.base)) t1 = c3d.getTemporal() if self.owner != None: code.append(c3d.operacion(t1, Identificador(t0), Valor("\" OWNER = " + "\\'" + self.owner + "\\'\" ", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() if self.mode != None: code.append(c3d.operacion(t1, Identificador(t0), Valor("\" MODE = " + str(self.mode) + "\"", "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.aumentarP()) 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( "\"ATAN2D(" + 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( "\"EXTRACT(" + self.tiempo + " FROM TIMESTAMP '" + self.caracter + "')\"", "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() 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, tabla, arbol): super().generar3D(tabla, arbol) code = [] code.append(c3d.asignacionH()) code.append(c3d.aumentarP()) t0 = c3d.getTemporal() code.append( c3d.asignacionString(t0, "CREATE TYPE " + self.valor + " AS ENUM (")) t1 = c3d.getTemporal() sizeCol = len(self.listaExpre) contador = 1 for enum in self.listaExpre: code.append( c3d.operacion( t1, ClassIdentificador(t0), ClassValor("\"" + enum.generar3D(tabla, arbol) + "\"", "STRING"), ClassOP_ARITMETICO.SUMA)) t0 = t1 t1 = t1 = c3d.getTemporal() if contador != sizeCol: code.append( c3d.operacion(t1, ClassIdentificador(t0), ClassValor("\", \"", "STRING"), ClassOP_ARITMETICO.SUMA)) t0 = t1 t1 = t1 = c3d.getTemporal() contador += 1 code.append( c3d.operacion(t1, ClassIdentificador(t0), ClassValor('");"', "STRING"), ClassOP_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 = [] code.append(c3d.asignacionH()) code.append(c3d.aumentarP()) 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 = [] 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 = [] code.append(c3d.asignacionH()) code.append(c3d.aumentarP()) t0 = c3d.getTemporal() code.append( c3d.asignacionString(t0, "ALTER TABLE " + self.tabla + "\\n")) t1 = c3d.getTemporal() code.append( c3d.operacion( t1, Identificador(t0), Valor("\"ADD CONSTRAINT " + self.id_constraint + "\\n\"", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() code.append( c3d.operacion(t1, Identificador(t0), Valor("\"FOREIGN KEY (\"", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() sizeCol = len(self.lista_id1) contador = 1 for id in self.lista_id1: code.append( c3d.operacion(t1, Identificador(t0), Valor("\"" + id + "\"", "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() contador += 1 code.append( c3d.operacion( t1, Identificador(t0), Valor("\")\\nREFERENCES " + self.tabla2 + "(\"", "STRING"), OP_ARITMETICO.SUMA)) t0 = t1 t1 = c3d.getTemporal() sizeCol = len(self.lista_id2) contador = 1 for id in self.lista_id2: code.append( c3d.operacion(t1, Identificador(t0), Valor("\"" + id + "\"", "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() contador += 1 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