Skip to content
Snippets Groups Projects
Select Git revision
  • dec310d6f1365cb88d67e838c55d443172172f55
  • 11.x default protected
  • 11.2.x protected
  • 10.6.x protected
  • 10.5.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

system.api.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    StatementEmpty.php 2.49 KiB
    <?php
    
    namespace Drupal\Core\Database;
    
    
    /**
     * Empty implementation of a database statement.
     *
     * This class satisfies the requirements of being a database statement/result
     * object, but does not actually contain data.  It is useful when developers
     * need to safely return an "empty" result set without connecting to an actual
     * database.  Calling code can then treat it the same as if it were an actual
     * result set that happens to contain no records.
     *
     * @see \Drupal\search\SearchQuery
     */
    class StatementEmpty implements \Iterator, StatementInterface {
    
      /**
       * Is rowCount() execution allowed.
       *
       * @var bool
       */
      public $allowRowCount = FALSE;
    
      /**
       * {@inheritdoc}
       */
      public function execute($args = array(), $options = array()) {
        return FALSE;
      }
    
      /**
       * {@inheritdoc}
       */
      public function getQueryString() {
        return '';
      }
    
      /**
       * {@inheritdoc}
       */
      public function rowCount() {
        if ($this->allowRowCount) {
          return 0;
        }
        throw new RowCountException();
      }
    
      /**
       * {@inheritdoc}
       */
      public function setFetchMode($mode, $a1 = NULL, $a2 = array()) {
        return;
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL) {
        return NULL;
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetchField($index = 0) {
        return NULL;
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetchObject() {
        return NULL;
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetchAssoc() {
        return NULL;
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL) {
        return array();
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetchCol($index = 0) {
        return array();
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetchAllKeyed($key_index = 0, $value_index = 1) {
        return array();
      }
    
      /**
       * {@inheritdoc}
       */
      public function fetchAllAssoc($key, $fetch = NULL) {
        return array();
      }
    
      /**
       * {@inheritdoc}
       */
      public function current() {
        return NULL;
      }
    
      /**
       * {@inheritdoc}
       */
      public function key() {
        return NULL;
      }
    
      /**
       * {@inheritdoc}
       */
      public function rewind() {
        // Nothing to do: our DatabaseStatement can't be rewound.
      }
    
      /**
       * {@inheritdoc}
       */
      public function next() {
        // Do nothing, since this is an always-empty implementation.
      }
    
      /**
       * {@inheritdoc}
       */
      public function valid() {
        return FALSE;
      }
    
    }