Just a Little Moose

Just another test post-ette today at the Moose-pen

Will 100% pass the result from yesterdays post I wanted to see if I could get Driver::DBI at least close to that but things did not start that well;


t/00_load.t ......... 1/3 Attribute (elements) is required at /usr/local/lib/perl/5.18.2/Class/MOP/Method/Wrapped.pm line 164# Looks like your test exited with 255 just after 2.
t/00_load.t ......... Dubious, test returned 25

my basic load test was failing fortunately I think this is just missing an 'elements' attribute so I added those in where needed in a few test cases and on my next run that cleaned up a number of little things but this test case

10_crud_basic.t

was still in very poor shape;

# Looks like you failed 10 tests of 17.
not ok 1 - Create function
not ok 2 - One row effected
not ok 3 - Update function
not ok 4 - one row effected
ok 5 - retrieve function
ok 6 - One row returned
not ok 7 - address changed
ok 8 - delete function
ok 9 - One row Deleted
ok 10 - retrieve function
ok 11 - one row in DB
not ok 12 - Execute Array add 4
not ok 13 - Execute Array failed
not ok 14 - update with present container
not ok 15 - update array on where param
not ok 16 - update hash container with an array
ok 17 - retrieve function

The 'Create' error was a little tricky to track down as this is the SQL

INSERT INTO user ( address, username ) VALUES( ?, ? )

and you might remember I dropped the 'view/table' names from the 'insert' and 'update' calls as many DBS will fail if they are there. What we are seeing here is an anomaly of the little built in DB I am using.

The creation code for the table in questions is


CREATE TABLE user ( user.username TEXT, user.address TEXT)
and the little db engine sees the filed name as 'user.address' not address; I give this little change a try;

sub create_users_table {
  my $self = shift;
  my @sql = ("DROP TABLE IF EXISTS user",
--             "CREATE TABLE user ( user.username TEXT, user.address TEXT)",
++             "CREATE TABLE user ( username TEXT, address TEXT)",
--             "INSERT INTO user VALUES ( 'user.user1',  1)");
++             "INSERT INTO user VALUES ( 'user1',  1)");             
  $self->do_sql(@sql); 
}
in my 'Test::Utils' class and then came up with this test case run;

# Looks like you failed 12 tests of 17.
ok 1 - Create function
ok 2 - One row effected
not ok 3 - Update function
not ok 4 - one row effected
not ok 5 - retrieve function
not ok 6 - One row returned
not ok 7 - No Result set->[0]->[1]
not ok 8 - delete function
not ok 9 - One row Deleted
not ok 10 - retrieve function
not ok 11 - No Result set
ok 12 - Execute Array add 4
ok 13 - Four records added
not ok 14 - update with present container
not ok 15 - update array on where param
not ok 16 - update hash container with an array
ok 17 - retrieve function
which I sort of expected I fixed two problems but created six more. Oh well something for tomorrow's post.

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