mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support spring Jdbc4NativeJdbcExtractor
This commit is contained in:
@@ -22,5 +22,5 @@ import java.sql.CallableStatement;
|
||||
*/
|
||||
public interface CallableStatementProxy extends CallableStatement, PreparedStatementProxy {
|
||||
|
||||
CallableStatement getRawCallableStatement();
|
||||
CallableStatement getRawObject();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.sql.Blob;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.Clob;
|
||||
import java.sql.NClob;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.Ref;
|
||||
import java.sql.RowId;
|
||||
import java.sql.SQLException;
|
||||
@@ -42,7 +43,7 @@ public class CallableStatementProxyImpl extends PreparedStatementProxyImpl imple
|
||||
this.statement = statement;
|
||||
}
|
||||
|
||||
public CallableStatement getRawCallableStatement() {
|
||||
public CallableStatement getRawObject() {
|
||||
return this.statement;
|
||||
}
|
||||
|
||||
@@ -609,4 +610,12 @@ public class CallableStatementProxyImpl extends PreparedStatementProxyImpl imple
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface == PreparedStatement.class) {
|
||||
return (T) statement;
|
||||
}
|
||||
|
||||
return super.unwrap(iface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Properties;
|
||||
*/
|
||||
public interface ConnectionProxy extends Connection, WrapperProxy {
|
||||
|
||||
Connection getConnectionRaw();
|
||||
Connection getRawObject();
|
||||
|
||||
Properties getProperties();
|
||||
|
||||
|
||||
@@ -71,6 +71,10 @@ public class ConnectionProxyImpl extends WrapperProxyImpl implements ConnectionP
|
||||
public Connection getConnectionRaw() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public Connection getRawObject() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public DataSourceProxy getDirectDataSource() {
|
||||
return this.dataSource;
|
||||
@@ -341,4 +345,12 @@ public class ConnectionProxyImpl extends WrapperProxyImpl implements ConnectionP
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface == Connection.class) {
|
||||
return (T) connection;
|
||||
}
|
||||
|
||||
return super.unwrap(iface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ public interface PreparedStatementProxy extends PreparedStatement, StatementProx
|
||||
|
||||
String getSql();
|
||||
|
||||
PreparedStatement getRawPreparedStatement();
|
||||
PreparedStatement getRawObject();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
return this.sql;
|
||||
}
|
||||
|
||||
public PreparedStatement getRawPreparedStatement() {
|
||||
public PreparedStatement getRawObject() {
|
||||
return this.statement;
|
||||
}
|
||||
|
||||
@@ -342,4 +342,13 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
public String getLastExecuteSql() {
|
||||
return this.sql;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface == PreparedStatement.class) {
|
||||
return (T) statement;
|
||||
}
|
||||
|
||||
return super.unwrap(iface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1050,4 +1050,12 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface == ResultSet.class) {
|
||||
return (T) resultSet;
|
||||
}
|
||||
|
||||
return super.unwrap(iface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public interface StatementProxy extends Statement, WrapperProxy {
|
||||
|
||||
ConnectionProxy getConnectionProxy();
|
||||
|
||||
Statement getStatementRaw();
|
||||
Statement getRawObject();
|
||||
|
||||
List<String> getBatchSqlList();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
return connection;
|
||||
}
|
||||
|
||||
public Statement getStatementRaw() {
|
||||
public Statement getRawObject() {
|
||||
return this.statement;
|
||||
}
|
||||
|
||||
@@ -314,4 +314,13 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
public boolean isCloseOnCompletion() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface == Statement.class) {
|
||||
return (T) statement;
|
||||
}
|
||||
|
||||
return super.unwrap(iface);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user