Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-526

Doctrine\DBAL\Connection::executeQuery changes passed clause

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:

      Description

      >> var_dump(get_class($db));

      string(24) "Doctrine\DBAL\Connection"

      >> var_dump($params);

      array(2)

      { [0] => int(18) [1] => int(0) }

      >> $stmt = $db->executeQuery('SELECT l0_.id AS id0 FROM link l0_ WHERE l0_.user_id = ? AND l0_.is_deleted = ?', array($params), array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY));

      An exception occurred while executing 'SELECT l0_.id AS id0 FROM link l0_ WHERE l0_.user_id = ?, ? AND l0_.is_deleted = ?' with params [18, 0]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

      >> $stmt = $db->executeQuery('SELECT l0_.id AS id0 FROM link l0_ WHERE l0_.user_id = ? AND l0_.is_deleted = ?', $params, array(\PDO::PARAM_INT, \PDO::PARAM_INT));
      >> var_dump($stmt->fetchAll());

      array(0) {
      }

        Activity

        Hide
        Fabio B. Silva added a comment -

        Covie X this is the expected behaviour,
        If you use "Connection::PARAM_INT_ARRAY" the given array parameter will be expanded.

        Show
        Fabio B. Silva added a comment - Covie X this is the expected behaviour, If you use "Connection::PARAM_INT_ARRAY" the given array parameter will be expanded.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Covie X
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: