original_string: public function query($sql, array $params = [], array $types = []): int
      {
          $stmt = $this->handler()->prepare($sql);
          foreach ($params as $key => &$param) {
              $stmt->bindParam(
                  (is_int($key) ? $key + 1 : ':' . $key),
                  $param,
                  $types[$key] ?? \PDO::PARAM_STR
              );
          }
          $this->log($sql, $params);
          $stmt->execute($params);
          $this->ok();
          return $stmt->rowCount();
      }
code: public function query($sql, array $params = [], array $types = []): int
      {
          $stmt = $this->handler()->prepare($sql);
          foreach ($params as $key => &$param) {
              $stmt->bindParam(
                  (is_int($key) ? $key + 1 : ':' . $key),
                  $param,
                  $types[$key] ?? \PDO::PARAM_STR
              );
          }
          $this->log($sql, $params);
          $stmt->execute($params);
          $this->ok();
          return $stmt->rowCount();
      }
code_tokens: public function query ( $ sql , array $ params = [ ] , array $ types = [ ] ) : int { $ stmt = $ this -> handler ( ) -> prepare ( $ sql ) ; foreach ( $ params as $ key => & $ param ) { $ stmt -> bindParam ( ( is_int ( $ key ) ? $ key + 1 : ':' . $ key ) , $ param , $ types [ $ key ] ?? \ PDO :: PARAM_STR ) ; } $ this -> log ( $ sql , $ params ) ; $ stmt -> execute ( $ params ) ; $ this -> ok ( ) ; return $ stmt -> rowCount ( ) ; }
docstring: Execute SQL query
  
  Example of usage
  <code>
  $db->query("SET NAMES 'utf8'");
  </code>
  
  @param  string $sql    SQL query with placeholders
  "UPDATE users SET name = :name WHERE id = :id"
  @param  array  $params params for query placeholders (optional)
  array (':name' => 'John', ':id' => '123')
  @param  array  $types  Types of params (optional)
  array (':name' => \PDO::PARAM_STR, ':id' => \PDO::PARAM_INT)
  
  @return integer the number of rows
  @throws DbException
docstring_tokens: Execute SQL query