parseDSN rewrite
| From: | Tomas V.V.Cox | Date: | Thu, 01 Mar 2001 16:17:05 +0000 |
| Subject: | parseDSN rewrite | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-1516@lists.php.net to get a copy of this message | ||
Hello ppl,
Due the problems I had with the DB.php parseDSN method, I decided to
rewrite the function to make it work properly (attached in the msg). All
the dsn formats works good, but there are some considerations:
* Added a new permitted format: empty passwords:
phptype://username:@hostspec/database
* Added new possible formats in database, this is:
phptype://username:@hostspec/database -> database
phptype://username:@hostspec/usr/dbs/test.db -> /usr/dbs/test.db
phptype://username:@hostspec/c:\winpof\test.db -> c:\winpof\test.db
* At the start of the method I've putted:
$dsn=urldecode($dsn);
I think, we shouldn't modify o decode params, this is user stuff, but
ok, it's there.
Probably this function is faster than the original function, because it
mostly use string function rather than regex.
Perhaps that helps,
Tomas V.V.Cox