Execute the given query and return the total number of results.

@param array $query

@return int
513736
public function runCount($query)
	{
		if (isset($this->stored_query_totals[md5(serialize($query))])) {
			return $this->stored_query_totals[md5(serialize($query))];
		}
		
		try {
			return array_get($this->getClient()->search($query), 'hits.total');
		} catch (\Elasticsearch\Common\Exceptions\Missing404Exception $e) {
			return 0;
		}
	}
499093
public function runCount($query)
	{
		if (isset($this->stored_query_totals[md5(serialize($query))])) {
			return $this->stored_query_totals[md5(serialize($query))];
		}
		
		$query['terms'] = trim($query['terms']);
		if (isset($query['numericFilters'])) {
			$query['numericFilters'] = implode(',', $query['numericFilters']);
		}
		if (isset($query['facets'])) {
			$query['facets'] = implode(',', $query['facets']);
		}
		
		try {
			return array_get($this->getIndex()->search(array_get($query, 'terms'), array_get($query, 'query')), 'nbHits');
		} catch (\Exception $e) {
			return 0;
		}
	}
323002
public function count(Query $query)
        {
            $query->setTable($this);
            $query->generateCountSQL();

            $resultset = Statement::getPreparedStatement($query)->execute();
            return $resultset->getCount();
        }
554459
public function count(): int
    {
        $result = $this->getCountQuery()->fetchFirst();

        if ($result === null) {
            return 0;
        }

        return (int)$result['total'];
    }
294168
public function run( $query, $params = array() )
	{
		$sth = $this->statement( $query, $params );
		
		$type = strtolower( substr( $query, 0, strpos( $query, ' ' ) ) );
	
		switch ( $type ) 
		{
			case 'update':
			case 'delete':
				return $sth->rowCount();
			break;
			
			case 'insert':
				return $this->driver()->connection()->lastInsertId();
			break;
		}
		
		return $sth;
	}
1294525
public function count($query = [], $options = [])
    {
        try {
            // Handle legacy mode - limit and skip as second and third parameters, respectively
            if (! is_array($options)) {
                $limit = $options;
                $options = [];

                if ($limit !== null) {
                    $options['limit'] = (int) $limit;
                }

                if (func_num_args() > 2) {
                    $options['skip'] = (int) func_get_args()[2];
                }
            }

            return $this->collection->count(TypeConverter::fromLegacy($query), $options);
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }
    }
334486
public function query($query, $params = []) {
		$statement = $this->get_statement($query, $params);
		$statement->execute();
	}
1032260
public function count($where = null)
  {
    $m = $this->getManager();

    $q = $m->getQueryBuilder()
      ->select($this->getTable())
      ->columns('COUNT(*) as total')
      ->where($where);

    return $m->query($q)->fetchColumn();
  }
364387
public function logQuery(array $query)
    {
        $this->queries[] = $query;

        if ($this->logger) {
            $this->logger->info('MongoDB Query: '.json_encode($query));
        }
    }
902071
public function execute( $query, array $data = [ ] )
    {
        $result = NULL;

        $statement = $this->database->prepare( $query );

        if ( FALSE === $statement )
        {
            $this->close();

            throw new DatabaseException( 'Failed to create prepared statement.' );
        }

        $result = $statement->execute( $data );

        $this->query = $statement->queryString;

        if ( FALSE !== $result )
        {
            $result = ( int ) $statement->rowCount();
        }

        return $result;
    }
434699
public function executeRows(string $query): array
  {
    $result = $this->query($query);
    if ($this->haveFetchAll)
    {
      $ret = $result->fetch_all(MYSQLI_ASSOC);
    }
    else
    {
      $ret = [];
      while (($row = $result->fetch_assoc()))
      {
        $ret[] = $row;
      }
    }
    $result->free();

    if ($this->mysqli->more_results()) $this->mysqli->next_result();

    return $ret;
  }
1173492
public function affectingStatement($query, $bindings = array())
    {
        $self = $this;

        return $this->run($query, $bindings, function($query, $bindings) use ($self) {
            if ($self->pretending()) return 0;

            // pass query to CodeIgniter database layer
            $bindings = $self->prepareBindings($bindings);
            $self->ci->db->query($query, $bindings);

            // return number of rows affected
            return $self->ci->db->affected_rows();
        });
    }
1086768
protected function performUpdate($query, array $options = [])
    {
        $this->compileWheres();
        $result = $this->query->update($query)->run();

        if (0 == (int) $result['errors']) {
            return $result['replaced'];
        }

        return 0;
    }
881809
public function query($query, array $params = [])
    {
        // Execute query
        $stmt = $this->connection->prepare($query);
        $stmt->execute($params);
        // Return result resource variable
        return $stmt;
    }
43765
public static function executeRow0(string $query): ?array
  {
    self::logQuery($query);

    return self::$dl->executeRow0($query);
  }
666871
public static function query($query = [])
    {
        if (func_num_args()) {
            static::$_query[static::class] = is_array($query) ? $query : [];
        }
        return isset(static::$_query[static::class]) ? static::$_query[static::class] : [];
    }
205893
public function count($parentId, array $query = [])
    {
        $resource = $this->createPartialResourceUrlForList($parentId).'/count';

        return $this->client->get($resource, $query)['count'];
    }