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

[feature] get final SQL before execute #58

Open
red010182 opened this issue Mar 8, 2023 · 1 comment
Open

[feature] get final SQL before execute #58

red010182 opened this issue Mar 8, 2023 · 1 comment

Comments

@red010182
Copy link

red010182 commented Mar 8, 2023

Hi,

Is there anyway to get the final SQL (after parameter inserted) before execution? It's a good way to check if parameters are properly inserted.

For example

val id = "123"
val query = queryOf("SELECT * FROM T WHERE id=?", id)

query.getRawSQL() // SELECT * FROM T WHERE id='123'
@red010182 red010182 changed the title get final SQL before execute [feature] get final SQL before execute Mar 8, 2023
@Brutus5000
Copy link

I did not check for this library, but in general, libraries use prepared statements. So they send a query to the database with placeholders and then send the parameters separated. This is important to protect from SQL injections.

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

2 participants