@@ -3,7 +3,7 @@ use futures_core::stream::BoxStream;
3
3
use futures_util:: { StreamExt , TryFutureExt , TryStreamExt } ;
4
4
5
5
use crate :: arguments:: IntoArguments ;
6
- use crate :: database:: { Database , HasArguments , HasStatement } ;
6
+ use crate :: database:: { Database , HasArguments , HasStatement , HasStatementCache } ;
7
7
use crate :: encode:: Encode ;
8
8
use crate :: error:: Error ;
9
9
use crate :: executor:: { Execute , Executor } ;
@@ -54,6 +54,24 @@ impl<'q, DB: Database, O> QueryScalar<'q, DB, O, <DB as HasArguments<'q>>::Argum
54
54
}
55
55
}
56
56
57
+ impl < ' q , DB , O , A > QueryScalar < ' q , DB , O , A >
58
+ where
59
+ DB : Database + HasStatementCache ,
60
+ {
61
+ /// If `true`, the statement will get prepared once and cached to the
62
+ /// connection's statement cache.
63
+ ///
64
+ /// If queried once with the flag set to `true`, all subsequent queries
65
+ /// matching the one with the flag will use the cached statement until the
66
+ /// cache is cleared.
67
+ ///
68
+ /// Default: `true`.
69
+ pub fn persistent ( mut self , value : bool ) -> Self {
70
+ self . inner = self . inner . persistent ( value) ;
71
+ self
72
+ }
73
+ }
74
+
57
75
// FIXME: This is very close, nearly 1:1 with `Map`
58
76
// noinspection DuplicatedCode
59
77
impl < ' q , DB , O , A > QueryScalar < ' q , DB , O , A >
0 commit comments