def getTableDefinition(self, sFile, sNameOfTable): doc = self.getDatabaseDescription(sFile) self.out( doc.toxml() ) cyRootNode = self.getRootNode(doc) cyTableNode = self.getTable(cyRootNode[0], "table", sNameOfTable) table = cyr_table.cyr_table() table.setName(sNameOfTable) table.setSpecials(self.getTableSpecification(cyTableNode, "specials") ) self.out("searching Subtable") subtable = re.search(r'inherits.*\((.*?)\)', str(table.getSpecials()), re.IGNORECASE) if subtable: sNameOfSubtable = subtable.group(1) self.out('----------------------------------Subtable found-----------------------------------------------') self.out('Subtable -> ' + str(subtable)) self.out('Subtable -> ' + subtable.group(0)) self.out('Subtable -> ' + subtable.group(1)) subTable = self.loadTable(sNameOfSubtable) xColumns = subTable.getColumns() for i in xColumns: table.addColumn(i) table.nameOfColumns.append(i.getName()) iNr = self.getNumberOfFields(cyTableNode) self.out("Number of Columns %i " + `iNr` ) iCol = 0 while (iCol < iNr): xmlCol = self.getColumnAt(cyTableNode,iCol) column = cyr_column.cyr_column() column.setName(self.getColumnSpecification(xmlCol, "name") ) self.out("column-name = " + column.getName() ) table.nameOfColumns.append(column.getName()) column.setType(self.getColumnSpecification(xmlCol, "type") ) sSize = string.strip(self.getColumnSpecification(xmlCol, "size")) if sSize: column.setSizeOfDatafield(string.strip(self.getColumnSpecification(xmlCol, "size")) ) else: column.setSizeOfDatafield('18') column.setAllowNull(string.atoi(self.getColumnSpecification(xmlCol, "notnull")) ) column.setPrimaryKey(string.atoi(self.getColumnSpecification(xmlCol, "pkey")) ) column.setDefaultValue(self.getColumnSpecification(xmlCol, "default") ) table.addColumn(column) iCol += 1 return table
def __init__(self): self.table = cyr_table() self.xmlTableDef = 1 self.sNameOfTable = "EMPTY" self.withoutColumns = None self.openDB() self.oUser = self.loadObject('User') self.closeDB() #print '##############################################################' #print `self.oUser.getSqlDicUser()` #print '**************************************************************' self.rpc = xmlrpc.xmlrpc.myXmlRpc() self.listHeader = {} self.dicEntries = cuon.Windows.setOfEntries.setOfEntries() self.ID = 0 self.sWhere = '' self.liFields = [] self.sSort = '' self.store = None self.connectTreeId = 0 self.sCoding = 'utf-8' self.sDateFormat = "%d.%m.%Y" self.dicUser = self.oUser.getDicUser() self.sqlDicUser = self.oUser.getSqlDicUser() self.dicInternetUser = self.oUser.getInternetUser() self.path = None self.statusfields = [] self.sStatus = '' self.firstRecord = None self.p1 = re.compile('\(select .*\) as') self.iter = None self.liItems = None self.bDistinct = False self.xml = None self.win1 = None self.TreePos = 0 self.TREEFIRST=-100 self.TREELAST = -1000 self.loading = False