Re: [PHP-PEAR] parseDSN ... again

[email protected] ((Stig Sæther Bakken)) 11 Mar 2001 09:06:44 +0100
Newsgroups php.pear,php.pear.dev
Message-ID <[email protected]>
[Jon Parise <[email protected]>]
> On Sat, Mar 10, 2001 at 05:26:52PM -0500, Jon Parise wrote:
> 
> > It looks good to me.  Unless anyone has any other comments, I'll
> > commit it to cvs some time tomorrow.
> 
> Attached is the patch that I will commit tomorrow (Sunday), if no one
> objects.  I reformatted Tomas' original code slightly so that it
> conforms to the PEAR coding standards.
> 
> If you have a free moment, please apply the attached patch to ensure
> that it doesn't break existing code.

Well, a good way to test if it breaks anything is to run "make test
TESTS=pear/DB/tests".  The db_parsedsn test fails and here's the diff
between the expected and actual output:

--- DB/tests/db_parsedsn.exp	Sun Mar 11 08:42:19 2001
+++ DB/tests/db_parsedsn.out	Sun Mar 11 08:42:19 2001
@@ -1,9 +1,9 @@
 testing DB::parseDSN...
 mysql,,,,,,
 odbc,mssql,,,,,
-mysql,mysql,,localhost,,,
-mysql,mysql,,remote.host.com,db,,
-mysql,mysql,,,,testuser,testpw
-oci8,oci8,,tns-name,,user,pass
-odbc,solid,tcp,localhost 1313,,foo,bar
-ibase,ibase,,database,,user@domain,password
+mysql,,,localhost,,,
+mysql,,,remote.host.com,db,,
+mysql,,,testuser:testpw,,,
+oci8,,,tns-name,,user,pass
+odbc,solid,tcp,localhost+1313,,foo,bar
+ibase,,,database,,user%40domain,password

The new version doesn't have a default for "dbsyntax", which is fine
(the backends set it themselves).  It breaks the url encoding though.

Thomax Cox wrote:

> - Removed urldecode(), for not disturbing '+' chars. Users must manual
> decode what they need.

Thomas, when is the url encoding a problem?  It was added to allow
people to specify dsn delimiter characters in usernames and passwords.

 - Stig

-- 
  Stig Sæther Bakken <[email protected]>
  Fast Search & Transfer ASA, Trondheim, Norway