Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-DBIx-Class-Schema CPAN distribution.

Report information
The Basics
Id: 79640
Status: open
Priority: 0/
Queue: Test-DBIx-Class-Schema

People
Owner: Nobody in particular
Requestors: STEVENL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.01002
Fixed in: (no value)



Subject: connection options
There is no option to supply database connection options. my $schematest = Test::DBIx::Class::Schema->new({ dsn => 'dbi:Pg:dbname=mydb', namespace => 'MyDB::Schema', moniker => 'SomeTable', username => 'some_user', password => 'opensesame', options => { quote_char => '"', }, test_missing => 1, }); I am not able to use my schema unless I can supply these optional parameters.
On Fri Sep 14 06:46:29 2012, STEVENL wrote: Show quoted text
> There is no option to supply database connection options. >
I should probably extend the class to do this natively. At $ork we use TDCS and have a similar issue. The approach here is slightly different: package SchemaTest; use Test::DBIx::Class::Schema 0.01013; use base 'Test::DBIx::Class::Schema'; use Test::More; use FooBar::Database; sub new { my ($proto, $options) = @_; if (exists $options->{dsn_from}) { my $params = FooBar::Database::db_connect_params( { name => $options->{dsn_from}, } ); $options->{dsn} = FooBar::Database::_connection_string( $params ); $options->{username} = $params->{db_user} || undef; $options->{password} = $params->{db_pass} || undef; $options->{test_missing} = defined $options->{fail_on_missing} ? delete $options->{fail_on_missing} : 1; } my $self = Test::DBIx::Class::Schema::new($proto, $options); return $self; } 1; Yeah, I know, horrible ... it's worked so long I've never needed to revisit this.