예제 #1
0
 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
예제 #2
0
    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
예제 #3
0
 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
예제 #4
0
    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
예제 #5
0
 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')
예제 #6
0
파일: gnrmsg.py 프로젝트: poppogbr/genropy
 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')