-
-
Notifications
You must be signed in to change notification settings - Fork 481
Provide function to escape strings provided to Postgres? #575
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
Comments
It probably does make sense to provide this for these kinds of use cases. I think placing the function in the |
It isn't possible to put it in /* Quoting strings before inclusion in queries. */
extern size_t PQescapeStringConn(PGconn *conn,
char *to, const char *from, size_t length,
int *error);
extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len);
extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len); Do you have a suggestion on where it should go given this? |
I created PR #702 to address this. I don't think
So I implemented it in postgres-protocol by just porting the libpq code to rust. |
I have a program to help instantiate my database, which internally runs:
Since prepared statements (and so $1, $2..) do not work in this context, is there a way that I can escape the password string provided by the user before passing it to the above?
Might this be a useful piece of functionality to provide from this library? (I appreciate that its use should be discouraged).
The text was updated successfully, but these errors were encountered: