[Bast-commits] r5834 - SQL-Abstract/1.x/trunk/t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sun Mar 29 09:35:20 BST 2009
Author: ribasushi
Date: 2009-03-29 09:35:19 +0100 (Sun, 29 Mar 2009)
New Revision: 5834
Modified:
SQL-Abstract/1.x/trunk/t/00new.t
SQL-Abstract/1.x/trunk/t/01generate.t
SQL-Abstract/1.x/trunk/t/02where.t
SQL-Abstract/1.x/trunk/t/03values.t
SQL-Abstract/1.x/trunk/t/04modifiers.t
SQL-Abstract/1.x/trunk/t/07subqueries.t
SQL-Abstract/1.x/trunk/t/08special_ops.t
SQL-Abstract/1.x/trunk/t/09refkind.t
Log:
Remove CR/LF and exec bits
Property changes on: SQL-Abstract/1.x/trunk/t/00new.t
___________________________________________________________________
Name: svn:executable
- *
Property changes on: SQL-Abstract/1.x/trunk/t/01generate.t
___________________________________________________________________
Name: svn:executable
- *
Property changes on: SQL-Abstract/1.x/trunk/t/02where.t
___________________________________________________________________
Name: svn:executable
- *
Property changes on: SQL-Abstract/1.x/trunk/t/03values.t
___________________________________________________________________
Name: svn:executable
- *
Property changes on: SQL-Abstract/1.x/trunk/t/04modifiers.t
___________________________________________________________________
Name: svn:executable
- *
Modified: SQL-Abstract/1.x/trunk/t/07subqueries.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/07subqueries.t 2009-03-29 08:33:45 UTC (rev 5833)
+++ SQL-Abstract/1.x/trunk/t/07subqueries.t 2009-03-29 08:35:19 UTC (rev 5834)
@@ -1,105 +1,105 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use Test::More;
-
-use SQL::Abstract::Test import => ['is_same_sql_bind'];
-
-use SQL::Abstract;
-
-my $sql = SQL::Abstract->new;
-
-my (@tests, $sub_stmt, @sub_bind, $where);
-
-#1
-($sub_stmt, @sub_bind) = ("SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?",
- 100, "foo%");
-$where = {
- foo => 1234,
- bar => \["IN ($sub_stmt)" => @sub_bind],
- };
-push @tests, {
- where => $where,
- stmt => " WHERE ( bar IN (SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?) AND foo = ? )",
- bind => [100, "foo%", 1234],
-};
-
-#2
-($sub_stmt, @sub_bind)
- = $sql->select("t1", "c1", {c2 => {"<" => 100},
- c3 => {-like => "foo%"}});
-$where = {
- foo => 1234,
- bar => \["> ALL ($sub_stmt)" => @sub_bind],
- };
-push @tests, {
- where => $where,
- stmt => " WHERE ( bar > ALL (SELECT c1 FROM t1 WHERE ( c2 < ? AND c3 LIKE ? )) AND foo = ? )",
- bind => [100, "foo%", 1234],
-};
-
-#3
-($sub_stmt, @sub_bind)
- = $sql->select("t1", "*", {c1 => 1, c2 => \"> t0.c0"});
-$where = {
- foo => 1234,
- -nest => \["EXISTS ($sub_stmt)" => @sub_bind],
- };
-push @tests, {
- where => $where,
- stmt => " WHERE ( EXISTS (SELECT * FROM t1 WHERE ( c1 = ? AND c2 > t0.c0 )) AND foo = ? )",
- bind => [1, 1234],
-};
-
-#4
-$where = {
- -nest => \["MATCH (col1, col2) AGAINST (?)" => "apples"],
- };
-push @tests, {
- where => $where,
- stmt => " WHERE ( MATCH (col1, col2) AGAINST (?) )",
- bind => ["apples"],
-};
-
-
-#5
-($sub_stmt, @sub_bind)
- = $sql->where({age => [{"<" => 10}, {">" => 20}]});
-$sub_stmt =~ s/^ where //i; # don't want "WHERE" in the subclause
-$where = {
- lname => {-like => '%son%'},
- -nest => \["NOT ( $sub_stmt )" => @sub_bind],
- };
-push @tests, {
- where => $where,
- stmt => " WHERE ( NOT ( ( ( ( age < ? ) OR ( age > ? ) ) ) ) AND lname LIKE ? )",
- bind => [10, 20, '%son%'],
-};
-
-#6
-($sub_stmt, @sub_bind) = ("SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?",
- 100, "foo%");
-$where = {
- foo => 1234,
- bar => { -in => \[$sub_stmt => @sub_bind] },
- };
-push @tests, {
- where => $where,
- stmt => " WHERE ( bar IN (SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?) AND foo = ? )",
- bind => [100, "foo%", 1234],
-};
-
-
-plan tests => scalar(@tests);
-
-for (@tests) {
-
- my($stmt, @bind) = $sql->where($_->{where}, $_->{order});
- is_same_sql_bind($stmt, \@bind, $_->{stmt}, $_->{bind});
-}
-
-
-
-
-
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
+
+use SQL::Abstract;
+
+my $sql = SQL::Abstract->new;
+
+my (@tests, $sub_stmt, @sub_bind, $where);
+
+#1
+($sub_stmt, @sub_bind) = ("SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?",
+ 100, "foo%");
+$where = {
+ foo => 1234,
+ bar => \["IN ($sub_stmt)" => @sub_bind],
+ };
+push @tests, {
+ where => $where,
+ stmt => " WHERE ( bar IN (SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?) AND foo = ? )",
+ bind => [100, "foo%", 1234],
+};
+
+#2
+($sub_stmt, @sub_bind)
+ = $sql->select("t1", "c1", {c2 => {"<" => 100},
+ c3 => {-like => "foo%"}});
+$where = {
+ foo => 1234,
+ bar => \["> ALL ($sub_stmt)" => @sub_bind],
+ };
+push @tests, {
+ where => $where,
+ stmt => " WHERE ( bar > ALL (SELECT c1 FROM t1 WHERE ( c2 < ? AND c3 LIKE ? )) AND foo = ? )",
+ bind => [100, "foo%", 1234],
+};
+
+#3
+($sub_stmt, @sub_bind)
+ = $sql->select("t1", "*", {c1 => 1, c2 => \"> t0.c0"});
+$where = {
+ foo => 1234,
+ -nest => \["EXISTS ($sub_stmt)" => @sub_bind],
+ };
+push @tests, {
+ where => $where,
+ stmt => " WHERE ( EXISTS (SELECT * FROM t1 WHERE ( c1 = ? AND c2 > t0.c0 )) AND foo = ? )",
+ bind => [1, 1234],
+};
+
+#4
+$where = {
+ -nest => \["MATCH (col1, col2) AGAINST (?)" => "apples"],
+ };
+push @tests, {
+ where => $where,
+ stmt => " WHERE ( MATCH (col1, col2) AGAINST (?) )",
+ bind => ["apples"],
+};
+
+
+#5
+($sub_stmt, @sub_bind)
+ = $sql->where({age => [{"<" => 10}, {">" => 20}]});
+$sub_stmt =~ s/^ where //i; # don't want "WHERE" in the subclause
+$where = {
+ lname => {-like => '%son%'},
+ -nest => \["NOT ( $sub_stmt )" => @sub_bind],
+ };
+push @tests, {
+ where => $where,
+ stmt => " WHERE ( NOT ( ( ( ( age < ? ) OR ( age > ? ) ) ) ) AND lname LIKE ? )",
+ bind => [10, 20, '%son%'],
+};
+
+#6
+($sub_stmt, @sub_bind) = ("SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?",
+ 100, "foo%");
+$where = {
+ foo => 1234,
+ bar => { -in => \[$sub_stmt => @sub_bind] },
+ };
+push @tests, {
+ where => $where,
+ stmt => " WHERE ( bar IN (SELECT c1 FROM t1 WHERE c2 < ? AND c3 LIKE ?) AND foo = ? )",
+ bind => [100, "foo%", 1234],
+};
+
+
+plan tests => scalar(@tests);
+
+for (@tests) {
+
+ my($stmt, @bind) = $sql->where($_->{where}, $_->{order});
+ is_same_sql_bind($stmt, \@bind, $_->{stmt}, $_->{bind});
+}
+
+
+
+
+
Modified: SQL-Abstract/1.x/trunk/t/08special_ops.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/08special_ops.t 2009-03-29 08:33:45 UTC (rev 5833)
+++ SQL-Abstract/1.x/trunk/t/08special_ops.t 2009-03-29 08:35:19 UTC (rev 5834)
@@ -1,69 +1,69 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use Test::More;
-
-use SQL::Abstract::Test import => ['is_same_sql_bind'];
-
-use SQL::Abstract;
-
-my $sqlmaker = SQL::Abstract->new(special_ops => [
-
- # special op for MySql MATCH (field) AGAINST(word1, word2, ...)
- {regex => qr/^match$/i,
- handler => sub {
- my ($self, $field, $op, $arg) = @_;
- $arg = [$arg] if not ref $arg;
- my $label = $self->_quote($field);
- my ($placeholder) = $self->_convert('?');
- my $placeholders = join ", ", (($placeholder) x @$arg);
- my $sql = $self->_sqlcase('match') . " ($label) "
- . $self->_sqlcase('against') . " ($placeholders) ";
- my @bind = $self->_bindtype($field, @$arg);
- return ($sql, @bind);
- }
- },
-
- # special op for Basis+ NATIVE
- {regex => qr/^native$/i,
- handler => sub {
- my ($self, $field, $op, $arg) = @_;
- $arg =~ s/'/''/g;
- my $sql = "NATIVE (' $field $arg ')";
- return ($sql);
- }
- },
-
-]);
-
-my @tests = (
-
- #1
- { where => {foo => {-match => 'foo'},
- bar => {-match => [qw/foo bar/]}},
- stmt => " WHERE ( MATCH (bar) AGAINST (?, ?) AND MATCH (foo) AGAINST (?) )",
- bind => [qw/foo bar foo/],
- },
-
- #2
- { where => {foo => {-native => "PH IS 'bar'"}},
- stmt => " WHERE ( NATIVE (' foo PH IS ''bar'' ') )",
- bind => [],
- },
-
-);
-
-
-plan tests => scalar(@tests);
-
-for (@tests) {
-
- my($stmt, @bind) = $sqlmaker->where($_->{where}, $_->{order});
- is_same_sql_bind($stmt, \@bind, $_->{stmt}, $_->{bind});
-}
-
-
-
-
-
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
+
+use SQL::Abstract;
+
+my $sqlmaker = SQL::Abstract->new(special_ops => [
+
+ # special op for MySql MATCH (field) AGAINST(word1, word2, ...)
+ {regex => qr/^match$/i,
+ handler => sub {
+ my ($self, $field, $op, $arg) = @_;
+ $arg = [$arg] if not ref $arg;
+ my $label = $self->_quote($field);
+ my ($placeholder) = $self->_convert('?');
+ my $placeholders = join ", ", (($placeholder) x @$arg);
+ my $sql = $self->_sqlcase('match') . " ($label) "
+ . $self->_sqlcase('against') . " ($placeholders) ";
+ my @bind = $self->_bindtype($field, @$arg);
+ return ($sql, @bind);
+ }
+ },
+
+ # special op for Basis+ NATIVE
+ {regex => qr/^native$/i,
+ handler => sub {
+ my ($self, $field, $op, $arg) = @_;
+ $arg =~ s/'/''/g;
+ my $sql = "NATIVE (' $field $arg ')";
+ return ($sql);
+ }
+ },
+
+]);
+
+my @tests = (
+
+ #1
+ { where => {foo => {-match => 'foo'},
+ bar => {-match => [qw/foo bar/]}},
+ stmt => " WHERE ( MATCH (bar) AGAINST (?, ?) AND MATCH (foo) AGAINST (?) )",
+ bind => [qw/foo bar foo/],
+ },
+
+ #2
+ { where => {foo => {-native => "PH IS 'bar'"}},
+ stmt => " WHERE ( NATIVE (' foo PH IS ''bar'' ') )",
+ bind => [],
+ },
+
+);
+
+
+plan tests => scalar(@tests);
+
+for (@tests) {
+
+ my($stmt, @bind) = $sqlmaker->where($_->{where}, $_->{order});
+ is_same_sql_bind($stmt, \@bind, $_->{stmt}, $_->{bind});
+}
+
+
+
+
+
Modified: SQL-Abstract/1.x/trunk/t/09refkind.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/09refkind.t 2009-03-29 08:33:45 UTC (rev 5833)
+++ SQL-Abstract/1.x/trunk/t/09refkind.t 2009-03-29 08:35:19 UTC (rev 5834)
@@ -1,31 +1,31 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use Test::More;
-use SQL::Abstract;
-
-plan tests => 13;
-
-my $obj = bless {}, "Foo::Bar";
-
-is(SQL::Abstract->_refkind(undef), 'UNDEF', 'UNDEF');
-
-is(SQL::Abstract->_refkind({}), 'HASHREF', 'HASHREF');
-is(SQL::Abstract->_refkind([]), 'ARRAYREF', 'ARRAYREF');
-
-is(SQL::Abstract->_refkind(\{}), 'HASHREFREF', 'HASHREFREF');
-is(SQL::Abstract->_refkind(\[]), 'ARRAYREFREF', 'ARRAYREFREF');
-
-is(SQL::Abstract->_refkind(\\{}), 'HASHREFREFREF', 'HASHREFREFREF');
-is(SQL::Abstract->_refkind(\\[]), 'ARRAYREFREFREF', 'ARRAYREFREFREF');
-
-is(SQL::Abstract->_refkind("foo"), 'SCALAR', 'SCALAR');
-is(SQL::Abstract->_refkind(\"foo"), 'SCALARREF', 'SCALARREF');
-is(SQL::Abstract->_refkind(\\"foo"), 'SCALARREFREF', 'SCALARREFREF');
-
-# objects are treated like scalars
-is(SQL::Abstract->_refkind($obj), 'SCALAR', 'SCALAR');
-is(SQL::Abstract->_refkind(\$obj), 'SCALARREF', 'SCALARREF');
-is(SQL::Abstract->_refkind(\\$obj), 'SCALARREFREF', 'SCALARREFREF');
-
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use SQL::Abstract;
+
+plan tests => 13;
+
+my $obj = bless {}, "Foo::Bar";
+
+is(SQL::Abstract->_refkind(undef), 'UNDEF', 'UNDEF');
+
+is(SQL::Abstract->_refkind({}), 'HASHREF', 'HASHREF');
+is(SQL::Abstract->_refkind([]), 'ARRAYREF', 'ARRAYREF');
+
+is(SQL::Abstract->_refkind(\{}), 'HASHREFREF', 'HASHREFREF');
+is(SQL::Abstract->_refkind(\[]), 'ARRAYREFREF', 'ARRAYREFREF');
+
+is(SQL::Abstract->_refkind(\\{}), 'HASHREFREFREF', 'HASHREFREFREF');
+is(SQL::Abstract->_refkind(\\[]), 'ARRAYREFREFREF', 'ARRAYREFREFREF');
+
+is(SQL::Abstract->_refkind("foo"), 'SCALAR', 'SCALAR');
+is(SQL::Abstract->_refkind(\"foo"), 'SCALARREF', 'SCALARREF');
+is(SQL::Abstract->_refkind(\\"foo"), 'SCALARREFREF', 'SCALARREFREF');
+
+# objects are treated like scalars
+is(SQL::Abstract->_refkind($obj), 'SCALAR', 'SCALAR');
+is(SQL::Abstract->_refkind(\$obj), 'SCALARREF', 'SCALARREF');
+is(SQL::Abstract->_refkind(\\$obj), 'SCALARREFREF', 'SCALARREFREF');
+
More information about the Bast-commits
mailing list