You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to generate dynamic statement parameters using pqxx::placeholders class, the documentation suggests starting a new parameter placeholder using next() function and then get the placeholder's string using get(). Calling these functions in this order generates the second placeholder instead of the first which throws an error later on when executing the SQL statement.
The correct usage would be to call get() and then next().
The text was updated successfully, but these errors were encountered:
You're right, thanks for pointing that out. Perhaps I should just scrap the placeholders class altogether. It probably complicates more than it simplifies, and there's always the risk of undefined behaviour if there's no sequence point between invocations.
I think it's quite helpful at least for my case, I am currently writing a code that converts a query in a specific protocol into SQL query in which the number of arguments changes, so using placeholder's class the way it's suggested in the website made it much easier for me since I don't know how many attributes the query contains.
When trying to generate dynamic statement parameters using
pqxx::placeholders
class, the documentation suggests starting a new parameter placeholder usingnext()
function and then get the placeholder's string usingget()
. Calling these functions in this order generates the second placeholder instead of the first which throws an error later on when executing the SQL statement.The correct usage would be to call
get()
and thennext()
.The text was updated successfully, but these errors were encountered: