-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IBM DB2 iSeries support #910
Conversation
…es for DB2iSeriesPlatform
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DBAL-1304 We use Jira to track the state of pull requests and the versions they got |
* | ||
* @return resource | ||
*/ | ||
public function getConn() //getWrappedResourceHandle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably not be implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the same behaviour as MysqliConnection->getWrappedResourceHandle()
On IBMi systems is necessary to have access to the resource object to use the native XMLToolkit which is a php library used to execute IBMi programs, change system libraries, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably keep the same naming then, but still, we'd need a specific use-case example for this. I don't see why a user can't simply build a new connection object rather than relying on doctrine's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the method name.
Here is the Zend XMLToolkit docs using directly the resource handler.
http://files.zend.com/help/Zend-Server-6-IBMi/content/toolkit_service_class.htm
The fact is on IBMi system once you get a connection to the system it's not just a simple connection but a lot of system services are created and bound to it.
For example a temporary schema (QTEMP) which is avaiable only using that connection, so a SQL statement won't be able to access temporary tables created by another connection (the case you proposed).
Another example is about Library Lists on IBMi. If you use the connection parameter i5_naming=system, the system will look for a table not on a single schema but on a list of schemas, using the first match.
If a program or a XMLTookit command is executed to change the library list, it will affect which table is queried. This is also bound to the connection, so another connection resource wouldn't reflect the system changes.
I hope this could answer to your doubts. I know IBMi system kind of complex and unfortunately not so standard.
@cassvail any idea if you'll be able to add test coverage for this? |
Yes. I was waiting for more feedback on the code. I'll be working on it as soon as I can. |
@cassvail first of all thanks for your contribution. As always the "problem" with newly introduced platforms, we need someone who maintains it if we decide to introduce it in the core. Unfortunately with platforms like this, it is quite hard for us to maintain as nobody has decent knowledge about it and it's not easily testable. So we would require you to actively maintain it, otherwise we cannot accept it for the given reasons :( That's a decision you have to make... |
@deeky666 In my company we have different projects on IBMi system running PHP and using the dbal module (currently my ibmi branch). So I can tell it's also in our interest to have it running correctly and for this reason we will keep our branch updated. |
$over = 'ORDER BY ' . implode(', ', $overColumns); | ||
} | ||
|
||
$sql = 'SELECT DOCTRINE_TBL.* FROM (SELECT ROW_NUMBER() OVER('.$over.') AS DOCTRINE_ROWNUM, DOCTRINE_TBL1.* '. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the DOCTRINE_TBL1.*
needs to come before DOCTRINE_ROWNUM
, as Doctrine Migrations casts the result of a query using this to a string, the additional column causes the "current migration" to be 1
instead of the correct version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cassvail I've made a PR for your branch: cassvail#1 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cassvail unit test failure introduced should be fixed in cassvail#2
@deeky666 A better driver is great, but unless we have a way to run tests regularly, it's going to be hard to keep regressions out. |
Change order of parameters in doModifyLimitQuery to work with Migrations
@deeky666 I'd suggest onboarding somebody that has IBMi knowledge, then passing the token to that person once this is merged. The alternate solution is to have this as a separate library, but then the usability is kinda terrible (not that IBMi has ever been developer friendly) |
Fixes unit test DB2PlatformTest::testModifiesLimitQuery
@cassvail I have a problem with a column in the
The error I see is:
I'm able to fix manually by changing |
@asgrim About your problem with a column in the ORDER BY not bubbling up correctly. |
@cassvail I believe newer DB2 fixes introduce LIMIT / OFFSET correctly, although I've only heard this third party, that might be worth investigating to simplify this logic? |
@asgrim I've been doing some PHPUnit tests on the IBMi SQL Engine. Here is my gist: |
IBM iSeries DB2 has a lot of differences from the linux version.
This set of commits gets dbal and even base functionalities of doctrine-orm to work on IBMi systems without breaking the base set of DB2 classes.