1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.sysvar.provider;
19
20 import org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.sysvar.MySQLSystemVariable;
21 import org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.sysvar.MySQLSystemVariableValueProvider;
22 import org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.sysvar.MySQLSystemVariableScope;
23 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
24 import org.apache.shardingsphere.sql.parser.statement.core.enums.TransactionIsolationLevel;
25
26
27
28
29 public final class TransactionIsolationValueProvider implements MySQLSystemVariableValueProvider {
30
31 @Override
32 public String get(final MySQLSystemVariableScope scope, final ConnectionSession connectionSession, final MySQLSystemVariable variable) {
33 return MySQLSystemVariableScope.GLOBAL == scope ? variable.getDefaultValue() : connectionSession.getIsolationLevel().orElse(TransactionIsolationLevel.REPEATABLE_READ).getIsolationLevel();
34 }
35 }