X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F00new.t;h=b6927da2fa8175825627af98ee2852f2127e8776;hb=170e6c33a3262ece53aa79249d9a8d1149bc4c35;hp=57274783c836a984eab35412411e13915bd1d625;hpb=5aad8cf3d200d1538a5fad5b01895e1ccd3da80a;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/00new.t b/t/00new.t index 5727478..b6927da 100644 --- a/t/00new.t +++ b/t/00new.t @@ -6,13 +6,8 @@ use Test::More; use SQL::Abstract::Test import => ['is_same_sql_bind']; -plan tests => 15; - -use_ok('SQL::Abstract'); - #LDNOTE: renamed all "bind" into "where" because that's what they are - my @handle_tests = ( #1 { @@ -22,6 +17,8 @@ my @handle_tests = ( # the test was not consistent with the doc: hashrefs should not be # influenced by the current logic, they always mean 'AND'. So # { a => 4, b => 0} should ALWAYS mean ( a = ? AND b = ? ). +# +# acked by RIBASUSHI stmt => 'SELECT * FROM test WHERE ( a = ? AND b = ? )' }, #2 @@ -44,6 +41,7 @@ my @handle_tests = ( args => {cmp => "=", logic => 'or'}, # LDNOTE idem # stmt => 'SELECT * FROM test WHERE ( a = ? OR b = ? )' +# acked by RIBASUSHI stmt => 'SELECT * FROM test WHERE ( a = ? AND b = ? )' }, #6 @@ -56,6 +54,7 @@ my @handle_tests = ( args => {logic => "or", cmp => "like"}, # LDNOTE idem # stmt => 'SELECT * FROM test WHERE ( a LIKE ? OR b LIKE ? )' +# acked by RIBASUSHI stmt => 'SELECT * FROM test WHERE ( a LIKE ? AND b LIKE ? )' }, #8 @@ -92,15 +91,7 @@ my @handle_tests = ( #14 { args => {convert => "upper"}, -# LDNOTE : modified the test below, because modified the semantics -# of "e => { '!=', [qw(f g)] }" : generating "e != 'f' OR e != 'g'" -# is nonsense (will always be true whatever the value of e). Since -# this is a 'negative' operator, we must apply the Morgan laws and -# interpret it as "e != 'f' AND e != 'g'" (and actually the user -# should rather write "e => {-not_in => [qw/f g/]}". - -# stmt => 'SELECT * FROM test WHERE ( ( UPPER(hostname) IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) AND ( ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) ) ) OR ( UPPER(tack) BETWEEN UPPER(?) AND UPPER(?) ) OR ( ( ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) ) AND ( ( UPPER(e) != UPPER(?) ) OR ( UPPER(e) != UPPER(?) ) ) AND UPPER(q) NOT IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) ) )', - stmt => 'SELECT * FROM test WHERE ( ( UPPER(hostname) IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) AND ( ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) ) ) OR ( UPPER(tack) BETWEEN UPPER(?) AND UPPER(?) ) OR ( ( ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) ) AND ( ( UPPER(e) != UPPER(?) ) AND ( UPPER(e) != UPPER(?) ) ) AND UPPER(q) NOT IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) ) )', + stmt => 'SELECT * FROM test WHERE ( ( UPPER(hostname) IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) AND ( ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) ) ) OR ( UPPER(tack) BETWEEN UPPER(?) AND UPPER(?) ) OR ( ( ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) ) AND ( ( UPPER(e) != UPPER(?) ) OR ( UPPER(e) != UPPER(?) ) ) AND UPPER(q) NOT IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) ) )', where => [ { ticket => [11, 12, 13], hostname => { in => ['ntf', 'avd', 'bvd', '123'] } }, { tack => { between => [qw/tick tock/] } }, @@ -110,6 +101,11 @@ my @handle_tests = ( }, ); + +plan tests => (1 + scalar(@handle_tests)); + +use_ok('SQL::Abstract'); + for (@handle_tests) { local $" = ', '; #print "creating a handle with args ($_->{args}): ";