2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.sdnc.util.db;
24 import java.sql.Array;
26 import java.sql.CallableStatement;
28 import java.sql.Connection;
29 import java.sql.DatabaseMetaData;
30 import java.sql.NClob;
31 import java.sql.PreparedStatement;
32 import java.sql.SQLClientInfoException;
33 import java.sql.SQLException;
34 import java.sql.SQLWarning;
35 import java.sql.SQLXML;
36 import java.sql.Savepoint;
37 import java.sql.Statement;
38 import java.sql.Struct;
40 import java.util.Properties;
41 import java.util.concurrent.Executor;
43 public class ConnectionWrap implements Connection {
45 private Connection cc;
47 public ConnectionWrap(Connection cc) {
52 public Connection getCon() {
56 public void realClose() throws SQLException {
61 public <T> T unwrap(Class<T> iface) throws SQLException {
62 return cc.unwrap(iface);
66 public boolean isWrapperFor(Class<?> iface) throws SQLException {
67 return cc.isWrapperFor(iface);
71 public Statement createStatement() throws SQLException {
72 return cc.createStatement();
76 public PreparedStatement prepareStatement(String sql) throws SQLException {
77 return cc.prepareStatement(sql);
81 public CallableStatement prepareCall(String sql) throws SQLException {
82 return cc.prepareCall(sql);
86 public String nativeSQL(String sql) throws SQLException {
87 return cc.nativeSQL(sql);
91 public void setAutoCommit(boolean autoCommit) throws SQLException {
92 cc.setAutoCommit(autoCommit);
96 public boolean getAutoCommit() throws SQLException {
97 return cc.getAutoCommit();
101 public void commit() throws SQLException {
106 public void rollback() throws SQLException {
111 public void close() throws SQLException {
115 public boolean isClosed() throws SQLException {
116 return cc.isClosed();
120 public DatabaseMetaData getMetaData() throws SQLException {
121 return cc.getMetaData();
125 public void setReadOnly(boolean readOnly) throws SQLException {
126 cc.setReadOnly(readOnly);
130 public boolean isReadOnly() throws SQLException {
131 return cc.isReadOnly();
135 public void setCatalog(String catalog) throws SQLException {
136 cc.setCatalog(catalog);
140 public String getCatalog() throws SQLException {
141 return cc.getCatalog();
145 public void setTransactionIsolation(int level) throws SQLException {
146 cc.setTransactionIsolation(level);
150 public int getTransactionIsolation() throws SQLException {
151 return cc.getTransactionIsolation();
155 public SQLWarning getWarnings() throws SQLException {
156 return cc.getWarnings();
160 public void clearWarnings() throws SQLException {
165 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
166 return cc.createStatement(resultSetType, resultSetConcurrency);
170 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
171 throws SQLException {
172 return cc.prepareStatement(sql, resultSetType, resultSetConcurrency);
176 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
177 return cc.prepareCall(sql, resultSetType, resultSetConcurrency);
181 public Map<String, Class<?>> getTypeMap() throws SQLException {
182 return cc.getTypeMap();
186 public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
191 public void setHoldability(int holdability) throws SQLException {
192 cc.setHoldability(holdability);
196 public int getHoldability() throws SQLException {
197 return cc.getHoldability();
201 public Savepoint setSavepoint() throws SQLException {
202 return cc.setSavepoint();
206 public Savepoint setSavepoint(String name) throws SQLException {
207 return cc.setSavepoint(name);
211 public void rollback(Savepoint savepoint) throws SQLException {
212 cc.rollback(savepoint);
216 public void releaseSavepoint(Savepoint savepoint) throws SQLException {
217 cc.releaseSavepoint(savepoint);
221 public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
222 throws SQLException {
223 return cc.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
227 public PreparedStatement prepareStatement(
230 int resultSetConcurrency,
231 int resultSetHoldability) throws SQLException {
232 return cc.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
236 public CallableStatement prepareCall(
239 int resultSetConcurrency,
240 int resultSetHoldability) throws SQLException {
241 return cc.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
245 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
246 return cc.prepareStatement(sql, autoGeneratedKeys);
250 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
251 return cc.prepareStatement(sql, columnIndexes);
255 public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
256 return cc.prepareStatement(sql, columnNames);
260 public Clob createClob() throws SQLException {
261 return cc.createClob();
265 public Blob createBlob() throws SQLException {
266 return cc.createBlob();
270 public NClob createNClob() throws SQLException {
271 return cc.createNClob();
275 public SQLXML createSQLXML() throws SQLException {
276 return cc.createSQLXML();
280 public boolean isValid(int timeout) throws SQLException {
281 return cc.isValid(timeout);
285 public void setClientInfo(String name, String value) throws SQLClientInfoException {
286 cc.setClientInfo(name, value);
290 public void setClientInfo(Properties properties) throws SQLClientInfoException {
291 cc.setClientInfo(properties);
295 public String getClientInfo(String name) throws SQLException {
296 return cc.getClientInfo(name);
300 public Properties getClientInfo() throws SQLException {
301 return cc.getClientInfo();
305 public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
306 return cc.createArrayOf(typeName, elements);
310 public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
311 return cc.createStruct(typeName, attributes);
315 public void setSchema(String schema) throws SQLException {
316 cc.setSchema(schema);
320 public String getSchema() throws SQLException {
321 return cc.getSchema();
325 public void abort(Executor executor) throws SQLException {
330 public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
331 cc.setNetworkTimeout(executor, milliseconds);
335 public int getNetworkTimeout() throws SQLException {
336 return cc.getNetworkTimeout();