toSelectStatement function
Converts a list of SelectedColumns to a SQL SELECT statement.
Implementation
SelectStatement toSelectStatement(String sql) {
final cleanSql = sql.trim();
final clauses = _extractClauses(cleanSql);
return SelectStatement(
clauses['FROM'] ?? '',
parseSelectedColumns(clauses['SELECT'] ?? ''),
where: parseWhereClause(clauses['WHERE'] ?? ''),
orderBy: parseOrderByClause(clauses['ORDER BY'] ?? ''),
joins: parseJoinClauses(clauses['JOIN'] ?? ''),
);
}