Executes a query that returns 0 or more rows.

@param string $query The SQL statement.

@return array[] The selected rows.

@since 1.0.0
@api
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;
  }
675194
protected function executeQuery($query)
    {
        $content = (string) $this->getAdapter()->get($query)->getBody();
        $result  = json_decode($content, true);

        if (!$result) {
            throw new NoResult(sprintf('Could not execute query %s', $query));
        }

        $result = array_shift($result);

        return array(array_merge($this->getDefaults(), array(
            'latitude'     => isset($result['latitude']) ? $result['latitude'] : null,
            'longitude'    => isset($result['longitude']) ? $result['longitude'] : null,
            'city'         => isset($result['locality']) ? $result['locality'] : null,
            'country'      => isset($result['country_name']) ? $result['country_name'] : null,
            'countryCode'  => isset($result['country_code']) ? $result['country_code'] : null,
            'zipcode'	   => isset($result['postal_code']) ? $result['postal_code'] : null,
            'streetName'   => isset($result['street_name']) ? $result['street_name'] : null,
            'streetNumber' => isset($result['street_number']) ? $result['street_number'] : null,
        )));
    }
160178
public function findAll($query = null) {
        if ($query === null) {
            $mapping = $this->getMapping();
            $table = $this->escapeIdentifier($mapping['table']);
            $query = 'select * from '.$table;
        }
        return $this->getWorker()->findAll($query);
    }
1101520
public function execute($query)
    {
        $context = $this->getCommandContext();

        $context->query = $query;

        if ($this->getCommandChain()->run('before.execute', $context) !== false) {
            $context->result = $this->_adapter->execute(to_str($context->query));
            $this->getCommandChain()->run('after.execute', $context);
        }

        return $context->result;
    }
1166505
public static function executeNone(string $query): int
  {
    self::realQuery($query);

    $n = self::$mysqli->affected_rows;

    if (self::$mysqli->more_results()) self::$mysqli->next_result();

    return $n;
  }
1130453
public function select($query, $bindings = array())
	{
		return $this->run($query, $bindings, function($me, $query, $bindings)
		{
			if ($me->pretending()) return array();

			// For select statements, we'll simply execute the query and return an array
			// of the database result set. Each element in the array will be a single
			// row from the database table, and will either be an array or objects.
			$statement = $me->getReadPdo()->prepare($query);

			$statement->execute($me->prepareBindings($bindings));

			return $statement->fetchAll($me->getFetchMode());
		});
	}
425137
public function allArray(Query $query = null) {
		$iterator = $this->getIterator();
		$array = $iterator->all($query);
		$array = $this->forgeEntity($array);
		return $array;
	}
597523
protected function performQueryAnalysis($query)
    {
        $hints = [];
        if (preg_match('/^\\s*SELECT\\s*`?[a-zA-Z0-9]*`?\\.?\\*/i', $query)) {
            $hints[] = 'Use <code>SELECT *</code> only if you need all columns from table';
        }
        if (preg_match('/ORDER BY RAND()/i', $query)) {
            $hints[] = '<code>ORDER BY RAND()</code> is slow, try to avoid if you can.
				You can <a href="http://stackoverflow.com/questions/2663710/how-does-mysqls-order-by-rand-work" target="_blank">read this</a>
				or <a href="http://stackoverflow.com/questions/1244555/how-can-i-optimize-mysqls-order-by-rand-function" target="_blank">this</a>';
        }
        if (strpos($query, '!=') !== false) {
            $hints[] = 'The <code>!=</code> operator is not standard. Use the <code>&lt;&gt;</code> operator to test for inequality instead.';
        }
        if (stripos($query, 'WHERE') === false && preg_match('/^(SELECT) /i', $query)) {
            $hints[] = 'The <code>SELECT</code> statement has no <code>WHERE</code> clause and could examine many more rows than intended';
        }
        if (preg_match('/LIMIT\\s/i', $query) && stripos($query, 'ORDER BY') === false) {
            $hints[] = '<code>LIMIT</code> without <code>ORDER BY</code> causes non-deterministic results, depending on the query execution plan';
        }
        if (preg_match('/LIKE\\s[\'"](%.*?)[\'"]/i', $query, $matches)) {
            $hints[] = 	'An argument has a leading wildcard character: <code>' . $matches[1]. '</code>.
								The predicate with this argument is not sargable and cannot use an index if one exists.';
        }
        return $hints;
    }
