[SearchBuilder-devel] [RFC] JDBI::Filters should be configurable via column info

Jesse Vincent jesse at bestpractical.com
Wed Sep 21 17:35:49 EDT 2005


> > there should be ways to do:
> >
> > * global filters
> I don't see much usage of it.

* "my database is utf8" . make sure all my data is.

> > * app-specific filters
> IMHO this is not special group of filters, but app can override
> methods which return filters lists and add/remove filters. As Robert
> said: - "they can always write a custom accessor/modifier/whateverer
> to munge the data"

I'd rather have convenient hooks than make the app have deep knowledge
of what other filters are there.

> > * column specific filters
> Looks like current code implement this type of filters, but really it
> implements something like global filters.
> 
> > * column type specific filters.
> Where do you want to describe this?

This is a good question. I don't know. does Jifty::DBI::Column have
subclasses for different types?


> > * database specific filters
> DB type(Oracle, Pg...) specific?

yes! (Think "postgres needs a mime64 for blobs filter")

> API design:
> 
> I think almost all this can be done with two methods, but defined for
> different classes: Handle, Record, Column.
> 
> public API:
> I suggest two methods: input_filters, output_filters.
> In JDBI core this methods looks like:
> sub input_filters { return @our_default_list }
> sub output_filters { return reverse $_[0]->input_filters }
> So if someone wants different chain for output then he override
> output_filters method.

What object is this on? the column?



> private API methods:
> 
> sub Record::_filters( $direction, $column ) {
>   my @filters = ();
>   my @objs = ($self, $column, $self->handle);
>   @objs = reverse @objs if $direction eq 'output';
>   my $method = $direction ."_filters";
>   foreach my $obj( @objs ) {
>     push @filters, $obj->$method( column => $column, record => $self );
>   }
>   return @filters;
> }
> 
> sub Record::_apply_input_filters( $column, $value_ref );
> sub Record::_apply_output_filters( $column, $value_ref );
> sub Record::__apply_filters( $action, $column, $value_ref, @list );


Why are these on the record, not on the column? And why positional
params? I hate positional params ;)

> Thoughts?
> 
> >
> >
> > > --
> > > Best regards, Ruslan.
> > > _______________________________________________
> > > SearchBuilder-devel mailing list
> > > SearchBuilder-devel at bestpractical.com
> > > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/searchbuilder-devel
> > >
> >
> > --
> >
> 
> 
> --
> Best regards, Ruslan.
> 

-- 


More information about the SearchBuilder-devel mailing list