[Catalyst-commits] r8399 - in CatalystX-CRUD/CatalystX-CRUD/trunk:
. lib/CatalystX/CRUD/Model
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Thu Sep 11 07:10:03 BST 2008
Author: karpet
Date: 2008-09-11 07:10:03 +0100 (Thu, 11 Sep 2008)
New Revision: 8399
Modified:
CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
Log:
skip empty fields and bump req for dbic support
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL 2008-09-11 05:22:45 UTC (rev 8398)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL 2008-09-11 06:10:03 UTC (rev 8399)
@@ -19,7 +19,7 @@
'Class::C3' => 0,
'Data::Dump' => 0, # for testing
'Sort::SQL' => 0.03,
- 'Search::QueryParser::SQL' => 0.002,
+ 'Search::QueryParser::SQL' => 0.005,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2008-09-11 05:22:45 UTC (rev 8398)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2008-09-11 06:10:03 UTC (rev 8399)
@@ -137,19 +137,29 @@
}
sub make_sql_query {
- my $self = shift;
- my $c = $self->context;
- my $field_names = shift
+ my $self = shift;
+ my $c = $self->context;
+ my $field_names
+ = shift
|| $c->req->params->{'cxc-query-fields'}
|| $c->controller->field_names($c)
|| $self->throw_error("field_names required");
- my $p2q = $self->params_to_sql_query($field_names);
- my $params = $c->req->params;
- my $sp = Sort::SQL->string2array( $self->_which_sort($c) );
- my $s = join( ' ', map {%$_} @$sp );
- my $offset = $params->{'cxc-offset'} || $params->{'_offset'};
- my $page_size = $params->{'cxc-page_size'}
+ # if present, param overrides default of form->field_names
+ # passed by base controller.
+ if ( exists $c->req->params->{'cxc-query-fields'}
+ && exists $c->req->params->{'cxc-query'} )
+ {
+ $field_names = $c->req->params->{'cxc-query-fields'};
+ }
+
+ my $p2q = $self->params_to_sql_query($field_names);
+ my $params = $c->req->params;
+ my $sp = Sort::SQL->string2array( $self->_which_sort($c) );
+ my $s = join( ' ', map {%$_} @$sp );
+ my $offset = $params->{'cxc-offset'} || $params->{'_offset'};
+ my $page_size
+ = $params->{'cxc-page_size'}
|| $params->{'_page_size'}
|| $c->controller->page_size
|| $self->page_size;
@@ -271,6 +281,8 @@
grep {s/\+/ /g} @v; # TODO URI + for space -- is this right?
$pq{$_} = \@v;
+
+ next unless grep { m/\S/ } @v;
# we don't want to "double encode" $like because it will
# be re-parsed as a word not an op, so we have our a modified
More information about the Catalyst-commits
mailing list