Pimcore\Model\Tool\CustomReport\Adapter\Sql::getColumns PHP Method

getColumns() public method

public getColumns ( $configuration ) : array | mixed | null
$configuration
return array | mixed | null
    public function getColumns($configuration)
    {
        $sql = "";
        if ($configuration) {
            $sql = $this->buildQueryString($configuration);
        }
        $res = null;
        $errorMessage = null;
        $columns = null;
        if (!preg_match("/(ALTER|CREATE|DROP|RENAME|TRUNCATE|UPDATE|DELETE) /i", $sql, $matches)) {
            $sql .= " LIMIT 0,1";
            $db = Db::get();
            $res = $db->fetchRow($sql);
            $columns = array_keys($res);
        } else {
            throw new \Exception("Only 'SELECT' statements are allowed! You've used '" . $matches[0] . "'");
        }
        return $columns;
    }