Replies: 4 comments 11 replies
-
The statement cache is, as far as I'm aware, only a feature of deadpool, and can be bypassed by unwrapping the insert_book(&client.client(), &"The Great Gatsby").await?; // No cache with deadpool |
Beta Was this translation helpful? Give feedback.
-
That's a good idea, I definitely think this would be an improvement. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure about books().vec(&client).await?; // prepared
books().unprepared().vec(&client).await?; // unprepared |
Beta Was this translation helpful? Give feedback.
-
The current API is very "unverbose" in my view, so I wouldn't mind a few more extra characters to type if it would mean that the API becomes more clear. |
Beta Was this translation helpful? Give feedback.
-
Currently, we combine the statement computation and the action of the query into a single function call, which is very ergonomic.
This can be suboptimal when, for example, I want to insert several new rows in a single transaction. I'll have to check multiple times for cached statements, which in the worst case results in multiple statement computation. If we decouple the statement from the query action, we could ensure a single cache lookup and statement calculation, the API would be more verbose though.
We cache the computed statements, which is a good default because our library encourages the reuse of some SQL queries, but there is no way to execute a query without statement computation or statement caching. We could use the declaration API to prove these features:
At the contrary
sqlx
use an uncached unprepared query as default, usingpersistent
to request a prepared cached statement.I'm not sure if this is necessary, as a cached prepared statement should suffice. I have also chosen not to show the generated code, but I can provide a hint if necessary.
Beta Was this translation helpful? Give feedback.
All reactions