Get a list/array of record from database
based on SQL query passed.

@param string     $sql
@param null|mixed $params

@return array
550459
public function getResultsAsObjects($sql, $params = null)
    {
        $this->log('getResults', $sql, $params);

        return $this->_socket->getResultsAsObjects($sql, $params);
    }
740643
public function column(string $sql, array $params = [])
    {
        $prepared = $this->prepare($sql, $params);
        $this->execute($prepared);
        $result = $prepared['statement']->fetchColumn();
        $prepared['statement']->closeCursor();
        return $result;
    }
160246
public function getArray($sql, $parameters = array()) {
        $this->execute($sql);
        $result = array();
        while (!!$objs = mysql_fetch_assoc($this->result) ) {
            $result[] = $objs;
        }
        return $result;
    }
70505
public function getArray($sql = null, $parameters = array()) {
		$this->execute($sql);
		$result = array();
		while (!!$objs = mysqli_fetch_assoc($this->result) ) {
			$result[] = $objs;
		}
		return $result;
	}
600382
public function whereNotExistsRaw(string $sql, string ...$params)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->whereNotExistsRaw($sql, ...$params);

        return $instance;
    }
631472
public function getValues($sql, $params = null)
    {
        $this->log('getValues', $sql, $params);

        return $this->_socket->getColumn($sql, $params);
    }
955851
public function fetchColumn($sql, $params = array(), $column = 0)
    {
        return $this->query($sql, $params)->fetchColumn($column);
    }
767989
public List<Entity> query(String sql, Object... params) throws SQLException {
		return query(sql, new EntityListHandler(), params);
	}
1268801
public function fetchAll($sql, array $parameters = [])
    {
        $stm = $this->lazyLoad()->prepare($sql);
        $stm->execute($parameters);
        $array = $stm->fetchAll(\PDO::FETCH_ASSOC);
        // @see https://stackoverflow.com/a/883382/1335142
        $this->numRows = $stm->rowCount();

        return $array;
    }
1312102
public function sqlFetchColumn(string $sql, array $params = [], string $column = '0')
    {
        $stmt = $this->prepare($sql, $params);

        if (ctype_digit((string) $column)) {
            return $stmt->fetchColumn($column);
        }

        if ($record = $stmt->fetch()) {
            return array_key_exists($column, $record) ? $record[$column] : null;
        }

        return null;
    }
555583
protected function fetch( $sql, $params = null ) {
		$stmt = $this->dbh->prepare( $sql );
		$this->bind( $stmt, $params );
		$stmt->execute();
		return $stmt->fetch();
	}
524596
public function whereRaw(string $sql, string ...$params)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->whereRaw($sql, ...$params);

        return $instance;
    }
520512
public function findAllBySql($sql,$params=array())
	{
		Yii::trace(get_class($this).'.findAllBySql()','system.db.ar.CActiveRecord');
		$this->beforeFind();
		if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
		{
			$this->resetScope(false);
			$finder=$this->getActiveFinder($criteria->with);
			return $finder->findAllBySql($sql,$params);
		}
		else
		{
			$command=$this->getCommandBuilder()->createSqlCommand($sql,$params);
			return $this->populateRecords($command->queryAll());
		}
	}
343621
public static function getSqlWithParams(string $sql, array $params = []): string
    {
        if (! empty($params)) {
            $indexed = ($params === array_values($params));
            foreach ($params as $k => $v) {
                if (is_string($v)) {
                    $v = "'${v}'";
                }
                if (is_array($v)) {
                    $v = "'" . implode("','", $v) . "'";
                }
                if ($indexed) {
                    $sql = preg_replace('/\?/', $v, $sql, 1);
                } else {
                    $sql = str_replace(":${k}", $v, $sql);
                }
            }
        }

        return str_replace(PHP_EOL, '', $sql);
    }
805201
public function getPost($sql, $params)
    {
        $post = $this->findWhere("$sql", $params);
        return $post->setupPost($post);
    }
760363
public List<Map<String, Object>> queryListMap(String sql, List<Object> params) {
        return this.queryListMap(sql, params.toArray());
    }
1047025
protected function getSQLResultFromConnection($connection, $sql, array $params = array())
    {
        $result = $connection->fetchAll($sql, $params);
        return $result;
    }