-
Notifications
You must be signed in to change notification settings - Fork 370
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
Compound primary keys support (revisited!) #171
Conversation
Also, now they allow multiple column-names per call.
Also, now they allow multiple column-names per call.
@lrlopez I just tried implementing this and found 3 flaws with Idiorm and your patch.
In conclusion, if you could please fix these issues that would be great. Cheers |
Stefan, thank you very much for reviewing the PR. You're right. At first sight, it seems to be an easy fix though, as we'd just need to enclose I'll do some testing and amend the commit once I arrive home. |
I've reviewed again the code and found just one direct use of The PDO mock object is too weak to make some automated tests of this feature, so I hope to get some additional time this weekend to do a throughful test using real code. |
I don't think I am missing anything, but |
Simon, I'm not 100% sure about what are you referring to, but I think the method signature hasn't changed. It just returns an associative array when compound primary keys are used; in any other case just a string. |
Cool. I wasn't referring to the code when I wrote my last email just the On Jan 11, 2014 7:42 PM, "Luis Ramón López" notifications@github.com
|
@lrlopez @treffynnon I'm going to update the MockPDO objects and the logger to check for correct integer index count on arrays as that is what a real PDO object does. This should help diagnose any problems related to the compound keys and help the testing correctly represent the real environments. |
See #173 |
I have merged this PR into develop, thank you. Please help to test it. |
Thanks @treffynnon! I'll do and report back if I find something wrong. |
This PR adds support for compound primary keys. It is fully backward compatible with one column primary keys tables and also works with Paris (although I recommend a deeper compatibility test).
As a side-effect, I've enhanced
where_*()
andhaving_*()
methods to allow stating multiple column-names/values at once (is needed for the compound keys support).All the changes are documented and I've also thrown in some tests (beware: I only test that SQL queries are built the right way).
I've splitted the PR into several commits, but I could squash them into one big commit if this gets merged in order to not pollute the history.
Closes #161