Example #1
0
class ddl_manager:	
	
	def __init__(self,syscat,sdman):
		self.logs=[];
		self.sdman = sdman
		self.syscat = syscat
		self.theddl = DDL(self.syscat, self.sdman)
		
	def set_database(self,schemaname):
		return self.theddl.setDataBase(schemaname[0]);

	def drop_table(self,tablename):
		return self.theddl.dropTable(tablename[0]);
		
	def create_table(self,parametros):
		parametros
		print parametros[0];
		contador=0;
		
		table_name=parametros[0];
		columns_names=[]
		column_type=[]
		column_nullability=[]
		PK=parametros[1][3];
		
		while contador<len(parametros[1][0]):
			columns_names.append(parametros[1][0][contador])
			column_type.append(parametros[1][1][contador])
			column_nullability.append(parametros[1][2][contador])
			contador=contador+1
		
		#print table_name
		#print columns_names
		#print column_type
		#print column_nullability
		#print PK
		
		
		return self.theddl.createTable(table_name, columns_names, column_type, column_nullability, PK[0]);
			
	def alter_table(self,parametros):
		print "se altera una tabla";
		
	def create_index(self,parametros):
		#print "Se crea un indice";
		#print "nombre del indice: " + parametros[0];
		#print "nombre de la tabla: " + parametros[1];
		#print "columna: " + parametros[2];
		return self.theddl.createIndex(parametros[0],parametros[1],parametros[2]);
Example #2
0
	def __init__(self,syscat,sdman):
		self.logs=[];
		self.sdman = sdman
		self.syscat = syscat
		self.theddl = DDL(self.syscat, self.sdman)
Example #3
0
 def __init__(self, DC, SD):
     self.dato = DDL(DC, SD)
Example #4
0
class DDLTestClass(object):
        
    def __init__(self, DC, SD):
        self.dato = DDL(DC, SD)
        
    def test0(self):
        print self.dato.setDataBase('second')
        
    def test1(self):
        names = ['julia','maria','demonios']
        types = ['int', 'double', 'char']
        isNull = ['not null', 'null', 'null']    
        
        names1 = ['julia','maria','demonios']
        types1 = ['int', 'double', 'char']
        isNull1 = ['not null', 'null', 'null']
        
        self.dato.createTable('mugre', names, types, isNull , 'julia')
        self.dato.createTable('moo', names1, types1, isNull1 , 'julia')
        
    def test2(self):
        self.dato.setDataBase('third')
        self.dato.dropTable('moo')
        self.dato.setDataBase(0)
        
    def test3(self):
        print self.dato.alterTable('mugre', 'demonios', 'moo', 'demonios')
        self.dato.createIndex('ByColumn', 'moo', 'maria')