From 8288de83e89a99959b66a1851a8a4b5e3795505f Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Thu, 16 Sep 2010 07:28:06 +0000 Subject: [PATCH] resolved #61117 --- lib/DBD/SQLite.pm | 2 +- t/02_logon.t | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/DBD/SQLite.pm b/lib/DBD/SQLite.pm index 8c177aa..6450447 100644 --- a/lib/DBD/SQLite.pm +++ b/lib/DBD/SQLite.pm @@ -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; diff --git a/t/02_logon.t b/t/02_logon.t index 3061514..a8c607d 100644 --- a/t/02_logon.t +++ b/t/02_logon.t @@ -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:', '', '' );