Search in sources :

Example 1 with NewProxyPreparedStatement

use of com.mchange.v2.c3p0.impl.NewProxyPreparedStatement in project druid by alibaba.

the class TestPSCache method unwrap.

public static MockPreparedStatement unwrap(PreparedStatement stmt) throws Exception {
    if (stmt instanceof NewProxyPreparedStatement) {
        Field field = NewProxyPreparedStatement.class.getDeclaredField("inner");
        field.setAccessible(true);
        return (MockPreparedStatement) field.get(stmt);
    }
    MockPreparedStatement mockStmt = stmt.unwrap(MockPreparedStatement.class);
    return mockStmt;
}
Also used : Field(java.lang.reflect.Field) NewProxyPreparedStatement(com.mchange.v2.c3p0.impl.NewProxyPreparedStatement) MockPreparedStatement(com.alibaba.druid.mock.MockPreparedStatement)

Aggregations

MockPreparedStatement (com.alibaba.druid.mock.MockPreparedStatement)1 NewProxyPreparedStatement (com.mchange.v2.c3p0.impl.NewProxyPreparedStatement)1 Field (java.lang.reflect.Field)1