[Bast-commits] r5171 - in SQL-Abstract/1.x/branches/1.50_RC: .
lib/SQL
norbi at dev.catalyst.perl.org
norbi at dev.catalyst.perl.org
Fri Nov 21 13:32:54 GMT 2008
Author: norbi
Date: 2008-11-21 13:32:53 +0000 (Fri, 21 Nov 2008)
New Revision: 5171
Modified:
SQL-Abstract/1.x/branches/1.50_RC/
SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm
Log:
r5202 at vger: mendel | 2008-11-21 14:32:46 +0100
* Refactored to use _SWITCH_refkind in _where_hashpair_HASHREF.
Property changes on: SQL-Abstract/1.x/branches/1.50_RC
___________________________________________________________________
Name: svk:merge
- 4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/SQL-Abstract/1.x/branches/1.50_RC:5190
+ 4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/SQL-Abstract/1.x/branches/1.50_RC:5202
Modified: SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm
===================================================================
--- SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm 2008-11-20 15:30:48 UTC (rev 5170)
+++ SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm 2008-11-21 13:32:53 UTC (rev 5171)
@@ -523,35 +523,35 @@
if ($special_op) {
($sql, @bind) = $special_op->{handler}->($self, $k, $op, $val);
}
+ else {
+ $self->_SWITCH_refkind($val, {
- # CASE: col => {op => \@vals}
- elsif (ref $val eq 'ARRAY') {
- ($sql, @bind) = $self->_where_field_op_ARRAYREF($k, $op, $val);
- }
+ ARRAYREF => sub { # CASE: col => {op => \@vals}
+ ($sql, @bind) = $self->_where_field_op_ARRAYREF($k, $op, $val);
+ },
- # CASE: col => {op => \$scalar}
- elsif (ref $val eq 'SCALAR') {
- $sql = join ' ', $self->_convert($self->_quote($k)),
- $self->_sqlcase($op),
- $$val;
- }
+ SCALARREF => sub { # CASE: col => {op => \$scalar}
+ $sql = join ' ', $self->_convert($self->_quote($k)),
+ $self->_sqlcase($op),
+ $$val;
+ },
- # CASE: col => {op => undef} : sql "IS (NOT)? NULL"
- elsif (! defined($val)) {
- my $is = ($op =~ $self->{equality_op}) ? 'is' :
- ($op =~ $self->{inequality_op}) ? 'is not' :
- puke "unexpected operator '$op' with undef operand";
- $sql = $self->_quote($k) . $self->_sqlcase(" $is null");
+ UNDEF => sub { # CASE: col => {op => undef} : sql "IS (NOT)? NULL"
+ my $is = ($op =~ $self->{equality_op}) ? 'is' :
+ ($op =~ $self->{inequality_op}) ? 'is not' :
+ puke "unexpected operator '$op' with undef operand";
+ $sql = $self->_quote($k) . $self->_sqlcase(" $is null");
+ },
+
+ FALLBACK => sub { # CASE: col => {op => $scalar}
+ $sql = join ' ', $self->_convert($self->_quote($k)),
+ $self->_sqlcase($op),
+ $self->_convert('?');
+ @bind = $self->_bindtype($k, $val);
+ },
+ });
}
- # CASE: col => {op => $scalar}
- else {
- $sql = join ' ', $self->_convert($self->_quote($k)),
- $self->_sqlcase($op),
- $self->_convert('?');
- @bind = $self->_bindtype($k, $val);
- }
-
push @all_sql, $sql;
push @all_bind, @bind;
}
More information about the Bast-commits
mailing list