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

Add documentation for binding to raw queries #448

Closed
shssoichiro opened this Issue Sep 19, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@shssoichiro
Contributor

shssoichiro commented Sep 19, 2016

If I have a circumstance where I want or need to write a raw query, I understand that diesel allows me to do this with the sql function. However, the API around binding to a SqlLiteral is confusing and the documentation is extremely limited. It would be very helpful to add one or two examples for how to bind a parameter to a raw query.

@sgrif

This comment has been minimized.

Member

sgrif commented Dec 10, 2016

sql isn't intended to work with bind parameters. For any case where bind parameters are likely to appear (e.g. anywhere that isn't special syntax for an additional clause or type of query), some combination of sql_function!, infix_expression!, postfix_expression! and prefix_expression! should be sufficient. If you give more details about what you're trying to do in gitter, I can help further.

@sgrif sgrif closed this Dec 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment