@@ -1050,6 +1050,17 @@ impl Connection {
10501050 page_size : Option < PageSize > ,
10511051 paging_state : PagingState ,
10521052 ) -> Result < QueryResponse , UserRequestError > {
1053+ let mut timestamp = None ;
1054+ if query. get_timestamp ( ) . is_none ( ) {
1055+ if let Some ( x) = self . config . timestamp_generator . clone ( ) {
1056+ timestamp = Some ( x. next_timestamp ( ) . await ) ;
1057+ }
1058+ }
1059+
1060+ if timestamp. is_none ( ) {
1061+ timestamp = query. get_timestamp ( )
1062+ }
1063+
10531064 let query_frame = query:: Query {
10541065 contents : Cow :: Borrowed ( & query. contents ) ,
10551066 parameters : query:: QueryParameters {
@@ -1059,7 +1070,7 @@ impl Connection {
10591070 page_size : page_size. map ( Into :: into) ,
10601071 paging_state,
10611072 skip_metadata : false ,
1062- timestamp : query . get_timestamp ( ) ,
1073+ timestamp,
10631074 } ,
10641075 } ;
10651076
@@ -1112,14 +1123,25 @@ impl Connection {
11121123 page_size : Option < PageSize > ,
11131124 paging_state : PagingState ,
11141125 ) -> Result < QueryResponse , UserRequestError > {
1126+ let mut timestamp = None ;
1127+ if prepared_statement. get_timestamp ( ) . is_none ( ) {
1128+ if let Some ( x) = self . config . timestamp_generator . clone ( ) {
1129+ timestamp = Some ( x. next_timestamp ( ) . await ) ;
1130+ }
1131+ }
1132+
1133+ if timestamp. is_none ( ) {
1134+ timestamp = prepared_statement. get_timestamp ( )
1135+ }
1136+
11151137 let execute_frame = execute:: Execute {
11161138 id : prepared_statement. get_id ( ) . to_owned ( ) ,
11171139 parameters : query:: QueryParameters {
11181140 consistency,
11191141 serial_consistency,
11201142 values : Cow :: Borrowed ( values) ,
11211143 page_size : page_size. map ( Into :: into) ,
1122- timestamp : prepared_statement . get_timestamp ( ) ,
1144+ timestamp,
11231145 skip_metadata : prepared_statement. get_use_cached_result_metadata ( ) ,
11241146 paging_state,
11251147 } ,
@@ -1251,14 +1273,24 @@ impl Connection {
12511273 } ) ;
12521274
12531275 let values = RawBatchValuesAdapter :: new ( values, contexts) ;
1276+ let mut timestamp = None ;
1277+ if batch. get_timestamp ( ) . is_none ( ) {
1278+ if let Some ( x) = self . config . timestamp_generator . clone ( ) {
1279+ timestamp = Some ( x. next_timestamp ( ) . await ) ;
1280+ }
1281+ }
1282+
1283+ if timestamp. is_none ( ) {
1284+ timestamp = batch. get_timestamp ( )
1285+ }
12541286
12551287 let batch_frame = batch:: Batch {
12561288 statements : Cow :: Borrowed ( & batch. statements ) ,
12571289 values,
12581290 batch_type : batch. get_type ( ) ,
12591291 consistency,
12601292 serial_consistency,
1261- timestamp : batch . get_timestamp ( ) ,
1293+ timestamp,
12621294 } ;
12631295
12641296 loop {
0 commit comments