1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-08 22:58:17 -04:00

applied a patch by mjp++ (rt96494)

This commit is contained in:
Kenichi Ishigaki 2014-06-17 15:07:33 +09:00
parent 938f22eb6c
commit 3ccab507a6
2 changed files with 29 additions and 5 deletions

View file

@ -315,7 +315,8 @@ SELECT NULL TABLE_CAT
FROM ( FROM (
SELECT 'TABLE' tt UNION SELECT 'TABLE' tt UNION
SELECT 'VIEW' tt UNION SELECT 'VIEW' tt UNION
SELECT 'LOCAL TEMPORARY' tt SELECT 'LOCAL TEMPORARY' tt UNION
SELECT 'SYSTEM TABLE' tt
) t ) t
ORDER BY TABLE_TYPE ORDER BY TABLE_TYPE
END_SQL END_SQL

View file

@ -7,9 +7,13 @@ BEGIN {
} }
use t::lib::Test; use t::lib::Test;
use Test::More tests => 18; use Test::More tests => 22;
use Test::NoWarnings; use Test::NoWarnings;
my @catalog_info = (
[undef, undef, undef, undef, undef],
);
my @schema_info = ( my @schema_info = (
[undef, 'main', undef, undef, undef], [undef, 'main', undef, undef, undef],
[undef, 'temp', undef, undef, undef] [undef, 'temp', undef, undef, undef]
@ -19,15 +23,34 @@ my @systable_info = (
[undef, 'temp', 'sqlite_temp_master', 'SYSTEM TABLE', undef, undef] [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 # Create a database
my $dbh = connect_ok(); my $dbh = connect_ok();
# Check avalable schemas # Check available catalogs
my $sth = $dbh->table_info('', '%', ''); my $sth = $dbh->table_info('%', '', '');
ok $sth, 'We can get table/schema information'; ok $sth, 'We can get catalog information';
my $info = $sth->fetchall_arrayref; 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'; 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 # Create a table
ok( $dbh->do(<<'END_SQL'), 'CREATE TABLE one' ); ok( $dbh->do(<<'END_SQL'), 'CREATE TABLE one' );
CREATE TABLE one ( CREATE TABLE one (