Switch to: V11V10V9V8V7V6V5

Valentina Example: Enums

The “valentina_enums” sample database was developed to demonstrate the usage enum types in Valentia:

Structure of the table

This database contains one table with short description of the cars. The table contains four fields:

  • fldManufacturer – describes the name of manufacturer;
  • fldModel – decribes the name of car's model;
  • fldYear – describes the year of manufacture;
  • fldColor – describes the color of the car.

For setting the car's color is using the enum type Color, that contains some colors. This type has three localization:

  • en – for representation of colors on English (native for database).
  • de – for representation of colors on German.
  • ru – for representation of colors on Russian.

The query for creating this type:

CREATE OR REPLACE TYPE Colors AS ENUM8  
        ( 'Black'  , 'Blue' , 'Brown'     , 'Gold'   , 'Gray' , 'Green'  , 'Magenta'  , 'Pink'   , 'Purple'    , 'Red'    , 'Silver'     , 'White', 'Yellow' ),
'de':	( 'Schwarz', 'Blau' , 'Braun'     , 'Gold'   , 'Grau' , 'Grün'   , 'Magenta'  , 'Pink'   , 'Lila'      , 'Rot'    , 'Silber'     , 'Weiss', 'Gelb'   ),
'ru':	( 'Черный' , 'Синий', 'Коричневый', 'Золотой', 'Серый', 'Зеленый', 'Пурпурный', 'Розовый', 'Фиолетовый', 'Красный', 'Серебристый', 'Белый', 'Желтый' )