Example #1
0
    def _fetch_properties(self, tid, trid):

        SQL = render_template("/".join(
            [self.template_path, self._PROPERTIES_SQL]),
                              tid=tid,
                              trid=trid,
                              datlastsysoid=self.datlastsysoid)

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

        if not status:
            return status, res

        if len(res['rows']) == 0:
            return True, res

        # Making copy of output for future use
        data = dict(res['rows'][0])
        if len(data['tgattr']) >= 1:
            columns = ', '.join(data['tgattr'].split(' '))
            data['columns'] = compound_trigger_utils.get_column_details(
                self.conn, tid, columns)

        data = trigger_definition(data)

        return True, data
Example #2
0
    def _fetch_properties(self, tid, trid):

        SQL = render_template("/".join([self.template_path,
                                        'properties.sql']),
                              tid=tid, trid=trid,
                              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 compound trigger in the table."""))

        # Making copy of output for future use
        data = dict(res['rows'][0])
        if len(data['tgattr']) >= 1:
            columns = ', '.join(data['tgattr'].split(' '))
            data['columns'] = compound_trigger_utils.get_column_details(
                self.conn, tid, columns)

        data = trigger_definition(data)

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

        Args:
            gid: Server Group ID
            sid: Server ID
            did:  Database ID
            scid: Schema ID
            scid: Schema ID
            tid: Table ID
            trid: Trigger ID

        Returns:
            JSON of selected compound trigger node
        """

        SQL = render_template("/".join([self.template_path,
                                        'properties.sql']),
                              tid=tid, trid=trid,
                              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 compound trigger in the table."""))

        # Making copy of output for future use
        data = dict(res['rows'][0])
        if len(data['tgattr']) >= 1:
            columns = ', '.join(data['tgattr'].split(' '))
            data['columns'] = compound_trigger_utils.get_column_details(
                self.conn, tid, columns)

        data = trigger_definition(data)

        return ajax_response(
            response=data,
            status=200
        )