Skip to content

Could default PrepareStatment be disabled? #1590

Answered by abonander
LebranceBW asked this question in Q&A
Discussion options

You must be logged in to vote

If you call any method of Executor (except of course .prepare() and .prepare_with()) with a string slice, it will execute the query directly instead of preparing a statement:

let mut conn = PgConnection::connect("<database URL>").await?;

let row: PgRow = conn.fetch_one("SELECT 1, 'foo'").await?;

Note that you cannot use bind parameters as that requires prepared statements to function.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LebranceBW
Comment options

Answer selected by LebranceBW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants