[Catalyst-commits] r8311 - in
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk: .
lib/CatalystX/CRUD/ModelAdapter
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Thu Aug 28 04:53:22 BST 2008
Author: karpet
Date: 2008-08-28 04:53:22 +0100 (Thu, 28 Aug 2008)
New Revision: 8311
Modified:
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
Log:
fix Pg vs PostgreSQL db type check; fix query maker
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes 2008-08-28 03:22:49 UTC (rev 8310)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes 2008-08-28 03:53:22 UTC (rev 8311)
@@ -23,5 +23,6 @@
0.07 xxx
* implement Utils features for ne_sign() use_ilike() and treat_like_int()
+ * tweek make_sql_query() output to match DBIC syntax for -or and -and searches
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2008-08-28 03:22:49 UTC (rev 8310)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2008-08-28 03:53:22 UTC (rev 8311)
@@ -47,6 +47,12 @@
=cut
+# TODO others?
+my %is_iliker = (
+ Pg => 1,
+ PostgreSQL => 1,
+);
+
sub new {
my $self = shift->next::method(@_);
@@ -57,8 +63,7 @@
#warn "DBIC driver: " . $db_type;
- # TODO others?
- $self->use_ilike(1) if $db_type eq 'PostgreSQL';
+ $self->use_ilike( exists $is_iliker{$db_type} );
# SQL for not equal
$self->ne_sign('!=');
@@ -66,6 +71,8 @@
# cache the treat_like_int hash
$self->_treat_like_int;
+ #warn dump $self;
+
return $self;
}
@@ -240,7 +247,7 @@
$query->{OPTS} = \%opts;
- #carp "query: " . dump $query;
+ carp "query: " . dump $query;
return $query;
}
@@ -266,6 +273,14 @@
my $q = $self->next::method($field_names);
+ if ( $q->{query}->[0] eq 'or' ) {
+ $q->{query}->[0] = '-or';
+ }
+
+ if ( $q->{query}->[0] eq 'and' ) {
+ $q->{query}->[0] = '-and';
+ }
+
#carp "make_sql_query : " . dump $q;
return $q;
More information about the Catalyst-commits
mailing list