1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.sync;
19
20 import lombok.RequiredArgsConstructor;
21 import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
22 import org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLReadyForQueryPacket;
23 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
24 import org.apache.shardingsphere.proxy.frontend.command.executor.CommandExecutor;
25
26 import java.util.Collection;
27 import java.util.Collections;
28
29
30
31
32 @RequiredArgsConstructor
33 public final class PostgreSQLComSyncExecutor implements CommandExecutor {
34
35 private final ConnectionSession connectionSession;
36
37 @Override
38 public Collection<DatabasePacket> execute() {
39 return Collections.singleton(connectionSession.getTransactionStatus().isInTransaction() ? PostgreSQLReadyForQueryPacket.IN_TRANSACTION : PostgreSQLReadyForQueryPacket.NOT_IN_TRANSACTION);
40 }
41 }