File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
tests/Doctrine/Tests/DBAL/Driver Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,11 @@ pdo\_oci / oci8
295295- ``instancename `` (string): Optional parameter, complete whether to
296296 add the INSTANCE_NAME parameter in the connection. It is generally used
297297 to connect to an Oracle RAC server to select the name of a particular instance.
298-
298+ - ``connectstring `` (string): Complete Easy Connect connection descriptor,
299+ see https://docs.oracle.com/database/121/NETAG/naming.htm. When using this option,
300+ you will still need to provide the ``user `` and ``password `` parameters, but the other
301+ parameters will no longer be used. Note that when using this parameter, the ``getHost ``
302+ and ``getPort `` methods from ``Doctrine\DBAL\Connection `` will no longer function as expected.
299303
300304pdo\_ sqlsrv / sqlsrv
301305^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -109,10 +109,14 @@ public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
109109 *
110110 * @return string
111111 *
112- * @link http ://download .oracle.com/docs/cd/E11882_01/network.112/e10836 /naming.htm
112+ * @link https ://docs .oracle.com/database/121/NETAG /naming.htm
113113 */
114114 protected function getEasyConnectString (array $ params )
115115 {
116+ if ( ! empty ($ params ['connectstring ' ])) {
117+ return $ params ['connectstring ' ];
118+ }
119+
116120 if ( ! empty ($ params ['host ' ])) {
117121 if ( ! isset ($ params ['port ' ])) {
118122 $ params ['port ' ] = 1521 ;
Original file line number Diff line number Diff line change @@ -25,6 +25,25 @@ public function testReturnsDatabaseName()
2525 $ this ->assertSame ($ params ['user ' ], $ this ->driver ->getDatabase ($ connection ));
2626 }
2727
28+ public function testReturnsDatabaseNameWithConnectDescriptor ()
29+ {
30+ $ params = array (
31+ 'user ' => 'foo ' ,
32+ 'password ' => 'bar ' ,
33+ 'connectionstring ' => '(DESCRIPTION= ' .
34+ '(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)) ' .
35+ '(CONNECT_DATA=(SERVICE_NAME=baz))) '
36+ );
37+
38+ $ connection = $ this ->getConnectionMock ();
39+
40+ $ connection ->expects ($ this ->once ())
41+ ->method ('getParams ' )
42+ ->will ($ this ->returnValue ($ params ));
43+
44+ $ this ->assertSame ($ params ['user ' ], $ this ->driver ->getDatabase ($ connection ));
45+ }
46+
2847 protected function createDriver ()
2948 {
3049 return $ this ->getMockForAbstractClass ('Doctrine\DBAL\Driver\AbstractOracleDriver ' );
You can’t perform that action at this time.
0 commit comments