Skip to content
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

Possible extension - parse query and generate type-safe code #2

Open
johnpmayer opened this issue Dec 12, 2014 · 2 comments
Open

Possible extension - parse query and generate type-safe code #2

johnpmayer opened this issue Dec 12, 2014 · 2 comments

Comments

@johnpmayer
Copy link

This has existed for a few years:

https://www.haskell.org/haskellwiki/MetaHDBC

Essentially parses the query and generates type-safe code function @ compile time. Not sure how much of that is possible in Rust macros.

@Manishearth
Copy link

It's possible.

@jbg
Copy link

jbg commented May 26, 2017

This is a really cool idea but I can see some potential problems.

SELECT col1, col2, col3 FROM table1 WHERE col4=?

There's no way to know the type of col[1-4] from that query without connecting to the database and inspecting the schema. So this library goes from just parsing the query to actually needing to connect to the database at compile time. Also, the schema could be changed in the database after the Rust program is compiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants