Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-320

allow SQL QueryBuilder to do INSERTS

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      With

      $db = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
      $qb = $db->createQueryBuilder();

      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.

        Issue Links

          Activity

          Tim Mundt created issue -
          Hide
          Marco Pivetta added a comment -

          Insert is not supported by DQL

          Show
          Marco Pivetta added a comment - Insert is not supported by DQL
          Marco Pivetta made changes -
          Field Original Value New Value
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]
          Hide
          Tim Mundt added a comment -

          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??

          Show
          Tim Mundt added a comment - 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??
          Hide
          Tim Mundt added a comment -

          see previous comment, I'd appreciate some clarification

          Show
          Tim Mundt added a comment - see previous comment, I'd appreciate some clarification
          Tim Mundt made changes -
          Resolution Won't Fix [ 2 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          Marco Pivetta added a comment -

          Tim Mundt Ouch, no, it was my fault, sorry.
          I confused the project related to the issue.

          Show
          Marco Pivetta added a comment - Tim Mundt Ouch, no, it was my fault, sorry. I confused the project related to the issue.
          Hide
          Marco Pivetta added a comment -

          This is actually valid (even the patch, though it needs to adds tests)

          Show
          Marco Pivetta added a comment - This is actually valid (even the patch, though it needs to adds tests)
          Hide
          Tim Mundt added a comment -

          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.

          Show
          Tim Mundt added a comment - 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.
          Hide
          Marco Pivetta added a comment -

          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)
          A Github PR is also the fastest way to get your code reviewed since not everyone visits the issue tracker.

          Show
          Marco Pivetta added a comment - 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) A Github PR is also the fastest way to get your code reviewed since not everyone visits the issue tracker.
          Hide
          Tim Mundt added a comment -
          Show
          Tim Mundt added a comment - Here's the PR: https://github.com/doctrine/dbal/pull/184
          Steve Müller made changes -
          Link This issue is referenced by DBAL-182 [ DBAL-182 ]
          Steve Müller made changes -
          Link This issue is referenced by DBAL-599 [ DBAL-599 ]
          Steve Müller made changes -
          Link This issue relates to DBAL-636 [ DBAL-636 ]
          Hide
          Doctrine Bot added a comment -

          A related Github Pull-Request [GH-184] was closed:
          https://github.com/doctrine/dbal/pull/184

          Show
          Doctrine Bot added a comment - A related Github Pull-Request [GH-184] was closed: https://github.com/doctrine/dbal/pull/184
          Steve Müller made changes -
          Assignee Benjamin Eberlei [ beberlei ] Steve Müller [ deeky666 ]
          Show
          Steve Müller added a comment - Fixed in commit: https://github.com/doctrine/dbal/commit/7502dae2e0d8e01e2f6f08cb5323ed754e72bac4
          Steve Müller made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Fix Version/s 2.5 [ 10523 ]
          Resolution Fixed [ 1 ]

          This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

          • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-320, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

            • Assignee:
              Steve Müller
              Reporter:
              Tim Mundt
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: