Skip Menu |

This queue is for tickets about the DBIx-Simple CPAN distribution.

Report information
The Basics
Id: 19050
Status: rejected
Priority: 0/
Queue: DBIx-Simple

People
Owner: Nobody in particular
Requestors: tomitank [...] gmail.com
Cc:
AdminCc:

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



Subject: More catchy connecting interface
Hi. How about this new connect() interface. DBIx::Simple->connect({ driver => 'mysql', database => 'test', username => 'foo', password => 'boo', options => { RaiseError => 1, } }); If connect() distinguish the type of the args (hashref or array). I think DBIx::Simple is more catchy! my quick hack sub connect { my ($class, @arguments) = @_; my $self = { lc_columns => 1 }; if (defined $arguments[0] and UNIVERSAL::isa($arguments[0], 'DBI::db')) { $self->{dbh} = shift @arguments; Carp::carp("Additional arguments for $class->connect are ignored") if @arguments; } elsif (ref $arguments[0] eq 'HASH') { $arguments[0]{options}{PrintError} ||= 0; $arguments[0]{dsn} = sprintf 'dbi:%s:%s' , $arguments[0]{driver} || '' , $arguments[0]{database} || ''; $self->{dbh} = DBI->connect( $arguments[0]{dsn}, $arguments[0]{username}, $arguments[0]{password}, $arguments[0]{options}, ); } else { $arguments[3]->{PrintError} = 0 unless defined $arguments[3] and defined $arguments[3]{PrintError}; $self->{dbh} = DBI->connect(@arguments); } ...
Hi, A long time ago you requested a catchier connect method interface for DBIx::Simple. I'm refusing the request, because there is consistency in the DSN between all existing databases, and I wish to keep the amount of database driver specific code to an absolute minimum. Should I ever implement a better interface, then it will be URL based like PHP's PEAR DSNs. Thanks for requesting, though, -- Juerd
From: tomita [...] cpan.org
Agreed. You're right. Thanks for reply. -- Tomi
From: tomita [...] cpan.org
Opps, I changed status. Sorry. -- Tomi