1079822
public function queryfetch($query, $returnarray=false) {
    list($result, $numrows) = $this->query($query, true);
    
    if(!$result) {
      throw new SqlException($query, $this);
    }

    while($row = mysql_fetch_assoc($result)) {
      $rows[] = $row;
    }
    return ($returnarray) ? array($result, $numrows, result=>$result, numrows=>$numrows) : $rows;
  }
1193145
public function select($query, $bindings = array(),$useReadPdo = false)
    {
        return $this->run($query, $bindings, function(self $me, $query, array $bindings)
        {
            if ($me->pretending()) return array();

            // For select statements, we'll simply execute the query and return an array
            // of the database result set. Each element in the array will be a single
            // node from the database, and will either be an array or objects.
            $statement = $me->getCypherQuery($query, $bindings);

            return $statement->getResultSet();
        });
    }
223388
public static function executeRow1(string $query): array
  {
    self::logQuery($query);

    return self::$dl->executeRow1($query);
  }
729622
public function query( $query, $options = 0 ) {

		$result                   = $this->wpdb->get_results( (string) $query );
		$this->last_affected_rows = (int) $this->wpdb->rows_affected;
		$this->last_insert_id     = (int) $this->wpdb->insert_id;
		$this->last_statement     = NULL;
		if ( ! is_array( $result ) )
			$result = [];

		return new GenericResult( $result );
	}
650221
public function select( $query, $bindings = [], $useReadPdo = true )
	{
		return $this->run( $query, $bindings, function ( $me, $query, $bindings ) use ( $useReadPdo )
		{
			if ( $me->pretending() )
			{
				return [];
			}

			// For select statements, we'll simply execute the query and return an array
			// of the database result set. Each element in the array will be a single
			// row from the database table, and will either be an array or objects.
			$statement = $this->getPdoForSelect( $useReadPdo )->prepare( $query );

			$statement->execute( $me->prepareBindings( $bindings ) );

			$fetchMode = $me->getFetchMode();
			$fetchArgument = $me->getFetchArgument();

			if ( $fetchMode === PDO::FETCH_CLASS && !isset( $fetchArgument ) )
			{
				$fetchArgument = 'StdClass';
			}

			return isset( $fetchArgument ) ? $statement->fetchAll( $fetchMode, $fetchArgument, $me->getFetchConstructorArgument() ) : $statement->fetchAll( $fetchMode );
		} );
	}
720780
public function &getList($query)
    {
        $_result = array();
        $_ret = $this->execute($query);
        if ( $_ret != false ) {

            while ( ($_rows = $_ret->fetch(PDO::FETCH_ASSOC)) != false )
                $_result[]  = $_rows;
        }
        return $_result;
    }
266119
public function query($query, $retarray=false) {
    $db = $this->opendb();

    if(!preg_match("/^(?:select)/i", $query)) {
      // These must use exec
      // echo "not select<br>";
      $numrows = $db->exec($query);

      if($numrows === false) {
        // error
        throw new SqlException($query, $this);
      }
      //return $numrows;
    } else {
      if($this->result) {
        $this->result->closeCursor();
      }
      
      $result = $db->query($query);

      if($result === false) {
        $this->result = null;
        throw new SqlException($query, $this);
      }

      $this->result = $result;
      $numrows = $result->rowCount();
    }
    if($retarray) {
      return array($result, $numrows, 'result'=>$result, 'numrows'=>$numrows);
    } else {
      return $result;
    }
  }
4812
public function select($query, $bindings = array(), $useReadPdo = true)
	{
		return $this->run($query, $bindings, function($me, $query, $bindings) use ($useReadPdo)
		{
			if ($me->pretending()) return array();

			// For select statements, we'll simply execute the query and return an array
			// of the database result set. Each element in the array will be a single
			// row from the database table, and will either be an array or objects.
			$statement = $this->getPdoForSelect($useReadPdo)->prepare($query);

			$statement->execute($me->prepareBindings($bindings));

			return $statement->fetchAll($me->getFetchMode());
		});
	}
1187544
public function executeQuery($query)
    {
        $results = $this->mysqliRef->query($query);
        if (!$results) {
            $mex = "Mysql error ".$this->mysqliRef->error." on '".$query."''";
            $this->log($mex);
            throw new MysqltcsException($mex);
        }else {
            $this->log($query);
            return $results;
        }
    }