Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] user/pass in DSN #87

Open
Tux opened this issue Aug 28, 2019 · 0 comments
Open

[feature request] user/pass in DSN #87

Tux opened this issue Aug 28, 2019 · 0 comments

Comments

@Tux
Copy link
Member

Tux commented Aug 28, 2019

See perl5-dbi/DBD-MariaDB#147

DBI->connect ($dsn, $user, $pass, $options) clearly splits the DSN and the credentials.

I'd like to see several thing "changed"

== Unification in parameter-names in the DSN ==

I have seen dbi:Xx:database=... (mysql, MariaDB), dbname=... (Pg, SQLite), db=... (Firebird), sid=... (Oracle), dbi:Xx://host:port/Foo, and f_dir=/foo (CSV) in the DSN and also plain dbi:Xx: where the database is specified in $options or environment variables (think $TWO_TASK for Oracle or $USCHEMA in Unify). Likewise for host=... vs server=.... The worst imho is an embedded DSN inside the DSN as DBD::ODBC documents: dbi:ODBC:DSN=mydsn.

The most obvious common name would be database.

== Allow User/Pass in DSN ==

Having connections stored as key-values somewhere for testing, or extending a dynamic DSN based on testing configurations would simplify testing a lot. I'd like top-level support for

 my $dsn = "dbi:Xx:dbname=foo";
 DBI->connect ($dsn, $user, $pass, ...);

to be equivalent with

 my $dsn = "dbi:Xx:dbname=foo;user=tester;pass=secrit";
 DBI->connect ($dsn, undef, undef, ...);

where the connect will extract any of user=..., dbuser=..., pass=..., dbpass=..., password=...from the DSN and put them at the spots for$userand$pass, which would default to $ENV{DBI_USER}and$ENV{DBI{PASS}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant