cvs: pear /DB DB.php /DB/tests db_parsedsn.phpt
| From: | Tomas V.V.Cox | Date: | Wed, 22 May 2002 12:57:10 +0000 |
| Subject: | cvs: pear /DB DB.php /DB/tests db_parsedsn.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4039@lists.php.net to get a copy of this message | ||
cox Wed May 22 08:57:10 2002 EDT
Modified files:
/pear/DB DB.php
/pear/DB/tests db_parsedsn.phpt
Log:
Fix parseDSN() to not confuse an Oracle TSN with the protocol
Test updated
Index: pear/DB/DB.php
diff -u pear/DB/DB.php:1.4 pear/DB/DB.php:1.5
--- pear/DB/DB.php:1.4 Wed May 22 08:54:30 2002
+++ pear/DB/DB.php Wed May 22 08:57:10 2002
@@ -17,7 +17,7 @@
// | Tomas V.V.Cox <cox@idecnet.com> |
// +----------------------------------------------------------------------+
//
-// $Id: DB.php,v 1.4 2002/05/22 12:54:30 cox Exp $
+// $Id: DB.php,v 1.5 2002/05/22 12:57:10 cox Exp $
//
// Database independent query interface.
//
@@ -504,7 +504,7 @@
// Find protocol and hostspec
// $dsn => proto(proto_opts)/database
- if (preg_match('|^(.+?)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
+ if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
$proto = $match[1];
$proto_opts = (!empty($match[2])) ? $match[2] : false;
$dsn = $match[3];
Index: pear/DB/tests/db_parsedsn.phpt
diff -u pear/DB/tests/db_parsedsn.phpt:1.4 pear/DB/tests/db_parsedsn.phpt:1.5
--- pear/DB/tests/db_parsedsn.phpt:1.4 Wed May 22 06:48:15 2002
+++ pear/DB/tests/db_parsedsn.phpt Wed May 22 08:57:10 2002
@@ -28,6 +28,7 @@
test("ibase://user@domain:pass@word@/database"); // also supported
test("ifx://user@domain:pass@word@host.com//usr/db/general.db");
test('ifx://remote.host.com/c:\windows\my.db');
+test('oci8://SHOOTOUT:******@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.161)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TIS)))');
// new formats
test("odbc(solid)://foo:bar@localhost:1313");
@@ -201,6 +202,19 @@
[port] =>
[socket] =>
[database] => c:\windows\my.db
+)
+DSN:
oci8://SHOOTOUT:******@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.161)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TIS)))
+Array
+(
+ [phptype] => oci8
+ [dbsyntax] => oci8
+ [username] => SHOOTOUT
+ [password] => ******
+ [protocol] => tcp
+ [hostspec] =>
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.161)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TIS)))
+ [port] =>
+ [socket] =>
+ [database] =>
)
DSN: odbc(solid)://foo:bar@localhost:1313
Array