I'm attempting to write an (editor) extension for Oracle SQL Developer. I'm having trouble finding information about it, but I've pieced the following together from the few tutorials and blog entries that I've found:

<?xml version="1.0" encoding="UTF-8"?>
<displays>
    <display enable="true" objectType="SEQUENCE" style="null" type="editor">
        <name><![CDATA[Details]]></name>
        <query>
            <sql>
                <![CDATA[
SELECT 'sequence_name' AS "NAME", sequence_name AS "VALUE" FROM :NAME
UNION
SELECT 'last_value' AS "NAME", CAST(last_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'start_value' AS "NAME", CAST(start_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'increment_by' AS "NAME", CAST(increment_by AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'max_value' AS "NAME", CAST(max_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'min_value' AS "NAME", CAST(min_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'cache_value' AS "NAME", CAST(cache_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'log_cnt' AS "NAME", CAST(log_cnt AS text) "VALUE" FROM :NAME
UNION
SELECT 'is_cycled' AS "NAME", CAST(is_cycled AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'is_called' AS "NAME", CAST(is_called AS text) AS "VALUE" FROM :NAME
                ]]>
            </sql>
        </query>
        <CustomValues>
            <TYPE>vertical</TYPE>
        </CustomValues>
    </display>
</displays>

This works, in that extra tabs do show up for sequences on Oracle db connections. However, they do not show up for Postgres db connections. For sequences to even show in pg databases in SQL Dev, I have to use a second extension script:

<?xml version="1.0" encoding="windows-1252" ?>
<navigator RESOURCE_FILE="oracle.dbtools.raptor.navigator.OracleNavigatorResource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="navigator.xsd">
    <objectType connType="PostgreSQL" id="SEQUENCE" includesSyns="true" weight="100.0">
        <folder>
            <icon RSKEY="SEQUENCE_FOLDER_ICON"/>
            <label RSKEY="Sequences"/>
            <queries>
                <query minversion="8">
                    <sql constrained="true"><![CDATA[SELECT relname, nspname FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relkind = 'S' AND nspname = :SCHEMA]]></sql>
                </query>
                <columns>
                    <column filterable="true" id="SEQUENCENAME" sortable="true">
                        <colName><![CDATA[relname]]></colName>
                    </column>
                    <column filterable="true" id="NAME" sortable="true">
                        <colName><![CDATA[relname]]></colName>
                    </column>
                </columns>
            </queries>
        </folder>
        <node>
            <icon RSKEY="OracleIcons.SEQUENCE"/>
        </node>
    </objectType>
</navigator>

Is there a way to specify that this extension only applies to Postgres sequences, and not to Oracle sequences?

有帮助吗?

解决方案

The correct answer here seems to be to have a connType="PostgreSQL" attribute in the display element. This limits it to only Postgres sequences. This was trial and error, I can't find editor.xsd and it seems like Oracle doesn't make it available.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top