@@ -856,6 +856,14 @@ impl Connection {
856
856
page_size : Option < PageSize > ,
857
857
paging_state : PagingState ,
858
858
) -> Result < QueryResponse , UserRequestError > {
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 , UserRequestError > {
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
} ,
@@ -1058,13 +1076,21 @@ impl Connection {
1058
1076
1059
1077
let values = RawBatchValuesAdapter :: new ( values, contexts) ;
1060
1078
1079
+ let get_timestamp_from_gen = || {
1080
+ self . config
1081
+ . timestamp_generator
1082
+ . as_ref ( )
1083
+ . map ( |gen| gen. next_timestamp ( ) )
1084
+ } ;
1085
+ let timestamp = batch. get_timestamp ( ) . or_else ( get_timestamp_from_gen) ;
1086
+
1061
1087
let batch_frame = batch:: Batch {
1062
1088
statements : Cow :: Borrowed ( & batch. statements ) ,
1063
1089
values,
1064
1090
batch_type : batch. get_type ( ) ,
1065
1091
consistency,
1066
1092
serial_consistency,
1067
- timestamp : batch . get_timestamp ( ) ,
1093
+ timestamp,
1068
1094
} ;
1069
1095
1070
1096
loop {
0 commit comments