mirror of https://github.com/AMT-Cheif/drift.git
1009 B
1009 B
sqlparser
An sql parser and static analyzer, written in pure Dart. Currently in development.
Using this library
import 'package:sqlparser/sqlparser.dart';
final engine = SqlEngine();
final stmt = engine.parse('''
SELECT f.* FROM frameworks f
INNER JOIN uses_language ul ON ul.framework = f.id
INNER JOIN languages l ON l.id = ul.language
WHERE l.name = 'Dart'
ORDER BY f.name ASC, f.popularity DESC
LIMIT 5 OFFSET 5 * 3
''');
// ???
profit();
Features
Not all features are available yet, put parsing select statements (even complex ones!) and performing analysis on them works!
AST Parsing
Can parse the abstract syntax tree of any sqlite statement with SqlEngine.parse
.
Static analysis
Given information about all tables and a sql statement, this library can:
- determine which result rows a query is going to have
- Determine the static type of variables included in the query
- issue some basic warnings on queries that are syntactically valid but won't run