36
36
*
37
37
* @author <a href="http://escoffier.me">Clement Escoffier</a>
38
38
*/
39
- public class AsyncSQLConnectionImpl implements SQLConnection {
39
+ public abstract class AsyncSQLConnectionImpl implements SQLConnection {
40
40
41
41
private final ExecutionContext executionContext ;
42
42
private volatile boolean inTransaction = false ;
@@ -51,6 +51,11 @@ public AsyncSQLConnectionImpl(Connection connection, AsyncConnectionPool pool, E
51
51
this .executionContext = executionContext ;
52
52
}
53
53
54
+ /**
55
+ * Returns a vendor specific start transaction statement
56
+ */
57
+ protected abstract String getStartTransactionStatement ();
58
+
54
59
@ Override
55
60
public SQLConnection call (String sql , Handler <AsyncResult <ResultSet >> resultHandler ) {
56
61
throw new UnsupportedOperationException ("Not implemented" );
@@ -63,7 +68,7 @@ public SQLConnection callWithParams(String sql, JsonArray params, JsonArray outp
63
68
64
69
@ Override
65
70
public SQLConnection setOptions (SQLOptions options ) {
66
- return null ;
71
+ throw new UnsupportedOperationException ( "Not implemented" ) ;
67
72
}
68
73
69
74
@ Override
@@ -287,7 +292,7 @@ private SQLConnection endAndStartTransaction(String command, Handler<AsyncResult
287
292
private synchronized void beginTransactionIfNeeded (Handler <AsyncResult <Void >> action ) {
288
293
if (!inAutoCommit && !inTransaction ) {
289
294
inTransaction = true ;
290
- ScalaUtils .scalaToVertxVoid (connection .sendQuery ("BEGIN" ), executionContext )
295
+ ScalaUtils .scalaToVertxVoid (connection .sendQuery (getStartTransactionStatement () ), executionContext )
291
296
.setHandler (action );
292
297
} else {
293
298
action .handle (Future .succeededFuture ());
0 commit comments