evdb: Edmund von der Burg <evdb@ecclestoad.co.uk>
faxm0dem: Fabien Wernli <cpan@faxm0dem.org>
felliott: Fitz Elliott <fitz.elliott@gmail.com>
+fgabolde: Fabrice Gabolde <fgabolde@weborama.com>
freetime: Bill Moseley <moseley@hank.org>
frew: Arthur Axel "fREW" Schmidt <frioux@gmail.com>
gbjk: Gareth Kirwan <gbjk@thermeon.com>
Revision history for DBIx::Class
* Fixes
+ - Fix parsing of DSNs containing driver arguments (GH#99)
- Work around unreliable $sth->finish() on INSERT ... RETURNING within
DBD::Firebird on some compiler/driver combinations (RT#110979)
- Fix leaktest failures with upcoming version of Sub::Quote
# try to use dsn to not require being connected, the driver may still
# force a connection later in _rebless to determine version
# (dsn may not be supplied at all if all we do is make a mock-schema)
- ($drv) = ($self->_dbi_connect_info->[0] || '') =~ /^dbi:([^:]+):/i;
+ #
+ # Use the same regex as the one used by DBI itself (even if the use of
+ # \w is odd given unicode):
+ # https://metacpan.org/source/TIMB/DBI-1.634/DBI.pm#L621
+ #
+ # DO NOT use https://metacpan.org/source/TIMB/DBI-1.634/DBI.pm#L559-566
+ # as there is a long-standing precedent of not loading DBI.pm until the
+ # very moment we are actually connecting
+ #
+ ($drv) = ($self->_dbi_connect_info->[0] || '') =~ /^dbi:(\w*)/i;
$drv ||= $ENV{DBI_DRIVER};
}
and
ref($_[0]) ne 'CODE'
and
- ($_[0]||'') !~ /^ (?i:dbi) \: SQLite \: (?: dbname\= )? (?: \:memory\: | t [\/\\] var [\/\\] DBIxClass\-) /x
+ ($_[0]||'') !~ /^ (?i:dbi) \: SQLite (?: \: | \W ) .*? (?: dbname\= )? (?: \:memory\: | t [\/\\] var [\/\\] DBIxClass\-) /x
) {
my $locktype;
lives_ok { count_sheep($schema) } 'SQLite passed to connect_info';
isa_ok $schema->storage, 'DBIx::Class::Storage::DBI::SQLite';
+$schema = DBICTest::Schema->connect("dbi:SQLite(ReadOnly=1):$dbname");
+lives_ok { count_sheep($schema) } 'SQLite passed to connect_info despite extra arguments present';
+isa_ok $schema->storage, 'DBIx::Class::Storage::DBI::SQLite';
+
$ENV{DBI_DRIVER} = 'SQLite';
$schema = DBICTest::Schema->connect("dbi::$dbname");
lives_ok { count_sheep($schema) } 'SQLite in DBI_DRIVER';