Skip Menu |

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 96494
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: mjp [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 1.43_03
Fixed in: (no value)



Subject: [PATCH] add SYSTEM TABLE to table_info() type list
DBD-SQLite-1.43_03 documents and understands SYSTEM TABLE objects. It is even a supported (and tested!) type filter argument. (Thanks for that, by the way. Several major DBDs don't get that right.) However, SYSTEM TABLE is _not_ among the supported types returned by `table_info('', '', '', '%')`, which is patently ambiguous. The attached patch adds SYSTEM TABLE to the types returned by a `table_info` type inquiry, a test case for all types, and also a test case for the dummy row returned by the `table_info` catalog inquiry.
Subject: dbd-sqlite-1.43_03-systables.patch
diff -ruN DBD-SQLite-1.43_03.orig/lib/DBD/SQLite.pm DBD-SQLite-1.43_03/lib/DBD/SQLite.pm --- DBD-SQLite-1.43_03.orig/lib/DBD/SQLite.pm 2014-06-11 23:59:58.000000000 -0500 +++ DBD-SQLite-1.43_03/lib/DBD/SQLite.pm 2014-06-17 00:28:29.000000000 -0500 @@ -315,7 +315,8 @@ FROM ( SELECT 'TABLE' tt UNION SELECT 'VIEW' tt UNION - SELECT 'LOCAL TEMPORARY' tt + SELECT 'LOCAL TEMPORARY' tt UNION + SELECT 'SYSTEM TABLE' tt ) t ORDER BY TABLE_TYPE END_SQL diff -ruN DBD-SQLite-1.43_03.orig/t/35_table_info.t DBD-SQLite-1.43_03/t/35_table_info.t --- DBD-SQLite-1.43_03.orig/t/35_table_info.t 2013-05-29 00:46:50.000000000 -0500 +++ DBD-SQLite-1.43_03/t/35_table_info.t 2014-06-17 00:30:48.000000000 -0500 @@ -7,9 +7,13 @@ } use t::lib::Test; -use Test::More tests => 18; +use Test::More tests => 22; use Test::NoWarnings; +my @catalog_info = ( + [undef, undef, undef, undef, undef], +); + my @schema_info = ( [undef, 'main', undef, undef, undef], [undef, 'temp', undef, undef, undef] @@ -19,15 +23,34 @@ [undef, 'temp', 'sqlite_temp_master', 'SYSTEM TABLE', undef, undef] ); +my @type_info = ( + [undef, undef, undef, 'LOCAL TEMPORARY', undef], + [undef, undef, undef, 'SYSTEM TABLE', undef], + [undef, undef, undef, 'TABLE', undef], + [undef, undef, undef, 'VIEW', undef], +); + # Create a database my $dbh = connect_ok(); -# Check avalable schemas -my $sth = $dbh->table_info('', '%', ''); -ok $sth, 'We can get table/schema information'; +# Check available catalogs +my $sth = $dbh->table_info('%', '', ''); +ok $sth, 'We can get catalog information'; my $info = $sth->fetchall_arrayref; +is_deeply $info, \@catalog_info, 'Correct catalog information'; + +# Check available schemas +$sth = $dbh->table_info('', '%', ''); +ok $sth, 'We can get table/schema information'; +$info = $sth->fetchall_arrayref; is_deeply $info, \@schema_info, 'Correct table/schema information'; +# Check supported types +$sth = $dbh->table_info('', '', '', '%'); +ok $sth, 'We can get type information'; +$info = $sth->fetchall_arrayref; +is_deeply $info, \@type_info, 'Correct table_info for type listing'; + # Create a table ok( $dbh->do(<<'END_SQL'), 'CREATE TABLE one' ); CREATE TABLE one (
Thanks. Applied in the master. https://github.com/DBD-SQLite/DBD-SQLite/commit/3ccab507a621bea9689082a3bf4ed8f6ce2ad17d On Tue Jun 17 14:49:39 2014, MJP wrote: Show quoted text
> DBD-SQLite-1.43_03 documents and understands SYSTEM TABLE objects. It > is even a supported (and tested!) type filter argument. (Thanks for > that, by the way. Several major DBDs don't get that right.) > > However, SYSTEM TABLE is _not_ among the supported types returned by > `table_info('', '', '', '%')`, which is patently ambiguous. The > attached patch adds SYSTEM TABLE to the types returned by a > `table_info` type inquiry, a test case for all types, and also a test > case for the dummy row returned by the `table_info` catalog inquiry.
Closed as 1.44 was released. Thanks.