|
31 | 31 | import io.vertx.pgclient.impl.codec.NoticeResponse; |
32 | 32 | import io.vertx.pgclient.impl.codec.PgCodec; |
33 | 33 | import io.vertx.pgclient.impl.codec.PgCommandMessage; |
34 | | -import io.vertx.pgclient.impl.codec.TxFailedEvent; |
| 34 | +import io.vertx.pgclient.impl.codec.TxStatusEvent; |
35 | 35 | import io.vertx.sqlclient.codec.CommandMessage; |
36 | 36 | import io.vertx.sqlclient.codec.SocketConnectionBase; |
37 | 37 | import io.vertx.sqlclient.spi.connection.Connection; |
|
41 | 41 | import io.vertx.sqlclient.spi.protocol.CommandBase; |
42 | 42 | import io.vertx.sqlclient.spi.protocol.ExtendedQueryCommand; |
43 | 43 | import io.vertx.sqlclient.spi.protocol.InitCommand; |
| 44 | +import io.vertx.sqlclient.spi.protocol.SavepointCommand; |
44 | 45 | import io.vertx.sqlclient.spi.protocol.SimpleQueryCommand; |
45 | 46 | import io.vertx.sqlclient.spi.protocol.TxCommand; |
46 | 47 |
|
@@ -116,7 +117,7 @@ Future<Void> sendCancelRequestMessage(int processId, int secretKey) { |
116 | 117 | @Override |
117 | 118 | protected void handleMessage(Object msg) { |
118 | 119 | super.handleMessage(msg); |
119 | | - if (msg instanceof Notification || msg instanceof TxFailedEvent || msg instanceof NoticeResponse) { |
| 120 | + if (msg instanceof Notification || msg instanceof TxStatusEvent || msg instanceof NoticeResponse) { |
120 | 121 | handleEvent(msg); |
121 | 122 | } |
122 | 123 | } |
@@ -172,6 +173,15 @@ protected <R> void doSchedule(CommandBase<R> cmd, Completable<R> handler) { |
172 | 173 | SocketConnectionBase.NULL_COLLECTOR, |
173 | 174 | QueryResultHandler.NOOP_HANDLER); |
174 | 175 | super.doSchedule(cmd2, (res, err) -> handler.complete(tx.result(), err)); |
| 176 | + } else if (cmd instanceof SavepointCommand) { |
| 177 | + SavepointCommand<R> savepoint = (SavepointCommand<R>) cmd; |
| 178 | + SimpleQueryCommand<Void> cmd2 = new SimpleQueryCommand<>( |
| 179 | + savepoint.sql(), |
| 180 | + false, |
| 181 | + false, |
| 182 | + SocketConnectionBase.NULL_COLLECTOR, |
| 183 | + QueryResultHandler.NOOP_HANDLER); |
| 184 | + super.doSchedule(cmd2, (res, err) -> handler.complete(savepoint.result(), err)); |
175 | 185 | } else { |
176 | 186 | super.doSchedule(cmd, handler); |
177 | 187 | } |
|
0 commit comments