[DBAL-320] allow SQL QueryBuilder to do INSERTS Created: 13/Aug/12 Updated: 13/Aug/12 |
|
| Status: | Reopened |
| Project: | Doctrine DBAL |
| Component/s: | None |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Tim Mundt | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
With $db = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config); this QueryBuilder I'm able to do SELECT, UPDATE and DELETE. However, INSERT is not possible. Are there any good reasons for this? Attached you find a patch that until now works fine for me. I don't know, however, if there are any side effects. |
| Comments |
| Comment by Marco Pivetta [ 13/Aug/12 ] |
|
Insert is not supported by DQL |
| Comment by Tim Mundt [ 13/Aug/12 ] |
|
Well, that was quick and not helpful. I have read about the QueryBuilder in the ORM package. For some reason with persistence (that other libraries don't have), insert cannot be supported. However, I'm talking about DBAL here. What good reason is there not to support INSERT?? |
| Comment by Tim Mundt [ 13/Aug/12 ] |
|
see previous comment, I'd appreciate some clarification |
| Comment by Marco Pivetta [ 13/Aug/12 ] |
|
Tim Mundt Ouch, no, it was my fault, sorry. |
| Comment by Marco Pivetta [ 13/Aug/12 ] |
|
This is actually valid (even the patch, though it needs to adds tests) |
| Comment by Tim Mundt [ 13/Aug/12 ] |
|
Glad to hear there seems to be no fundamental problem with this. Can I somehow help this patch go into the code? I'm not familiar with the tests here. If you give me some pointer, maybe I can come up with something useful. On the other hand, it could be a good idea for some more involved people to have a look at this before. |
| Comment by Marco Pivetta [ 13/Aug/12 ] |
|
You'd need to add tests in https://github.com/doctrine/dbal/blob/master/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php (to be included in your patch or in a github pull request) |
| Comment by Tim Mundt [ 13/Aug/12 ] |
|
Here's the PR: https://github.com/doctrine/dbal/pull/184 |