Maybe more Moose Bugs?

Still playing with the API here in the Moos-Pen today.

Now that I have that new API for 'Gather/Group By' I will have to update how Driver::DBI works. Starting with the new test in the 50_group_by.t test case.


{
caption => "group by with 2 elements and 2 view_elements",
key => 'gather',
gather => {
elements => [
{
name => 'first_name',
view => 'people'
},
{ name => 'user_id',
view => 'people'
}
],
view_elements => [
{
name => 'first_name',
view => 'people'
},
{
function => 'count',
left => { name => 'user_id',
view => 'people'}
}
],
},
retrieve => {
sql =>
"SELECT people.first_name, COUNT(people.user_id) FROM people GROUP BY people.first_name, people.user_id",
},
create => {
container => $container,
sql =>
"INSERT INTO people ( first_name, last_name ) VALUES( ?, ? )",
params => [ 'Bill', 'Bloggings' ]
},
update => {
container => $container,
sql =>
"UPDATE people SET first_name = ?, last_name = ?",
params => [ 'Bill', 'Bloggings' ]
},
delete => {
sql => "DELETE FROM people",
},
},

After adding the test I gave it a run just to see what would happen and I got this result;

ok 34 - group by with 3 elements mixed 2 havging delete SQL correct
ok 35 - group by with 2 elements and 2 view_elements create SQL correct
ok 36 - group by with 2 elements and 2 view_elements create params correct
ok 37 - group by with 2 elements and 2 view_elements retrieve SQL correct
ok 38 - group by with 2 elements and 2 view_elements update SQL correct
ok 39 - group by with 2 elements and 2 view_elements update params correct
ok 40 - group by with 2 elements and 2 view_elements delete SQL correct

Ok bonus I guess the pattern of only passing into the DAD the 'Elements/Fields' that are defined by the 'view_elements' works like a charm.

I might as well follow my normal Sunday tradition and run a full test check on my code so far.

I did a full test on Database::Accessor and only had a few test counts out of sync and after a few edits I get


All tests successful.
Files=28, Tests=542,
Onto Driver::DBI and when I do a full test run I get

All tests successful.
Files=11, Tests=468

So I guess it really is just a test post-ette today after all. Here is a cute baby moose pic because there where no bugs today.

15mooose.jpg

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations