-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse queries into objects #94
Comments
The Query needs to return simple data. (int, String, double, bool) |
Parsing SQL queries seems more tricky than expected. Unluckily I didn't find a package that could help with that. |
You might be interested in https://github.com/AlecStrong/sqlite-psi It’s the backend for https://github.com/square/sqldelight |
@cw-dev thanks, I'll take a look at it! |
I've written https://pub.dev/packages/sqlparser, which is a pure-Dart sql parser and static analyzer. Originally, it was written for another project, but it might be helpful to this library as well. It can turn any sql query into an AST (so you know whether it is an insert/update/select/etc.), so you could just do final engine = SqlEngine();
print(engine.parse('SELECT * FROM tbl').rootNode is SelectStatement) // true If you know the table structure at build-time, you can also register available tables to the sql engine by adding them to |
This looks awesome and seems to be the right fit for the library's needs. Thanks @simolus3! |
As now is any way to do partial updates? With UPDATE queries or like Room's 2.2 partial updates. |
Create
SqlParser
that returns a query object, which holds information about the query (SELECT, DELETE, etc.).This is only required for queries annotated with
@Query
.This is the first step in making returning the result of inserting, updating or deleting records possible.
The text was updated successfully, but these errors were encountered: