# 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;
+
+ # be careful when parsing DSNs that the driver name may include
+ # DBI attributes, e.g. "mysql(Username=bob)"
+ ($drv) = ($self->_dbi_connect_info->[0] || '') =~ /^dbi:([^:(]+)[:(]/i;
$drv ||= $ENV{DBI_DRIVER};
}
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';