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

Suggest \(bind: ...) instead of \(unsafeRaw: ...) in raw queries? #187

Open
petrpavlik opened this issue Feb 9, 2025 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@petrpavlik
Copy link

Please summarize your feature request

I wonder if there would be any disadvantages to that?

Describe the functionality you're seeking in more detail

I wonder if there would be a scenario where we cannot suggest using \(bind: ...) instead of \(unsafeRaw: ...) interpolation?

Image

Have you considered any alternatives?

No response

@petrpavlik petrpavlik added the enhancement New feature or request label Feb 9, 2025
@gwynne gwynne self-assigned this Feb 9, 2025
@gwynne gwynne added bug Something isn't working and removed enhancement New feature or request labels Feb 9, 2025
@gwynne
Copy link
Member

gwynne commented Feb 9, 2025

It's certainly true that suggesting the use of \(unsafeRaw:) is incorrect; I should have updated the deprecation message long ago. Suggesting the use of \(bind:) as a replacement isn't always correct, though (or more exactly, it's incomplete) - I equally often encounter people incorrectly using \(unsafeRaw:) where they should be using \(ident:). The Real™ problem here is that the correct use of SQLQueryString itself - especially the meaning and correct usage of the various interpolations - is not really documented in any meaningful way; I'm going to include addressing that as part of fixing this issue.

Thanks for pointing this out! At least now I realize it's my own fault that people so commonly overuse (and/or misuse) \(unsafeRaw:) 😆

@petrpavlik
Copy link
Author

Awesome, thanks. Yeah, some sort of documentation on what those interpolations actually generate would be helpful. I can imagine that a lot of users just give up and go for the unsafe version.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants