def buildColumns(self, tbl, pkg_name, tbl_name): """TODO :param tbl: the :ref:`table` object :param pkg_name: the name of the package. For more information, check the :ref:`packages` documentation page :param tbl_name: the name of the database :ref:`table`""" columns = list(self.dbroot.adapter.getColInfo(schema=pkg_name, table=tbl_name)) gnrlist.sortByItem(columns, 'position') for col_dict in columns: col_dict.pop('position') colname = col_dict.pop('name') length = col_dict.pop('length', 0) decimals = col_dict.pop('decimals', 0) dtype = col_dict['dtype'] if dtype == 'A': col_dict['size'] = '0:%s' % length elif dtype == 'C': col_dict['dtype'] = 'A' col_dict['size'] = length col = tbl.column(colname, **dict([(k, v) for k, v in col_dict.items() if not k.startswith('_')])) pkey = self.dbroot.adapter.getPkey(schema=pkg_name, table=tbl_name) if len(pkey) == 1: tbl.parentNode.setAttr(pkey=pkey[0]) elif len(pkey) > 1: pass #multiple pkey else: pass #there's no pkey pass
def buildColumns(self, tbl, pkg_name, tbl_name): """TODO :param tbl: the :ref:`table` object :param pkg_name: the name of the package. For more information, check the :ref:`packages` documentation page :param tbl_name: the name of the database :ref:`table`""" columns = list( self.dbroot.adapter.getColInfo(schema=pkg_name, table=tbl_name)) gnrlist.sortByItem(columns, 'position') for col_dict in columns: col_dict.pop('position') colname = col_dict.pop('name') length = col_dict.pop('length', 0) decimals = col_dict.pop('decimals', 0) dtype = col_dict['dtype'] if dtype == 'A': col_dict['size'] = '0:%s' % length elif dtype == 'C': col_dict['dtype'] = 'A' col_dict['size'] = length col = tbl.column( colname, **dict([(k, v) for k, v in col_dict.items() if not k.startswith('_')])) pkey = self.dbroot.adapter.getPkey(schema=pkg_name, table=tbl_name) if len(pkey) == 1: tbl.parentNode.setAttr(pkey=pkey[0]) elif len(pkey) > 1: pass #multiple pkey else: pass #there's no pkey pass
def buildColumns(self, tbl, pkg_name, tbl_name): """add??? :param tbl: add??? :param pkg_name: add??? :param tbl_name: add??? """ columns = list(self.dbroot.adapter.getColInfo(schema=pkg_name, table=tbl_name)) gnrlist.sortByItem(columns, 'position') for col_dict in columns: col_dict.pop('position') colname = col_dict.pop('name') length = col_dict.pop('length', 0) decimals = col_dict.pop('decimals', 0) dtype = col_dict['dtype'] if dtype == 'A': col_dict['size'] = '0:%s' % length elif dtype == 'C': col_dict['dtype'] = 'A' col_dict['size'] = length col = tbl.column(colname, **dict([(k, v) for k, v in col_dict.items() if not k.startswith('_')])) pkey = self.dbroot.adapter.getPkey(schema=pkg_name, table=tbl_name) if len(pkey) == 1: tbl.parentNode.setAttr(pkey=pkey[0]) elif len(pkey) > 1: pass #multiple pkey else: pass #there's no pkey pass
def buildColumns(self, tbl, pkg_name, tbl_name): """add??? :param tbl: add??? :param pkg_name: add??? :param tbl_name: add??? """ columns = list( self.dbroot.adapter.getColInfo(schema=pkg_name, table=tbl_name)) gnrlist.sortByItem(columns, 'position') for col_dict in columns: col_dict.pop('position') colname = col_dict.pop('name') length = col_dict.pop('length', 0) decimals = col_dict.pop('decimals', 0) dtype = col_dict['dtype'] if dtype == 'A': col_dict['size'] = '0:%s' % length elif dtype == 'C': col_dict['dtype'] = 'A' col_dict['size'] = length col = tbl.column( colname, **dict([(k, v) for k, v in col_dict.items() if not k.startswith('_')])) pkey = self.dbroot.adapter.getPkey(schema=pkg_name, table=tbl_name) if len(pkey) == 1: tbl.parentNode.setAttr(pkey=pkey[0]) elif len(pkey) > 1: pass #multiple pkey else: pass #there's no pkey pass
def getMessages(self, page_id=None, connection_id=None, user=None): messages = [] if page_id: messages.extend(self.getPageMessages(page_id)) if connection_id: messages.extend(self.getConnectionMessages(connection_id)) if user: messages.extend(self.getUserMessages(user)) return sortByItem(messages, 'msg_ts')