[html-formfu] Re: constraints_from_dbic

Moritz Onken onken at houseofdesign.de
Fri Mar 13 10:16:44 GMT 2009


Am 13.03.2009 um 11:09 schrieb Carl Franks:

> 2009/3/13 Ian Wells <ijw at cack.org.uk>:
>> 2009/3/10 Ian Wells <ijw at cack.org.uk>:
>>> I thought the HTML::FormFu::ObjectUtil::constraints_from_dbic method
>>> might be a good idea to reduce the number of times I have to state  
>>> the
>>> length of character fields (an old favourite for inconsistencies).
>>> But it appears to be suffering from bitrot - specifically,
>>>
>>>    if ( $type =~ /(char|text|binary)\z/ && defined $info->{size} ) {
>>>
>>> doesn't match the type of varchars coming from DBIx::Class, which is
>>> {data_type => "character varying"}.
>>
>> OK, the data_type name came out of the DBIX::Class schema dumper, run
>> on a Postgres database.  (The schema it produced wasn't portable.)
>> I've fixed the schema to use more portable data types (varchar,
>> specifically), which should stop the above problem happening.
>
> Ok, though it's probably reasonable for us to support "character  
> varying".
> I would agree that constraints_from_dbic() has suffered from bitrot.
>
> It probably should be moved into HTML::FormFu::Model::DBIC.
>
> Ideally, I'd like to factor out the FORM <=> DBIC logic from both
> update() and default_values()
> into a more reusable form that can be shared between them and
> constraints_from_dbic(),
> so it will gain support for relationships.
>
> It's not a trivial job though, and I've never had time to tackle it.
>

Hey Carl,

just had a good idea. DBIC supports to pass complex hashes to create  
or update.
We could try to use Model::HashRef and pass that hash to create or  
update.

Just thinking...

moritz




More information about the HTML-FormFu mailing list