All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dromara.hutool.db.ds.pooled.ConnectionWrapper Maven / Gradle / Ivy

There is a newer version: 6.0.0.M3
Show newest version
/*
 * Copyright (c) 2013-2024 Hutool Team and hutool.cn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.dromara.hutool.db.ds.pooled;

import org.dromara.hutool.core.lang.wrapper.Wrapper;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;

/**
 * 连接包装,用于丰富功能
 * @author Looly
 *
 */
public abstract class ConnectionWrapper implements Connection, Wrapper {

	protected Connection raw;//真正的连接

	@Override
	public  T unwrap(final Class iface) throws SQLException {
		return raw.unwrap(iface);
	}

	@Override
	public boolean isWrapperFor(final Class iface) throws SQLException {
		return raw.isWrapperFor(iface);
	}

	@Override
	public Statement createStatement() throws SQLException {
		return raw.createStatement();
	}

	@Override
	public PreparedStatement prepareStatement(final String sql) throws SQLException {
		return raw.prepareStatement(sql);
	}

	@Override
	public CallableStatement prepareCall(final String sql) throws SQLException {
		return raw.prepareCall(sql);
	}

	@Override
	public String nativeSQL(final String sql) throws SQLException {
		return raw.nativeSQL(sql);
	}

	@Override
	public void setAutoCommit(final boolean autoCommit) throws SQLException {
		raw.setAutoCommit(autoCommit);
	}

	@Override
	public boolean getAutoCommit() throws SQLException {
		return raw.getAutoCommit();
	}

	@Override
	public void commit() throws SQLException {
		raw.commit();
	}

	@Override
	public void rollback() throws SQLException {
		raw.rollback();
	}

	@Override
	public DatabaseMetaData getMetaData() throws SQLException {
		return raw.getMetaData();
	}

	@Override
	public void setReadOnly(final boolean readOnly) throws SQLException {
		raw.setReadOnly(readOnly);
	}

	@Override
	public boolean isReadOnly() throws SQLException {
		return raw.isReadOnly();
	}

	@Override
	public void setCatalog(final String catalog) throws SQLException {
		raw.setCatalog(catalog);
	}

	@Override
	public String getCatalog() throws SQLException {
		return raw.getCatalog();
	}

	@Override
	public void setTransactionIsolation(final int level) throws SQLException {
		raw.setTransactionIsolation(level);
	}

	@Override
	public int getTransactionIsolation() throws SQLException {
		return raw.getTransactionIsolation();
	}

	@Override
	public SQLWarning getWarnings() throws SQLException {
		return raw.getWarnings();
	}

	@Override
	public void clearWarnings() throws SQLException {
		raw.clearWarnings();
	}

	@Override
	public Statement createStatement(final int resultSetType, final int resultSetConcurrency) throws SQLException {
		return raw.createStatement(resultSetType, resultSetConcurrency);
	}

	@Override
	public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException {
		return raw.prepareStatement(sql, resultSetType, resultSetConcurrency);
	}

	@Override
	public CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException {
		return raw.prepareCall(sql, resultSetType, resultSetConcurrency);
	}

	@Override
	public Map> getTypeMap() throws SQLException {
		return raw.getTypeMap();
	}

	@Override
	public void setTypeMap(final Map> map) throws SQLException {
		raw.setTypeMap(map);
	}

	@Override
	public void setHoldability(final int holdability) throws SQLException {
		raw.setHoldability(holdability);
	}

	@Override
	public int getHoldability() throws SQLException {
		return raw.getHoldability();
	}

	@Override
	public Savepoint setSavepoint() throws SQLException {
		return raw.setSavepoint();
	}

	@Override
	public Savepoint setSavepoint(final String name) throws SQLException {
		return raw.setSavepoint(name);
	}

	@Override
	public void rollback(final Savepoint savepoint) throws SQLException {
		raw.rollback(savepoint);
	}

	@Override
	public void releaseSavepoint(final Savepoint savepoint) throws SQLException {
		raw.releaseSavepoint(savepoint);
	}

	@Override
	public Statement createStatement(final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) throws SQLException {
		return raw.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	@Override
	public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) throws SQLException {
		return raw.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	@Override
	public CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) throws SQLException {
		return raw.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	@Override
	public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys) throws SQLException {
		return raw.prepareStatement(sql, autoGeneratedKeys);
	}

	@Override
	public PreparedStatement prepareStatement(final String sql, final int[] columnIndexes) throws SQLException {
		return raw.prepareStatement(sql, columnIndexes);
	}

	@Override
	public PreparedStatement prepareStatement(final String sql, final String[] columnNames) throws SQLException {
		return raw.prepareStatement(sql, columnNames);
	}

	@Override
	public Clob createClob() throws SQLException {
		return raw.createClob();
	}

	@Override
	public Blob createBlob() throws SQLException {
		return raw.createBlob();
	}

	@Override
	public NClob createNClob() throws SQLException {
		return raw.createNClob();
	}

	@Override
	public SQLXML createSQLXML() throws SQLException {
		return raw.createSQLXML();
	}

	@Override
	public boolean isValid(final int timeout) throws SQLException {
		return raw.isValid(timeout);
	}

	@Override
	public void setClientInfo(final String name, final String value) throws SQLClientInfoException {
		raw.setClientInfo(name, value);
	}

	@Override
	public void setClientInfo(final Properties properties) throws SQLClientInfoException {
		raw.setClientInfo(properties);
	}

	@Override
	public String getClientInfo(final String name) throws SQLException {
		return raw.getClientInfo(name);
	}

	@Override
	public Properties getClientInfo() throws SQLException {
		return raw.getClientInfo();
	}

	@Override
	public Array createArrayOf(final String typeName, final Object[] elements) throws SQLException {
		return raw.createArrayOf(typeName, elements);
	}

	@Override
	public Struct createStruct(final String typeName, final Object[] attributes) throws SQLException {
		return raw.createStruct(typeName, attributes);
	}

	@Override
	public void setSchema(final String schema) throws SQLException {
		raw.setSchema(schema);
	}

	@Override
	public String getSchema() throws SQLException {
		return raw.getSchema();
	}

	@Override
	public void abort(final Executor executor) throws SQLException {
		raw.abort(executor);
	}

	@Override
	public void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException {
		raw.setNetworkTimeout(executor, milliseconds);
	}

	@Override
	public int getNetworkTimeout() throws SQLException {
		return raw.getNetworkTimeout();
	}

	@Override
	public Connection getRaw(){
		return this.raw;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy