[Bast-commits] r5714 - in SQL-Abstract/1.x/branches/1.50_RC:
lib/SQL t
robkinyon at dev.catalyst.perl.org
robkinyon at dev.catalyst.perl.org
Mon Mar 9 00:35:23 GMT 2009
Author: robkinyon
Date: 2009-03-09 00:35:23 +0000 (Mon, 09 Mar 2009)
New Revision: 5714
Modified:
SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm
SQL-Abstract/1.x/branches/1.50_RC/t/02where.t
SQL-Abstract/1.x/branches/1.50_RC/t/03values.t
Log:
Fixed interjecting arrayrefref into a where clause
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 2009-03-09 00:25:12 UTC (rev 5713)
+++ SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm 2009-03-09 00:35:23 UTC (rev 5714)
@@ -386,6 +386,8 @@
# skip empty elements, otherwise get invalid trailing AND stuff
ARRAYREF => sub {$self->_recurse_where($el) if @$el},
+ ARRAYREFREF => sub { @{${$el}} if @{${$el}}},
+
HASHREF => sub {$self->_recurse_where($el, 'and') if %$el},
# LDNOTE : previous SQLA code for hashrefs was creating a dirty
# side-effect: the first hashref within an array would change
@@ -410,8 +412,17 @@
return $self->_join_sql_clauses($logic, \@sql_clauses, \@all_bind);
}
+#======================================================================
+# WHERE: top-level ARRAYREFREF
+#======================================================================
+sub _where_ARRAYREFREF {
+ my ($self, $where) = @_;
+ my ($sql, @bind) = @{${$where}};
+ return ($sql, @bind);
+}
+
#======================================================================
# WHERE: top-level HASHREF
#======================================================================
Modified: SQL-Abstract/1.x/branches/1.50_RC/t/02where.t
===================================================================
--- SQL-Abstract/1.x/branches/1.50_RC/t/02where.t 2009-03-09 00:25:12 UTC (rev 5713)
+++ SQL-Abstract/1.x/branches/1.50_RC/t/02where.t 2009-03-09 00:35:23 UTC (rev 5714)
@@ -14,6 +14,7 @@
my $not_stringifiable = bless {}, 'SQLA::NotStringifiable';
my at x=(
+);my @handle_tests = (
{
where => {
requestor => 'inna',
@@ -196,19 +197,18 @@
bind => [ $not_stringifiable ],
},
-);my @handle_tests = (
{
- where => \[ 'foo ?','bar' ],
+ where => \[ 'foo = ?','bar' ],
stmt => " WHERE (foo = ?)",
bind => [ "bar" ],
},
-);my at x2=(
{
- where => [ \[ 'foo ?','bar' ] ],
+ where => [ \[ 'foo = ?','bar' ] ],
stmt => " WHERE (foo = ?)",
bind => [ "bar" ],
},
+);my at x2=(
);
Modified: SQL-Abstract/1.x/branches/1.50_RC/t/03values.t
===================================================================
--- SQL-Abstract/1.x/branches/1.50_RC/t/03values.t 2009-03-09 00:25:12 UTC (rev 5713)
+++ SQL-Abstract/1.x/branches/1.50_RC/t/03values.t 2009-03-09 00:35:23 UTC (rev 5714)
@@ -109,5 +109,5 @@
[$sql->values ($data)],
[@bind],
'values() output matches that of initial bind'
- ) || diag "Corresponding SQL statement: $stmt";
+ );# || diag "Corresponding SQL statement: $stmt";
}
More information about the Bast-commits
mailing list