RowCountException example



  /** * {@inheritdoc} */
  public function rowCount() {
    // SELECT query should not use the method.     if ($this->rowCountEnabled) {
      return $this->clientStatement->rowCount();
    }
    else {
      throw new RowCountException();
    }
  }

  /** * {@inheritdoc} */
  public function setFetchMode($mode$a1 = NULL, $a2 = []) {
    // Call \PDOStatement::setFetchMode to set fetch mode.     // \PDOStatement is picky about the number of arguments in some cases so we     // need to be pass the exact number of arguments we where given.     return match(func_num_args()) {
      


  /** * {@inheritdoc} */
  public function rowCount() {
    // SELECT query should not use the method.     if ($this->rowCountEnabled) {
      return $this->clientStatement->rowCount();
    }
    else {
      throw new RowCountException();
    }
  }

  /** * {@inheritdoc} */
  public function setFetchMode($mode$a1 = NULL, $a2 = []) {
    // Call \PDOStatement::setFetchMode to set fetch mode.     // \PDOStatement is picky about the number of arguments in some cases so we     // need to be pass the exact number of arguments we where given.     switch (func_num_args()) {
      


  /** * {@inheritdoc} */
  public function rowCount() {
    // SELECT query should not use the method.     if ($this->rowCountEnabled) {
      return $this->rowCount;
    }
    else {
      throw new RowCountException();
    }
  }

  /** * {@inheritdoc} */
  public function fetch($fetch_style = NULL, $cursor_orientation = \PDO::FETCH_ORI_NEXT, $cursor_offset = NULL) {
    if (isset($this->currentRow)) {
      // Set the fetch parameter.       $this->fetchStyle = $fetch_style ?? $this->defaultFetchStyle;
      $this->fetchOptions = $this->defaultFetchOptions;

      
return [
      [static::DEFAULT_EXCEPTION_MESSAGE, ''],
      ['test', 'test'],
    ];
  }

  /** * @covers ::__construct * @dataProvider providerTestExceptionMessage */
  public function testExceptionMessage($expected$message) {
    $e = new RowCountException($message);
    $this->assertSame($expected$e->getMessage());
  }

  /** * @covers ::__construct * @group legacy */
  public function testExceptionMessageNull() {
    $e = new RowCountException(NULL);
    $this->assertSame(static::DEFAULT_EXCEPTION_MESSAGE, $e->getMessage());
  }

}


  /** * {@inheritdoc} */
  public function rowCount() {
    // SELECT query should not use the method.     if ($this->rowCountEnabled) {
      return $this->rowCount;
    }
    else {
      throw new RowCountException();
    }
  }

  /** * {@inheritdoc} */
  public function fetch($fetch_style = NULL, $cursor_orientation = \PDO::FETCH_ORI_NEXT, $cursor_offset = NULL) {
    $currentKey = $this->getResultsetCurrentRowIndex();

    // We can remove the current record from the prefetched data, before     // moving to the next record.
Home | Imprint | This part of the site doesn't use cookies.