[Dbix-class] Enumerated type

Jess Robinson castaway at desert-island.demon.co.uk
Tue Nov 7 09:23:23 GMT 2006



On Tue, 7 Nov 2006, Carl Franks wrote:

> On 07/11/06, Daniel Westermann-Clark <dwc at pobox.com> wrote:
>>  On 2006-11-06 23:54:37 +0000, Josef Karthauser wrote:
>> >  Is it possible to extract a list of possible values for an
>> >  enumerated type using DBIx?  I think that this is possible in
>> >  Class::DBI, so I expect it's possible here too, but I can't find it
>> >  in the docs.
>>
>>  After a quick grepping of the source, it doesn't appear to have come
>>  up before.
>>
>>  MySQL supports enumerated types, but are there others?  I suspect such
>>  things are fairly database specific, and thus would need to be
>>  implemented in the appropriate Storage::DBI subclass.  Perhaps an
>>  enum_values('column_name') on ResultSource which checks for support on
>>  the storage?
>
> The file "lib/DBIx/Class/Storage/DBI/mysql.pm" in the branch
> "columns_info_for" demonstrates how to get a list of enum values.
> (search the file for 'enum')
>
> I had used the %column_info key 'data_set', but that's open to change,
> of course.
>


Very nice, but very incompatible with deploy(), I suggest you look at how 
SQL::Translator stores/reads them, and use that, so deploy will actually 
work.

(See my previous reply on enums)

Jess




More information about the Dbix-class mailing list