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
{{ message }}
Repository navigation
sqlx does not allow setting persistence of QueryAs, QueryScalar #1503
sqlx provides functionality for setting the persistence of Query, but not QueryAs, QueryScalar.
In my case, I'm using caching to store parsed data from SQLite, and I only load data which is not in the cache, using WHERE ... IN (uncached_ids). However, each of these statements is very likely to be unique, which causes sqlx to cache a lot of similar statements and bloat memory usage in my application.
QueryAs wraps Query and QueryScalar wraps QueryAs so the implementation for the new methods would just be self.inner.persistent(value);
Ignore the persistent() method in the Execute impls, that's the getter for the set value and it's already implemented correctly for all three types; we should probably rename that to is_persistent() to be _con_sistent with Rust idioms but that can be done another time.
Activity
abonander commentedon Oct 20, 2021
This should be a pretty easy fix, just copy the method from
Query: https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/query.rs#L100QueryAswrapsQueryandQueryScalarwrapsQueryAsso the implementation for the new methods would just beself.inner.persistent(value);Ignore the
persistent()method in theExecuteimpls, that's the getter for the set value and it's already implemented correctly for all three types; we should probably rename that tois_persistent()to be _con_sistent with Rust idioms but that can be done another time.Add persistent setter (transact-rs#1503)
Add persistent setter (transact-rs#1503)
Add persistent setter (transact-rs#1503)
Add persistent setter (transact-rs#1503)
Add persistent setter (#1503) (#1508)
Merge launchbadge/sqlx master into JetASAP/sqlx master (#12)
Update ws-support (#15)