mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
resolved #61117
This commit is contained in:
parent
1606ea9341
commit
8288de83e8
2 changed files with 16 additions and 2 deletions
|
@ -91,7 +91,7 @@ sub connect {
|
||||||
if ( $dbname =~ /=/ ) {
|
if ( $dbname =~ /=/ ) {
|
||||||
foreach my $attrib ( split(/;/, $dbname) ) {
|
foreach my $attrib ( split(/;/, $dbname) ) {
|
||||||
my ($key, $value) = split(/=/, $attrib, 2);
|
my ($key, $value) = split(/=/, $attrib, 2);
|
||||||
if ( $key eq 'dbname' ) {
|
if ( $key =~ /^(?:db(?:name)?|database)$/ ) {
|
||||||
$real = $value;
|
$real = $value;
|
||||||
} else {
|
} else {
|
||||||
$attr->{$key} = $value;
|
$attr->{$key} = $value;
|
||||||
|
|
16
t/02_logon.t
16
t/02_logon.t
|
@ -12,7 +12,7 @@ use t::lib::Test qw/connect_ok @CALL_FUNCS/;
|
||||||
use Test::More;
|
use Test::More;
|
||||||
use Test::NoWarnings;
|
use Test::NoWarnings;
|
||||||
|
|
||||||
plan tests => 9 * @CALL_FUNCS + 1;
|
plan tests => 18 * @CALL_FUNCS + 1;
|
||||||
|
|
||||||
my $show_diag = 0;
|
my $show_diag = 0;
|
||||||
foreach my $call_func (@CALL_FUNCS) {
|
foreach my $call_func (@CALL_FUNCS) {
|
||||||
|
@ -41,6 +41,20 @@ foreach my $call_func (@CALL_FUNCS) {
|
||||||
unlink $file;
|
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
|
# Connect to a memory database
|
||||||
SCOPE: {
|
SCOPE: {
|
||||||
my $dbh = DBI->connect( 'dbi:SQLite:dbname=:memory:', '', '' );
|
my $dbh = DBI->connect( 'dbi:SQLite:dbname=:memory:', '', '' );
|
||||||
|
|
Loading…
Add table
Reference in a new issue