@@ -1050,6 +1050,17 @@ impl Connection {
1050
1050
page_size : Option < PageSize > ,
1051
1051
paging_state : PagingState ,
1052
1052
) -> 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
+
1053
1064
let query_frame = query:: Query {
1054
1065
contents : Cow :: Borrowed ( & query. contents ) ,
1055
1066
parameters : query:: QueryParameters {
@@ -1059,7 +1070,7 @@ impl Connection {
1059
1070
page_size : page_size. map ( Into :: into) ,
1060
1071
paging_state,
1061
1072
skip_metadata : false ,
1062
- timestamp : query . get_timestamp ( ) ,
1073
+ timestamp,
1063
1074
} ,
1064
1075
} ;
1065
1076
@@ -1112,14 +1123,25 @@ impl Connection {
1112
1123
page_size : Option < PageSize > ,
1113
1124
paging_state : PagingState ,
1114
1125
) -> 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
+
1115
1137
let execute_frame = execute:: Execute {
1116
1138
id : prepared_statement. get_id ( ) . to_owned ( ) ,
1117
1139
parameters : query:: QueryParameters {
1118
1140
consistency,
1119
1141
serial_consistency,
1120
1142
values : Cow :: Borrowed ( values) ,
1121
1143
page_size : page_size. map ( Into :: into) ,
1122
- timestamp : prepared_statement . get_timestamp ( ) ,
1144
+ timestamp,
1123
1145
skip_metadata : prepared_statement. get_use_cached_result_metadata ( ) ,
1124
1146
paging_state,
1125
1147
} ,
@@ -1251,14 +1273,24 @@ impl Connection {
1251
1273
} ) ;
1252
1274
1253
1275
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
+ }
1254
1286
1255
1287
let batch_frame = batch:: Batch {
1256
1288
statements : Cow :: Borrowed ( & batch. statements ) ,
1257
1289
values,
1258
1290
batch_type : batch. get_type ( ) ,
1259
1291
consistency,
1260
1292
serial_consistency,
1261
- timestamp : batch . get_timestamp ( ) ,
1293
+ timestamp,
1262
1294
} ;
1263
1295
1264
1296
loop {
0 commit comments