Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.6
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      We are missing Insert and Merge Query Objects.

      See Drupal DBTNG:

      Merge: http://drupal.org/node/310085
      Insert: http://drupal.org/node/310079

        Issue Links

          Activity

          Benjamin Eberlei created issue -
          Hide
          Benjamin Eberlei added a comment -

          From the first glance: Drupal API has some problems in that it assumes literal values are the default, which makes working with them simple if no expression is necessary. But inconsistent otherwise.

          Implementation Details:

          • Difference compared to QueryBuilder is that these objects are no builders, but actually executors.
          • Don't assume Literals
          • Creation is delegated to Platform (Runtime API of a Vendor)
          {conn}
          $conn->createInsertQuery();
          $conn->createMergeQuery();{conn}

          Sample API:

          $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->values(array('?', '?'))->(array(1, 2))->execute();
          $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->params(array(1, 2))->execute(); // values(?, ?) is implicit.
          $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->params(array('NOW()', '1'))->execute(); // if no "params" set assume execute once.
          $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->value('foo', 'NOW())->params(array(1))->params(array(2))->execute();
          $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->select($queryBuilder)->execute();
          

          Merge: I dont know yet:

          problem i see here is that people mistake values() for a "safe" method and pass values in there that should be quoted instead.

          Show
          Benjamin Eberlei added a comment - From the first glance: Drupal API has some problems in that it assumes literal values are the default, which makes working with them simple if no expression is necessary. But inconsistent otherwise. Implementation Details: Difference compared to QueryBuilder is that these objects are no builders, but actually executors. Don't assume Literals Creation is delegated to Platform (Runtime API of a Vendor) {conn} $conn->createInsertQuery(); $conn->createMergeQuery();{conn} Sample API: $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->values(array('?', '?'))->(array(1, 2))->execute(); $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->params(array(1, 2))->execute(); // values(?, ?) is implicit. $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->params(array('NOW()', '1'))->execute(); // if no "params" set assume execute once. $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->value('foo', 'NOW())->params(array(1))->params(array(2))->execute(); $conn->createInsertQuery($tbl)->fields(array('foo', 'bar'))->select($queryBuilder)->execute(); Merge: I dont know yet: problem i see here is that people mistake values() for a "safe" method and pass values in there that should be quoted instead.
          Guilherme Blanco made changes -
          Field Original Value New Value
          Fix Version/s 2.3 [ 10184 ]
          Fix Version/s 2.2 [ 10142 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 13200 ] jira-feedback2 [ 17590 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 17590 ] jira-feedback3 [ 19944 ]
          Benjamin Eberlei made changes -
          Fix Version/s 2.4 [ 10320 ]
          Fix Version/s 2.3 [ 10184 ]
          Benjamin Eberlei made changes -
          Fix Version/s 2.5 [ 10523 ]
          Fix Version/s 2.4 [ 10320 ]
          Steve Müller made changes -
          Link This issue relates to DBAL-320 [ DBAL-320 ]
          Steve Müller made changes -
          Link This issue is referenced by DBAL-599 [ DBAL-599 ]
          Steve Müller made changes -
          Link This issue is referenced by DBAL-636 [ DBAL-636 ]
          Benjamin Eberlei made changes -
          Fix Version/s 2.6 [ 10726 ]
          Fix Version/s 2.5 [ 10523 ]

          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-182, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Benjamin Eberlei
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: