コード例 #1
0
    def properties(self, gid, sid, did, scid, tid, cid=None):
        """
        This function is used to list all the primary key
        nodes within that collection.

        Args:
          gid: Server Group ID
          sid: Server ID
          did: Database ID
          scid: Schema ID
          tid: Table ID
          cid: Primary key constraint ID

        Returns:

        """
        status, res = idxcons_utils.get_index_constraints(
            self.conn, did, tid, self.constraint_type, cid)
        if not status:
            return res

        if len(res) == 0:
            return gone(
                _("""Could not find the {} in the table.""").format(
                    _("primary key") if self.constraint_type ==
                    "p" else _("unique key")))

        result = res
        if cid:
            result = res[0]
        result['is_sys_obj'] = (result['oid'] <= self.datlastsysoid)

        return ajax_response(response=result, status=200)
コード例 #2
0
ファイル: __init__.py プロジェクト: ilham76c/pgadmin4
    def properties(self, gid, sid, did, scid, tid, cid=None):
        """
        This function is used to list all the primary key
        nodes within that collection.

        Args:
          gid: Server Group ID
          sid: Server ID
          did: Database ID
          scid: Schema ID
          tid: Table ID
          cid: Primary key constraint ID

        Returns:

        """
        status, res = idxcons_utils.get_index_constraints(
            self.conn, did, tid, self.constraint_type, cid)
        if not status:
            return res

        if len(res) == 0:
            return gone(self.key_not_found_error_msg())

        result = res
        if cid:
            result = res[0]
        result['is_sys_obj'] = (result['oid'] <= self.datlastsysoid
                                or self.datistemplate)

        return ajax_response(response=result, status=200)