@@ -856,6 +856,14 @@ impl Connection {
856856 page_size : Option < PageSize > ,
857857 paging_state : PagingState ,
858858 ) -> Result < QueryResponse , RequestAttemptError > {
859+ let get_timestamp_from_gen = || {
860+ self . config
861+ . timestamp_generator
862+ . as_ref ( )
863+ . map ( |gen| gen. next_timestamp ( ) )
864+ } ;
865+ let timestamp = query. get_timestamp ( ) . or_else ( get_timestamp_from_gen) ;
866+
859867 let query_frame = query:: Query {
860868 contents : Cow :: Borrowed ( & query. contents ) ,
861869 parameters : query:: QueryParameters {
@@ -865,7 +873,7 @@ impl Connection {
865873 page_size : page_size. map ( Into :: into) ,
866874 paging_state,
867875 skip_metadata : false ,
868- timestamp : query . get_timestamp ( ) ,
876+ timestamp,
869877 } ,
870878 } ;
871879
@@ -918,14 +926,24 @@ impl Connection {
918926 page_size : Option < PageSize > ,
919927 paging_state : PagingState ,
920928 ) -> Result < QueryResponse , RequestAttemptError > {
929+ let get_timestamp_from_gen = || {
930+ self . config
931+ . timestamp_generator
932+ . as_ref ( )
933+ . map ( |gen| gen. next_timestamp ( ) )
934+ } ;
935+ let timestamp = prepared_statement
936+ . get_timestamp ( )
937+ . or_else ( get_timestamp_from_gen) ;
938+
921939 let execute_frame = execute:: Execute {
922940 id : prepared_statement. get_id ( ) . to_owned ( ) ,
923941 parameters : query:: QueryParameters {
924942 consistency,
925943 serial_consistency,
926944 values : Cow :: Borrowed ( values) ,
927945 page_size : page_size. map ( Into :: into) ,
928- timestamp : prepared_statement . get_timestamp ( ) ,
946+ timestamp,
929947 skip_metadata : prepared_statement. get_use_cached_result_metadata ( ) ,
930948 paging_state,
931949 } ,
@@ -1060,13 +1078,21 @@ impl Connection {
10601078
10611079 let values = RawBatchValuesAdapter :: new ( values, contexts) ;
10621080
1081+ let get_timestamp_from_gen = || {
1082+ self . config
1083+ . timestamp_generator
1084+ . as_ref ( )
1085+ . map ( |gen| gen. next_timestamp ( ) )
1086+ } ;
1087+ let timestamp = batch. get_timestamp ( ) . or_else ( get_timestamp_from_gen) ;
1088+
10631089 let batch_frame = batch:: Batch {
10641090 statements : Cow :: Borrowed ( & batch. statements ) ,
10651091 values,
10661092 batch_type : batch. get_type ( ) ,
10671093 consistency,
10681094 serial_consistency,
1069- timestamp : batch . get_timestamp ( ) ,
1095+ timestamp,
10701096 } ;
10711097
10721098 loop {
0 commit comments