File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -386,14 +386,14 @@ impl QueryRouter {
386
386
}
387
387
}
388
388
389
- /// Determines if a query is mutable or not.
390
- fn query_is_mutable_statement ( q : & sqlparser:: ast:: Query ) -> bool {
389
+ /// Determines if a query is a mutation or not.
390
+ fn is_mutation_query ( q : & sqlparser:: ast:: Query ) -> bool {
391
391
use sqlparser:: ast:: * ;
392
392
393
393
match q. body . as_ref ( ) {
394
394
SetExpr :: Insert ( _) => true ,
395
395
SetExpr :: Update ( _) => true ,
396
- SetExpr :: Query ( q) => Self :: query_is_mutable_statement ( q) ,
396
+ SetExpr :: Query ( q) => Self :: is_mutation_query ( q) ,
397
397
_ => false ,
398
398
}
399
399
}
@@ -440,9 +440,9 @@ impl QueryRouter {
440
440
} ;
441
441
442
442
let has_locks = !query. locks . is_empty ( ) ;
443
- let is_mutable_statement = Self :: query_is_mutable_statement ( query) ;
443
+ let has_mutation = Self :: is_mutation_query ( query) ;
444
444
445
- if has_locks || is_mutable_statement {
445
+ if has_locks || has_mutation {
446
446
self . active_role = Some ( Role :: Primary ) ;
447
447
} else if !visited_write_statement {
448
448
// If we already visited a write statement, we should be going to the primary.
You can’t perform that action at this time.
0 commit comments