On Tue, Nov 30, 2004 at 09:38:47PM +0000, Nicholas Clark wrote:
> On Tue, Nov 30, 2004 at 08:53:51PM +0000, Tim Bunce wrote:
>
> > I don't get it. Can someone give me some small but real examples
> > of the problem that's being solved here?
>
> The one that I've hit - specifying port and host, Pg vs Mysql (and SQlite):
>
> if ($dbspec->{driver} eq 'DBI:Pg') {
> # Aaargh. Why aren't these things standarised?
> $dsn = "DBI:Pg:host=$dbspec->{domain}";
> # Aargh. W.T.F. is this case sensitivity here? It fails to connect unless
> # the name is all lowercase (as is stored within the non-case preserving
> # pg DB)
> $dsn .= lc ";dbname=$dbspec->{db_name}" if length $dbspec->{db_name};
> $dsn .= ";port=$dbspec->{port}" if defined $dbspec->{port};
> } else {
> $dsn .= ":port=$dbspec->{port}" if defined $dbspec->{port};
> }
It seems to me that the problem is of your own making.
Why have separate hash elements for all these things in the first place?
Tim.