No Longer a Baby Moose

Another test postette today here in the Moose-Pen;

Carrying on from yesterday I took the time today to first add in this to my new test call


...
$da->retrieve($self->connect());
-- my $ok = ok(
++ my $ok = ok(
$da->result()->query() eq $test->{sql},
$test->{caption} . " SQL correct"
);
++ unless($ok){
++ diag("Expected SQL--> ".$test->{sql}."\nGenerated Out-> ".$da->result()->query());
++ }


What the above does is print out the SQL I am interested in like this;

# Expected SQL--> SELECT people.first_name, people.last_name, people.user_id FROM people ORDER BY people.last_name, people.first_name
# Generated SQL-> SELECT people.first_name, people.last_name, people.user_id FROM people ORDER BY people.last_name, .first_name

I did this with the 'diag' function rather than the 'note' function as I do not really want the output to show up in the 'TAP' file or in the output that would be displayed as useless clutter on cpantesters.org

Next I cleaned up the remaining tests on Driver::DBI the only one that gave me any trouble was 20_where_basic.t when I got

Can't locate object method "_view_sql" via package "Database::Accessor::Driver::DBI" at GitHub\database-accessor-driver-dbi\lib/Database/Accessor/Driver/DBI.pm line 381.

so I guess I missed one function rename from the other day. A quick fix for that;


    my $delete_clause    = join(" ",Database::Accessor::Driver::DBI::SQL::DELETE
                                   ,Database::Accessor::Driver::DBI::SQL::FROM
--                                   ,$self->_view_sql($self->view));
++                                   ,$self->_table_sql($self->view));

and the test all passed.

The finaly little clean up for today was I still had a few subs named for Database::Accessor classes rather than SQL so I swapped out '_element_sql' and '_elements_sql' for '_field_sql' and '_fields_sql' and all my test still passed.

Now the only outstanding thing it to have a look at Database::Accessor and fix the places where 'elements' are passed down to a DAD that do not have the view inherited as I am still getting the odd
fail on the SQL in the places where I am missing the view on an 'Element' but that is another post.

Now that I have all the base code done for Driver::DBI I think it is time I grow up into a mature Moose.

HPIM5490a.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