1 /*
2  * Copyright (C) 2013 Brett Wooldridge
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package com.zaxxer.hikari.pool;
18
19 import java.sql.PreparedStatement;
20 import java.sql.ResultSet;
21 import java.sql.SQLException;
22
23 /**
24  * This is the proxy class for java.sql.PreparedStatement.
25  *
26  * @author Brett Wooldridge
27  */

28 public abstract class ProxyPreparedStatement extends ProxyStatement implements PreparedStatement
29 {
30    ProxyPreparedStatement(ProxyConnection connection, PreparedStatement statement)
31    {
32       super(connection, statement);
33    }
34
35    // **********************************************************************
36    //              Overridden java.sql.PreparedStatement Methods
37    // **********************************************************************
38
39    /** {@inheritDoc} */
40    @Override
41    public boolean execute() throws SQLException
42    {
43       connection.markCommitStateDirty();
44       return ((PreparedStatement) delegate).execute();
45    }
46
47    /** {@inheritDoc} */
48    @Override
49    public ResultSet executeQuery() throws SQLException
50    {
51       connection.markCommitStateDirty();
52       ResultSet resultSet = ((PreparedStatement) delegate).executeQuery();
53       return ProxyFactory.getProxyResultSet(connection, this, resultSet);
54    }
55
56    /** {@inheritDoc} */
57    @Override
58    public int executeUpdate() throws SQLException
59    {
60       connection.markCommitStateDirty();
61       return ((PreparedStatement) delegate).executeUpdate();
62    }
63
64    /** {@inheritDoc} */
65    @Override
66    public long executeLargeUpdate() throws SQLException
67    {
68       connection.markCommitStateDirty();
69       return ((PreparedStatement) delegate).executeLargeUpdate();
70    }
71 }
72