Changeset 148
- Timestamp:
- 02/05/09 19:27:46 (10 months ago)
- Files:
-
- 1 modified
-
branches/use-existing-dbh/lib/TheSchwartz.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/use-existing-dbh/lib/TheSchwartz.pm
r142 r148 61 61 my($list) = @_; 62 62 for my $ref (@$list) { 63 my $full = join '|', map { $ref->{$_} || '' } qw( dsn user pass );63 my $full = ($ref->{dbh}) ? rand().time().{}.$$ : join '|', map { $ref->{$_} || '' } qw( dsn user pass ); 64 64 $client->{databases}{ md5_hex($full) } = $ref; 65 65 } … … 77 77 my $db = $client->{databases}{$hashdsn} 78 78 or croak "Ouch, I don't know about a database whose hash is $hashdsn"; 79 my %p = ($db->{dbh}) ? 80 ( dbd => $db->{dbh} ) : 81 ( 82 dsn => $db->{dsn}, 83 username => $db->{user}, 84 password => $db->{pass}, 85 ); 79 86 $driver = Data::ObjectDriver::Driver::DBI->new( 80 dsn => $db->{dsn}, 81 username => $db->{user}, 82 password => $db->{pass}, 87 %p, 83 88 ($db->{prefix} ? (prefix => $db->{prefix}) : ()), 84 89 );
