@@ -856,6 +856,14 @@ impl Connection {
856
856
page_size : Option < PageSize > ,
857
857
paging_state : PagingState ,
858
858
) -> 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
+
859
867
let query_frame = query:: Query {
860
868
contents : Cow :: Borrowed ( & query. contents ) ,
861
869
parameters : query:: QueryParameters {
@@ -865,7 +873,7 @@ impl Connection {
865
873
page_size : page_size. map ( Into :: into) ,
866
874
paging_state,
867
875
skip_metadata : false ,
868
- timestamp : query . get_timestamp ( ) ,
876
+ timestamp,
869
877
} ,
870
878
} ;
871
879
@@ -918,14 +926,24 @@ impl Connection {
918
926
page_size : Option < PageSize > ,
919
927
paging_state : PagingState ,
920
928
) -> 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
+
921
939
let execute_frame = execute:: Execute {
922
940
id : prepared_statement. get_id ( ) . to_owned ( ) ,
923
941
parameters : query:: QueryParameters {
924
942
consistency,
925
943
serial_consistency,
926
944
values : Cow :: Borrowed ( values) ,
927
945
page_size : page_size. map ( Into :: into) ,
928
- timestamp : prepared_statement . get_timestamp ( ) ,
946
+ timestamp,
929
947
skip_metadata : prepared_statement. get_use_cached_result_metadata ( ) ,
930
948
paging_state,
931
949
} ,
@@ -1060,13 +1078,21 @@ impl Connection {
1060
1078
1061
1079
let values = RawBatchValuesAdapter :: new ( values, contexts) ;
1062
1080
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
+
1063
1089
let batch_frame = batch:: Batch {
1064
1090
statements : Cow :: Borrowed ( & batch. statements ) ,
1065
1091
values,
1066
1092
batch_type : batch. get_type ( ) ,
1067
1093
consistency,
1068
1094
serial_consistency,
1069
- timestamp : batch . get_timestamp ( ) ,
1095
+ timestamp,
1070
1096
} ;
1071
1097
1072
1098
loop {
0 commit comments