[CDBI] Re: custom accessor problem?

adam <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
On 3/12/07, Edward J. Sabol <sabol-2oVx0MVsMgiP/[email protected]> wrote:
> Adam wrote:
> > OK, looking at that again it breaks some code with using a custom
> > accessor_name_for sub. Reverting line 344 and adding the following line
> > around 362 (after the foreach my $type (keys %method) {}) works better
> > - leaving the custom accessor ($acc) method in place, but adding an
> > extra one based on $default_accessor as well.
> >
> > $class->_make_method("${default_accessor}",
> > $class->make_ro_accessor($col->name_lc));
> >
> > Any thoughts?
>
> Instantiating your own Class::DBI::Column object is probably the way of the
> future (Tony has said a few times that he'd like to support things like this
> and Class::DBI v3.0.x releases have been heading in that direction), but my
> guess is that future has not yet been realized.
>
> > my $topic_precise_updated_dt = Class::DBI::Column->new(
> >    'convert (char(26), topic_updated_dt, 109)' => {
> >      accessor => 'precise',
> >    }
> > );
>
> The only documented argument to the Class::DBI::Column->new() method
> currently is a single parameter name. Passing in other options is dangerous
> territory. Michael Schwern is probably fuming at the thought of using such an
> "undocumented feature."

Sorry! It's in the Class::DBI pod -
http://search.cpan.org/~tmtm/Class-DBI-v3.0.16/lib/Class/DBI.pm#Changing_Your_Column_Accessor_Method_Names
so I didn't think I was being especially naughty :-)

> :-) It might be worth opening up a request at
> <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-DBI> with severity "wishlist"
> to see what Tony suggests.

Will do, thanks for the tip.

> There are a
> couple entries in the CDBI Cookbook that you should read:
>
> http://wiki.class-dbi.com/wiki/Setting_system_date_fields
> http://wiki.class-dbi.com/wiki/Working_With_Oracle_Date_Fields
>
> Hope this helps,
> Ed

Sort of - I guess I was hoping for a way to use custom sql for columns
rather than a specific solution to the datetime issue. But there's
plenty of food for thought, so a big Thanks anyway :-)

--
Adam
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.