1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00
This commit is contained in:
Kenichi Ishigaki 2010-09-16 07:28:06 +00:00
parent 1606ea9341
commit 8288de83e8
2 changed files with 16 additions and 2 deletions

View file

@ -91,7 +91,7 @@ sub connect {
if ( $dbname =~ /=/ ) {
foreach my $attrib ( split(/;/, $dbname) ) {
my ($key, $value) = split(/=/, $attrib, 2);
if ( $key eq 'dbname' ) {
if ( $key =~ /^(?:db(?:name)?|database)$/ ) {
$real = $value;
} else {
$attr->{$key} = $value;

View file

@ -12,7 +12,7 @@ use t::lib::Test qw/connect_ok @CALL_FUNCS/;
use Test::More;
use Test::NoWarnings;
plan tests => 9 * @CALL_FUNCS + 1;
plan tests => 18 * @CALL_FUNCS + 1;
my $show_diag = 0;
foreach my $call_func (@CALL_FUNCS) {
@ -41,6 +41,20 @@ foreach my $call_func (@CALL_FUNCS) {
unlink $file;
}
# dbname, db, database
SCOPE: {
for my $key (qw/database db dbname/) {
my $file = 'foo'.$$;
unlink $file if -f $file;
ok !-f $file, 'database file does not exist';
my $dbh = DBI->connect("dbi:SQLite:$key=$file");
isa_ok( $dbh, 'DBI::db' );
ok -f $file, "database file (specified by $key=$file) now exists";
$dbh->disconnect;
unlink $file;
}
}
# Connect to a memory database
SCOPE: {
my $dbh = DBI->connect( 'dbi:SQLite:dbname=:memory:', '', '' );