[DDC-2264] Add support for custom Oracle SID / Service name in PDO_Oracle driver Created: 29/Jan/13 Updated: 29/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Michl Schmid | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | oracle | ||
| Description |
|
Some Oracle customer databases are set up having different settings for their "DBNAME" and "SID" / "SERVICE" property. (DBNAME != SID) So, hereing it's currently not possible to connect via the PDO_Oracle driver (Class: Doctrine\DBAL\Driver\PDOOracle\Driver) as it uses the DBNAME value by default as value for SID / SERVICE in the _constructPdoDsn() method. (DBNAME = SID) A solution would be to add an additional config param like "servicename" and pass it's value into _constructPdoDsn(). An updated version of the method could look like: private function _constructPdoDsn(array $params) if (isset($params['port'])) { $dsn .= '(PORT=' . $params['port'] . ')'; }else { $dsn .= '(PORT=1521)'; }if (isset($params['servicename']) && $params['servicename'] != '') { $servicename = $params['servicename']; }else { $servicename = $params['dbname']; }if (isset($params['service']) && $params['service'] == true) { $dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $servicename . ')))'; }else { $dsn .= '))(CONNECT_DATA=(SID=' . $servicename . ')))'; }} else { $dsn .= 'dbname=' . $params['dbname']; }if (isset($params['charset'])) { $dsn .= ';charset=' . $params['charset']; } return $dsn; The only workaround for me is right now to use the "standard" PHP OCI / OCI8 functions with the correct SID / Service in it's DSN. |
[DDC-1986] findBy hydration with limit and offset with Oracle database (oci8 driver) Created: 17/Aug/12 Updated: 08/Jan/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Benjamin Grandfond | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | oracle | ||
| Environment: |
composer.json require : "php": ">=5.3.3", |
||
| Description |
|
I tried to use the findBy method with limit and offset parameters against an Oracle database using oci8 driver. The query seems to executed successfully but the hydrator fails when hydrating data as there is a DOCTRINE_ROWNUM column appending the "limit" clause. Here is the exception thrown : "Notice: Undefined index: DOCTRINE_ROWNUM in [...]/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php line 183" I was thinking about something like this to fix this issue
Maybe there is a better approach, what are your thoughts? |
| Comments |
| Comment by Benjamin Grandfond [ 17/Aug/12 ] |
|
I implemented it in my forks : https://github.com/benja-M-1/doctrine2/commit/c8d899b14446accf869ddc0043f4235284375755 It works for me, but I didn't write unit tests. |
| Comment by Benjamin Grandfond [ 24/Aug/12 ] |
|
Hi, Did you have time to have a look at this issue? Thanks |
| Comment by Christophe Coevoet [ 24/Aug/12 ] |
|
Please send a pull request when you submit a fix. It is the proper way to submit them for review. When we want to see things waiting for review, we look at the list of pending PRs, not at all comments of the issue tracker to find links in them. And I can tell you that this change has a big issue: it introduces a state in the database platform whereas it is currently stateless. This is likely to cause some issues when using more than 1 query (which is a common use case). |
| Comment by Benjamin Grandfond [ 29/Aug/12 ] |
|
Hi Christophe thank you for your feedback. I didn't send a PR because I wanted someone sharing his thoughts about what I suggested in this current issue. However I don't really understand the stateless argument, can you explain a bit more? Otherwise how would do you proceed to tell Doctrine not to hydrate platform-specific columns? |
| Comment by Christophe Coevoet [ 29/Aug/12 ] |
|
If you run several queries, they will be affected by the extra columns of previous requests, which is wrong |
| Comment by Benjamin Eberlei [ 29/Aug/12 ] |
|
I think the ObjectHydrator catches this by skipping undefined columns, i think we might just have overoptimized the SimpleObjectHydrator a little bit. |