[Dbix-class] SQL::Abstract 1.x subqueries patch

Peter Rabbitson rabbit+list at rabbit.us
Mon Nov 3 08:31:30 GMT 2008


Dami Laurent (PJ) wrote:
> Hi,
> 
> I confirm that subqueries are implemented in the 1.50RC branch (have a look at the L<CHANGES> section).
> 
> Concerning tests : SQLA 1.50 often generates less parentheses than previous versions. So the output is equivalent in semantics, but not in surface syntax; as a result, the applications will most probably continue to work , but the tests do fail because the best they can do is to check the resulting SQL syntax.
> 
> It would be quite difficult and rather pointless to try to generate exactly the same parentheses as before; so instead, there is a test module SQL::Abstract::Test that implements a test function is_same_sql_bind(..) that compares SQL statements on abstract level, ignoring unnecessary parentheses. As an example, attached is a a test rewrite for SQL::Abstract::Limit . 
> 
> Yes it would be great if somebody could invest some time in testing it against DBIx-Class.
> 

Of course it would be absolutely pointless to make the syntax match.
What I was referring to is a number of test that seem to fail on
substance (i.e. the amount of rows returned etc). I can try to give you
some more details next week, but here is a start. These tests expect a
specific number of rows/relations, or a specific object to be present,
yet a lot of them have a hard time with it. What I could quickly
identify (didn't look at source):

t/26dumper.........................................NOK 2/2

#   Failed test 'Single record in after death with dumper'
#   at t/26dumper.t line 37.
#          got: 0
#     expected: 1
# Looks like you failed 1 test of 2.


t/41orrible........................................[SQL::Abstract::_SWITCH_refkind]
Fatal: no dispatch entry for UNDEF at t/41orrible.t line 14
# Looks like your test exited with 255 before it could output anything.
t/41orrible........................................dubious

	Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-4
	Failed 4/4 tests, 0.00% okay


t/46where_attribute................................NOK 7/16

#   Failed test 'many_to_many explicit query through linking table with
query starting from resultset count correct'
#   at t/46where_attribute.t line 38.
#          got: '0'
#     expected: '2'
t/46where_attribute................................NOK 8/16

#   Failed test 'many_to_many explicit query through linking table with
query starting from row count correct'
#   at t/46where_attribute.t line 43.
#          got: '0'
#     expected: '2'
t/46where_attribute................................NOK 9/16

#   Failed test 'many_to_many explicit query through linking table with
where starting from row count correct'
#   at t/46where_attribute.t line 48.
#          got: '0'
#     expected: '2'
t/46where_attribute................................NOK 10/16

#   Failed test 'many_to_many resultset with where in resultset attrs
count correct'
#   at t/46where_attribute.t line 53.
#          got: '0'
#     expected: '2'
t/46where_attribute................................NOK 12/16

#   Failed test 'many_to_many add_to_$rel($hash) with where in
relationship attrs count correct'
#   at t/46where_attribute.t line 59.
#          got: '0'
#     expected: '1'
t/46where_attribute................................NOK 14/16

#   Failed test 'many_to_many add_to_$rel($object) with where in
relationship attrs count correct'
#   at t/46where_attribute.t line 66.
#          got: '0'
#     expected: '1'
t/46where_attribute................................NOK 16/16

#   Failed test 'many_to_many add_to_$rel($hash) count correct'
#   at t/46where_attribute.t line 74.
#          got: '0'
#     expected: '1'
# Looks like you failed 7 tests of 16.


t/60core...........................................NOK 13/84

#   Failed test 'funny join is okay'
#   at t/60core.t line 66.
Can't call method "title" on an undefined value at t/60core.t line 179.
# Looks like you planned 84 tests but ran 41.
# Looks like you failed 1 test of 41 run.
# Looks like your test exited with 2 just after 41.


t/64db.............................................ok
1/4DBIx::Class::Storage::DBI::columns_info_for():
[SQL::Abstract::_SWITCH_refkind] Fatal: no dispatch entry for UNDEF at
/home/rabbit/devel/dbic/trunk/blib/lib/DBIx/Class/Storage/DBI.pm line 1474
# Looks like you planned 4 tests but ran 2.
# Looks like your test exited with 255 just after 2.


t/66relationship...................................ok 1/67Can't call
method "cdid" on an undefined value at t/66relationship.t line 63.
# Looks like you planned 67 tests but ran 7.
# Looks like your test exited with 2 just after 7.


t/68inflate_resultclass_hashrefinflator............NOK 2/0

#   Failed test 'Equal number of tracks fetched'
#   at t/68inflate_resultclass_hashrefinflator.t line 107.
#          got: '0'
#     expected: '1'
Can't call method "cd" on an undefined value at
t/68inflate_resultclass_hashrefinflator.t line 113.
# Looks like you failed 1 test of 2.
# Looks like your test exited with 2 just after 2.


t/77join_count.....................................NOK 1/4

#   Failed test 'Count by has_a ok'
#   at t/77join_count.t line 14.
#          got: 0
#     expected: 3
t/77join_count.....................................NOK 2/4

#   Failed test 'Count by has_many ok'
#   at t/77join_count.t line 18.
#          got: 0
#     expected: 4
t/77join_count.....................................NOK 3/4

#   Failed test 'Count by might_have ok'
#   at t/77join_count.t line 21.
#          got: 0
#     expected: 3
t/77join_count.....................................NOK 4/4

#   Failed test 'Mixed count ok'
#   at t/77join_count.t line 26.
#          got: 0
#     expected: 2
# Looks like you failed 4 tests of 4.
t/77join_count.....................................dubious

	Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 1-4
	Failed 4/4 tests, 0.00% okay


t/77prefetch.......................................NOK 3/58

#   Failed test 'Correct number of records returned'
#   at t/77prefetch.t line 46.
#          got: 0
#     expected: 3
Can't call method "title" on an undefined value at t/77prefetch.t line 54.


t/78self_referencial...............................NOK 3/4

#   Failed test 'proper original'
#   at t/78self_referencial.t line 40.
#          got: undef
#     expected: 'First'
t/78self_referencial...............................NOK 4/4

#   Failed test 'proper alias'
#   at t/78self_referencial.t line 41.
#          got: undef
#     expected: 'Second'
# Looks like you failed 2 tests of 4.


t/83cache..........................................NOK 9/23

#   Failed test 'cache for artist->cds contains correct number of records'
#   at t/83cache.t line 89.
#          got: '0'
#     expected: '3'
t/83cache..........................................NOK 10/23

#   Failed test 'artist->cds returns correct number of objects'
#   at t/83cache.t line 92.
#          got: '0'
#     expected: '3'
t/83cache..........................................NOK 11/23

#   Failed test 'artist->cds->count returns correct value'
#   at t/83cache.t line 95.
#          got: '0'
#     expected: '3'
t/83cache..........................................NOK 12/23

#   Failed test 'artist->count_related returns correct value'
#   at t/83cache.t line 98.
#          got: '0'
#     expected: '3'
Can't call method "tags" on an undefined value at t/83cache.t line 148.
# Looks like you planned 23 tests but ran 17.
# Looks like you failed 4 tests of 17 run.
# Looks like your test exited with 2 just after 17.


t/96_is_deteministic_value.........................NOK 3/0

#   Failed test at t/96_is_deteministic_value.t line 42.
# died: DBIx::Class::Exception (DBIx::Class::ResultSet::create():
[SQL::Abstract::_SWITCH_refkind] Fatal: no dispatch entry for
DateTimeREF at
/home/rabbit/devel/dbic/trunk/blib/lib/DBIx/Class/Storage/DBI.pm line 1151
# )
Can't call method "year" on an undefined value at
t/96_is_deteministic_value.t line 43.
# Looks like you failed 1 test of 3.
# Looks like your test exited with 255 just after 3.

t/97result_class...................................NOK 5/9

#   Failed test 'Inflated into correct cd result_class isa DBICTest::CD'
#   at t/97result_class.t line 28.
#     Inflated into correct cd result_class isn't defined
t/97result_class...................................NOK 8/9

#   Failed test 'Inflated into correct cd result_class isa DBICTest::CD'
#   at t/97result_class.t line 42.
#     Inflated into correct cd result_class isn't defined
t/97result_class...................................NOK 9/9

#   Failed test 'Inflated into correct cd result_class isa DBICTest::CD'
#   at t/97result_class.t line 43.
#     Inflated into correct cd result_class isn't defined
# Looks like you failed 3 tests of 9.
t/97result_class...................................dubious





More information about the DBIx-Class mailing list