Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

list_tables / table_info failures ...

17 views
Skip to first unread message

Jens Rehsack

unread,
Oct 5, 2012, 9:54:31 AM10/5/12
to H.Merijn Brand, DBI Developers Mailing List
Hi Merijn,

We have to think about both tests ...

t/49dbd_file.t .................. 1/?
# Failed test 'Listing tables gives test table'
# at t/49dbd_file.t line 126.
# Structures begin differing at:
# $got->[0] = 'db_25542_'
# $expected->[0] = '000_just_testing'

# Failed test 'table_info gives test table'
# at t/49dbd_file.t line 130.
# Structures begin differing at:
# $got->[0][0][2] = 'db_25542_'
# $expected->[0][0][2] = '000_just_testing'
# Looks like you failed 2 tests of 43.
t/49dbd_file.t .................. Dubious, test returned 2 (wstat 512,
0x200)
Failed 2/43 subtests

The order is vice versa than expected.

But is early enough when your back! Just keeping it in mind (we both!).

/Jens

H.Merijn Brand

unread,
Oct 5, 2012, 10:48:12 AM10/5/12
to dbi...@perl.org
On Fri, 05 Oct 2012 15:54:31 +0200, Jens Rehsack
<reh...@googlemail.com> wrote:

> Hi Merijn,
>
> We have to think about both tests ...

my @tables = $dbh->func( "list_tables" );
is_deeply( \@tables, ["000_just_testing", $tbl], "Listing tables gives test table" );

=>

my @tables = sort $dbh->func ("list_tables");
is_deeply (\@tables, [sort "000_just_testing", $tbl], "Listing tables gives test table");

why can't we make list_tables return always sorted?
--
H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/
using perl5.00307 .. 5.17 porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/
http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/

H.Merijn Brand

unread,
Oct 5, 2012, 11:03:43 AM10/5/12
to Jens Rehsack, DBI Developers Mailing List
On Fri, 05 Oct 2012 15:54:31 +0200, Jens Rehsack
<reh...@googlemail.com> wrote:

> Hi Merijn,
>
> We have to think about both tests ...

Here ya go …
--8<---
diff --git a/t/49dbd_file.t b/t/49dbd_file.t
index 4bae4bd..61f75ea 100644
--- a/t/49dbd_file.t
+++ b/t/49dbd_file.t
@@ -99,7 +99,7 @@ SKIP: {
my @tfhl;

# Now test some basic SQL statements
-my $tbl_file = File::Spec->catfile (Cwd::abs_path( $dir ), "$tbl.txt");
+my $tbl_file = File::Spec->catfile (Cwd::abs_path ($dir), "$tbl.txt");
ok ($dbh->do ("create table $tbl (txt varchar (20))"), "Create table $tbl") or diag $dbh->errstr;
ok (-f $tbl_file, "Test table exists");

@@ -122,12 +122,12 @@ is_deeply ($dbh->f_get_meta ([$tbl, "t_sbdgf_53442Gz"], [qw(f_dir f_ext)]),
my @layer = grep { $_ eq "encoding($encoding)" } @tfhl;
is (scalar @layer, 1, "encoding shows in layer");

-my @tables = $dbh->func( "list_tables" );
-is_deeply( \@tables, ["000_just_testing", $tbl], "Listing tables gives test table" );
+my @tables = sort $dbh->func ("list_tables");
+is_deeply (\@tables, [sort "000_just_testing", $tbl], "Listing tables gives test table");

-ok ($sth = $dbh->table_info(), "table_info");
-@tables = $sth->fetchall_arrayref;
-is_deeply( \@tables, [ [ map { [ undef, undef, $_, 'TABLE', 'FILE' ] } ("000_just_testing", $tbl) ] ], "table_info gives test table" );
+ok ($sth = $dbh->table_info (), "table_info");
+@tables = sort { $a->[2] cmp $b->[2] } @{$sth->fetchall_arrayref};
+is_deeply (\@tables, [ map { [ undef, undef, $_, 'TABLE', 'FILE' ] } "000_just_testing", $tbl ], "table_info gives test table");

SKIP: {
$using_dbd_gofer and skip "modifying meta data doesn't work with Gofer-AutoProxy", 4;
@@ -145,7 +145,7 @@ SKIP: {
$dbh->errstr and diag $dbh->errstr;
}

-my $uctbl = uc($tbl);
+my $uctbl = uc ($tbl);
ok ($sth = $dbh->prepare ("select * from $uctbl"), "Prepare select * from $uctbl");
$rowidx = 0;
SKIP: {
-->8---

All tests successful.
Files=183, Tests=10373, 63 wallclock secs ( 1.58 usr 0.32 sys + 51.42 cusr 5.10 csys = 58.42 CPU)
Result: PASS
PERL_DL_NONLAZY=1 /pro/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
test.pl
DBI test application $Revision$
Switch: DBI 1.623 by Tim Bunce, 1.623
Available Drivers: AnyData, CSV, DBM, ExampleP, File, Gofer, Multiplex, ODBC, Oracle, Pg, Proxy, SQLite, Sponge, iPod, mysql
dbi:ExampleP:: testing 3 sets of 20 connections:
Connecting... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Disconnecting...
Connecting... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Disconnecting...
Connecting... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Disconnecting...
connect 20 and disconnect them, 3 times: 0.0019s / 60 = 0.0000s
Testing handle creation speed...
125000 NullP sth/s perl 5.016000 i686-linux-64int-ld (gcc 4.6.2 -O2) 0.000008s

test.pl done

Jens Rehsack

unread,
Oct 5, 2012, 12:54:40 PM10/5/12
to H.Merijn Brand, dbi...@perl.org
2012/10/5 H.Merijn Brand <h.m....@xs4all.nl>:
> On Fri, 05 Oct 2012 15:54:31 +0200, Jens Rehsack
> <reh...@googlemail.com> wrote:
>
>> Hi Merijn,
>>
>> We have to think about both tests ...
>
> my @tables = $dbh->func( "list_tables" );
> is_deeply( \@tables, ["000_just_testing", $tbl], "Listing tables gives test table" );
>
> =>
>
> my @tables = sort $dbh->func ("list_tables");
> is_deeply (\@tables, [sort "000_just_testing", $tbl], "Listing tables gives test table");

Looks good, but will not work for DBD::Sponge result from table_info :(

> why can't we make list_tables return always sorted?

Probably we can - but it costs time and no one did it (even I never
thought about).
0 new messages