Hacker News new | ask | show | jobs
by selecsosi 999 days ago
Not for sqlserver, but for postgres working w/ python, the psycopg library has a API for getting the bound parameter expression

https://www.psycopg.org/docs/cursor.html#cursor.mogrify

Most of this I would expect to be more on the client side than server (though w/ sqlite you are working w/ both)

1 comments

Thank you for your answer.

I'm still wondering why it's not available for SQLServer (because there are use cases for this feature).

It is "just" a matter of driver interface (I mean the piece of code that implement ODBC API) that "just" do not give this feature or it's letteraly not possible with SQLServer?

I think it’s likely that other databases do not keep the query string you sent it around but convert it into some internal structure.

Converting that back to the query string you sent may be impossible because that structure won’t record comments, line breaks, indents, escaped characters and the like.

Converting it to a query string that, when sent back, produces the same internal structure should be possible, but as user selecsosi wrote “Most of this I would expect to be more on the client side than server”.

Thank you for your answer.

It makes sense.

I didn't catch the "client side" part as you do, thanks for the explanation.