Class Enumeration


  • @SQLAction(provides="mood type",implementor="postgresql_ge_80300",install="CREATE TYPE mood AS ENUM (\'sad\', \'ok\', \'happy\')",remove="DROP TYPE mood") @SQLAction(implementor="postgresql_ge_80300",requires={"textToMood","moodToText","textsToMoods","moodsToTexts"},install={"SELECT textToMood(\'happy\')","SELECT moodToText(\'happy\'::mood)","SELECT textsToMoods(array[\'happy\',\'happy\',\'sad\',\'ok\'])","SELECT moodsToTexts(array[\'happy\',\'happy\',\'sad\',\'ok\']::mood[])"})
    public class Enumeration
    extends Object
    Confirms the mapping of PG enum and Java String, and arrays of each, as parameter and return types.

    This example relies on implementor tags reflecting the PostgreSQL version, set up in the ConditionalDDR example. PostgreSQL before 8.3 did not have enum types.

    • Method Detail

      • textToMood

        @Function(requires="mood type",
                  provides="textToMood",
                  type="mood",
                  implementor="postgresql_ge_80300")
        public static String textToMood​(String s)
      • moodToText

        @Function(requires="mood type",
                  provides="moodToText",
                  implementor="postgresql_ge_80300")
        public static String moodToText​(@SQLType("mood")
                                        String s)
      • textsToMoods

        @Function(requires="mood type",
                  provides="textsToMoods",
                  type="mood",
                  implementor="postgresql_ge_80300")
        public static Iterator<StringtextsToMoods​(String[] ss)
      • moodsToTexts

        @Function(requires="mood type",
                  provides="moodsToTexts",
                  implementor="postgresql_ge_80300")
        public static Iterator<StringmoodsToTexts​(@SQLType("mood[]")
                                                    String[] ss)