1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/usr/bin/env perl
use Test::Roo;
use DBI;
use DBIx::Introspector;
has [qw(
dsn user password rdbms_engine
connected_introspector_driver unconnected_introspector_driver
)] => ( is => 'ro' );
test basic => sub {
my $self = shift;
my $d = DBIx::Introspector->new( drivers => '2013-12.01' );
is(
$d->get(undef, $self->dsn, '_introspector_driver'),
$self->unconnected_introspector_driver,
'unconnected introspector driver'
);
my $dbh = DBI->connect($self->dsn, $self->user, $self->password);
is(
$d->get($dbh, $self->dsn, '_introspector_driver'),
$self->connected_introspector_driver,
'connected introspector driver'
);
};
run_me(SQLite => {
connected_introspector_driver => 'SQLite',
unconnected_introspector_driver => 'SQLite',
dsn => 'dbi:SQLite::memory:',
});
run_me('ODBC SQL Server', {
dsn => $ENV{DBIITEST_ODBC_MSSQL_DSN},
user => $ENV{DBIITEST_ODBC_MSSQL_USER},
password => $ENV{DBIITEST_ODBC_MSSQL_PASSWORD},
connected_introspector_driver => 'ODBC_Microsoft_SQL_Server',
unconnected_introspector_driver => 'ODBC',
}) if $ENV{DBIITEST_ODBC_MSSQL_DSN};
run_me(Pg => {
dsn => $ENV{DBIITEST_PG_DSN},
user => $ENV{DBIITEST_PG_USER},
password => $ENV{DBIITEST_PG_PASSWORD},
connected_introspector_driver => 'Pg',
unconnected_introspector_driver => 'Pg',
}) if $ENV{DBIITEST_PG_DSN};
run_me(mysql => {
dsn => $ENV{DBIITEST_MYSQL_DSN},
user => $ENV{DBIITEST_MYSQL_USER},
password => $ENV{DBIITEST_MYSQL_PASSWORD},
connected_introspector_driver => 'mysql',
unconnected_introspector_driver => 'mysql',
}) if $ENV{DBIITEST_MYSQL_DSN};
done_testing;
|