Example #1
0
    def _fetch_properties(self, did, tid, idx):
        """
        This function is used to fetch the properties of specified object.
        :param did:
        :param tid:
        :param idx:
        :return:
        """
        SQL = render_template("/".join([self.template_path, 'properties.sql']),
                              did=did,
                              tid=tid,
                              idx=idx,
                              datlastsysoid=self.datlastsysoid)

        status, res = self.conn.execute_dict(SQL)
        if not status:
            return False, internal_server_error(errormsg=res)

        if len(res['rows']) == 0:
            return False, gone(
                gettext("""Could not find the index in the table."""))

        # Making copy of output for future use
        data = dict(res['rows'][0])

        # Add column details for current index
        data = index_utils.get_column_details(self.conn, idx, data)

        # Add Include details of the index
        if self.manager.version >= 110000:
            data = index_utils.get_include_details(self.conn, idx, data)

        return True, data
Example #2
0
    def properties(self, gid, sid, did, scid, tid, idx):
        """
        This function will show the properties of the selected schema node.

        Args:
            gid: Server Group ID
            sid: Server ID
            did:  Database ID
            scid: Schema ID
            scid: Schema ID
            tid: Table ID
            idx: Index ID

        Returns:
            JSON of selected schema node
        """

        SQL = render_template("/".join([self.template_path, 'properties.sql']),
                              did=did,
                              tid=tid,
                              idx=idx,
                              datlastsysoid=self.datlastsysoid)

        status, res = self.conn.execute_dict(SQL)

        if not status:
            return internal_server_error(errormsg=res)

        if len(res['rows']) == 0:
            return gone(gettext("""Could not find the index in the table."""))

        # Making copy of output for future use
        data = dict(res['rows'][0])

        # Add column details for current index
        data = index_utils.get_column_details(self.conn, idx, data)

        # Add Include details of the index
        if self.manager.version >= 110000:
            data = index_utils.get_include_details(self.conn, idx, data)

        return ajax_response(response=data, status=200)