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

query() for prepared statements #871

Closed
jtv opened this issue Jul 28, 2024 · 5 comments
Closed

query() for prepared statements #871

jtv opened this issue Jul 28, 2024 · 5 comments

Comments

@jtv
Copy link
Owner

jtv commented Jul 28, 2024

This is a re-filing of an older ticket that got hijacked for a different problem: #644.

The original question from @maresc-g was:

《We're looking to upgrade our version of pqxx in our application so I just came across the release note of the 7.7.4 in which you ask for feedback on if we still use pqxx::result.
I'd like to use the feature to automatically convert types like with query() but we only use prepared queries so we call exec_prepared() which still returns a pqxx::result.
Is it planned to add this for prepared queries as well in future releases ?》

@jtv
Copy link
Owner Author

jtv commented Aug 3, 2024

In PR #875 I bring this a step closer.

@jtv
Copy link
Owner Author

jtv commented Aug 7, 2024

I'm redoing the "exec" functions, so that parameterised statements, regular statements, and prepared statements will look much more alike. Next I want to refactor the exec1(), exec_n(), prepared_exec1(), etc. by moving the row-count checks out of those functions. Instead, you'll make a separate function call to check that you're getting the number of rows you expect.

That will greatly reduce, in the end, the number of exec functions that I need to support. As a part of the ongoing work I think I can implement query() for both prepared statements and parameterised statements, without too much trouble. This work is happening in #875.

@alexolog
Copy link

alexolog commented Aug 8, 2024

That sounds like a big breaking change. Not something people will be looking for.

@jtv
Copy link
Owner Author

jtv commented Aug 8, 2024

The existing functions will stay around for a long time, as always, with a deprecation attribute so everybody gets warnings when they compile code that uses them, telling them what to use instead. This is standard procedure.

@jtv
Copy link
Owner Author

jtv commented Oct 5, 2024

Actually, this is resolved now. You can now call query() and pass a prepped statement instead of an SQL string.

@jtv jtv closed this as completed Oct 5, 2024
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