diff --git a/lib/DBD/SQLite.pm b/lib/DBD/SQLite.pm index ab45627..b1e7ea6 100644 --- a/lib/DBD/SQLite.pm +++ b/lib/DBD/SQLite.pm @@ -315,7 +315,8 @@ SELECT NULL TABLE_CAT 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 --git a/t/35_table_info.t b/t/35_table_info.t index f92c1db..a47cdf1 100644 --- a/t/35_table_info.t +++ b/t/35_table_info.t @@ -7,9 +7,13 @@ BEGIN { } 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 @@ my @systable_info = ( [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 (