public function getColumnNames(string $table, bool $withTableName = false, bool $aliased = false)
    {
        $cols = [];

        if ($this->databaseType === 'mysql') {
            $sql = "SHOW COLUMNS FROM {$table}";
            $tableNameIndex = 'Field';
        } elseif ($this->databaseType === 'sqlite') {
            $sql = "PRAGMA table_info({$table})";
            $tableNameIndex = 'name';
        } else {
            throw new \RuntimeException("Unsupported database type: '{$this->databaseType}'");
        }

        # Get all columns from a selected table
        $r = $this->query($sql)->fetchAll();
        $this->logQuery($sql);

        # Add column names to $cols array
        foreach ($r as $i => $col) {
            $colName = $col[$tableNameIndex];

            if ($aliased) {
                $i = "{$table}_{$colName}";
            }

            if ($withTableName) {
                $colName = "{$table}.${colName}";
            }

            $cols[$i] = $colName;
        }

        return $cols;
    }