Search in sources :

Example 1 with ClientPreparedStatement

use of com.mysql.cj.jdbc.ClientPreparedStatement in project JavaSegundasQuintas by ecteruel.

the class StatementRegressionTest method testBug25025.

/**
 * Tests fix for BUG#25025 - Client-side prepared statement parser gets confused by in-line (slash-star) comments and therefore can't rewrite batched
 * statements or reliably detect type of statements when they're used.
 *
 * @throws Exception
 */
@Test
public void testBug25025() throws Exception {
    Connection multiConn = null;
    createTable("testBug25025", "(field1 INT)");
    try {
        Properties props = new Properties();
        props.setProperty(PropertyKey.useSSL.getKeyName(), "false");
        props.setProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName(), "true");
        props.setProperty(PropertyKey.rewriteBatchedStatements.getKeyName(), "true");
        props.setProperty(PropertyKey.useServerPrepStmts.getKeyName(), "false");
        multiConn = getConnectionWithProps(props);
        this.pstmt = multiConn.prepareStatement("/* insert foo.bar.baz INSERT INTO foo VALUES (?,?,?,?) to trick parser */ INSERT into testBug25025 VALUES (?)");
        this.pstmt.setInt(1, 1);
        this.pstmt.addBatch();
        this.pstmt.setInt(1, 2);
        this.pstmt.addBatch();
        this.pstmt.setInt(1, 3);
        this.pstmt.addBatch();
        int[] counts = this.pstmt.executeBatch();
        assertEquals(3, counts.length);
        assertEquals(Statement.SUCCESS_NO_INFO, counts[0]);
        assertEquals(Statement.SUCCESS_NO_INFO, counts[1]);
        assertEquals(Statement.SUCCESS_NO_INFO, counts[2]);
        assertEquals(true, ((ClientPreparedStatement) this.pstmt).getParseInfo().canRewriteAsMultiValueInsertAtSqlLevel());
    } finally {
        if (multiConn != null) {
            multiConn.close();
        }
    }
}
Also used : ClientPreparedStatement(com.mysql.cj.jdbc.ClientPreparedStatement) ReplicationConnection(com.mysql.cj.jdbc.ha.ReplicationConnection) Connection(java.sql.Connection) XAConnection(javax.sql.XAConnection) JdbcConnection(com.mysql.cj.jdbc.JdbcConnection) MysqlConnection(com.mysql.cj.MysqlConnection) Properties(java.util.Properties) StatementsTest(testsuite.simple.StatementsTest) Test(org.junit.jupiter.api.Test)

Example 2 with ClientPreparedStatement

use of com.mysql.cj.jdbc.ClientPreparedStatement in project ABC by RuiPinto96274.

the class TranslateExceptions method main.

public static void main(String[] args) throws Exception {
    System.out.println("Applying TranslateExceptions.");
    verbose = "true".equalsIgnoreCase(args[1]);
    pool.insertClassPath(args[0]);
    processed.clear();
    runTimeException = pool.get(CJException.class.getName());
    // params classes
    // CtClass ctServerPreparedQueryBindValue = pool.get(ServerPreparedQueryBindValue.class.getName());
    CtClass ctQueryBindings = pool.get(QueryBindings.class.getName());
    CtClass ctByteArray = pool.get(byte[].class.getName());
    CtClass ctColumnDefinition = pool.get(ColumnDefinition.class.getName());
    CtClass ctLongArray = pool.get(long[].class.getName());
    // CtClass ctInputStream = pool.get(InputStream.class.getName());
    CtClass ctJdbcConnection = pool.get(JdbcConnection.class.getName());
    CtClass ctMysqlSavepoint = pool.get(MysqlSavepoint.class.getName());
    // CtClass ctPacketPayload = pool.get(PacketPayload.class.getName());
    CtClass ctProperties = pool.get(Properties.class.getName());
    CtClass ctResultSet = pool.get(ResultSet.class.getName());
    CtClass ctResultSetInternalMethods = pool.get(ResultSetInternalMethods.class.getName());
    CtClass ctStatement = pool.get(java.sql.Statement.class.getName());
    CtClass ctStatementImpl = pool.get(StatementImpl.class.getName());
    CtClass ctString = pool.get(String.class.getName());
    CtClass ctMessageBody = pool.get(Message.class.getName());
    // class we want to instrument
    CtClass clazz;
    /*
         * java.sql.Blob
         */
    // com.mysql.cj.jdbc.Blob implements java.sql.Blob, OutputStreamWatcher
    clazz = pool.get(Blob.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Blob.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.BlobFromLocator implements java.sql.Blob
    clazz = pool.get(BlobFromLocator.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Blob.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.CallableStatement
         */
    // com.mysql.cj.jdbc.CallableStatement extends PreparedStatement implements java.sql.CallableStatement
    clazz = pool.get(CallableStatement.class.getName());
    instrumentJdbcMethods(clazz, java.sql.CallableStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    instrumentJdbcMethods(clazz, JdbcStatement.class, true, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkIsOutputParam", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkParameterIndexBounds", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkReadOnlyProcedure", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("convertGetProcedureColumnsToInternalDescriptors", new CtClass[] { ctResultSet }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("determineParameterTypes", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("fakeParameterTypes", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("fixParameterName", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generateParameterMap", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getNamedParamIndex", new CtClass[] { ctString, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getOutputParameters", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("mapOutputParameterIndexToRsIndex", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("retrieveOutParams", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setInOutParamsOnServer", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setOutParams", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * com.mysql.cj.jdbc.StatementWrapper extends WrapperBase implements Statement
         */
    // TODO: Does it's own typical exception wrapping, could be instrumented with different catch method
    /*
         * com.mysql.cj.jdbc.PreparedStatementWrapper extends StatementWrapper implements PreparedStatement
         */
    // TODO: Does it's own typical exception wrapping, could be instrumented with different catch method
    /*
         * com.mysql.cj.jdbc.CallableStatementWrapper extends PreparedStatementWrapper implements CallableStatement
         */
    // TODO: Does it's own typical exception wrapping, could be instrumented with different catch method
    /*
         * java.sql.Clob
         */
    // com.mysql.cj.jdbc.Clob implements java.sql.Clob, OutputStreamWatcher, WriterWatcher
    clazz = pool.get(Clob.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Clob.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * 
         * java.sql.Connection extends java.sql.Wrapper
         * ----> com.mysql.cj.jdbc.JdbcConnection extends java.sql.Connection, MysqlConnection
         * ----------> com.mysql.cj.jdbc.ConnectionImpl
         * ----------> com.mysql.cj.jdbc.LoadBalancedConnection extends JdbcConnection
         * -------------> com.mysql.cj.jdbc.LoadBalancedMySQLConnection extends MultiHostMySQLConnection implements LoadBalancedConnection
         * ----------> com.mysql.cj.jdbc.MultiHostMySQLConnection
         * -------> com.mysql.cj.jdbc.ReplicationConnection implements JdbcConnection, PingTarget
         * -------> com.mysql.cj.jdbc.ConnectionWrapper
         */
    // ConnectionImpl extends AbstractJdbcConnection implements JdbcConnection
    clazz = pool.get(ConnectionImpl.class.getName());
    instrumentJdbcMethods(clazz, JdbcConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("clientPrepareStatement", new CtClass[] { ctString, CtClass.intType, CtClass.intType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("createNewIO", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getMetaData", new CtClass[] { CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("handleAutoCommitDefaults", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setSavepoint", new CtClass[] { ctMysqlSavepoint }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("versionMeetsMinimum", new CtClass[] { CtClass.intType, CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("rollbackNoChecks", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setupServerForTruncationChecks", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.LoadBalancedMySQLConnection extends MultiHostMySQLConnection implements LoadBalancedConnection
    clazz = pool.get(LoadBalancedMySQLConnection.class.getName());
    instrumentJdbcMethods(clazz, LoadBalancedConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // MultiHostMySQLConnection implements JdbcConnection
    clazz = pool.get(MultiHostMySQLConnection.class.getName());
    instrumentJdbcMethods(clazz, JdbcConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.ReplicationConnection implements JdbcConnection, PingTarget
    clazz = pool.get(ReplicationMySQLConnection.class.getName());
    instrumentJdbcMethods(clazz, ReplicationConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // ConnectionWrapper extends WrapperBase implements JdbcConnection
    clazz = pool.get(ConnectionWrapper.class.getName());
    instrumentJdbcMethods(clazz, JdbcConnection.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("clientPrepare", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_MEMBER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("clientPrepare", new CtClass[] { ctString, CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_MEMBER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setClientInfo", new CtClass[] { ctString, ctString }), EXCEPTION_INTERCEPTOR_MEMBER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setClientInfo", new CtClass[] { ctProperties }), EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.DatabaseMetaData extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.DatabaseMetaData implements java.sql.DatabaseMetaData
    clazz = pool.get(DatabaseMetaData.class.getName());
    instrumentJdbcMethods(clazz, java.sql.DatabaseMetaData.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema extends DatabaseMetaData
    clazz = pool.get(DatabaseMetaDataUsingInfoSchema.class.getName());
    instrumentJdbcMethods(clazz, java.sql.DatabaseMetaData.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.Driver
         */
    // com.mysql.cj.jdbc.Driver extends NonRegisteringDriver implements java.sql.Driver
    clazz = pool.get(NonRegisteringDriver.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Driver.class);
    clazz.writeFile(args[0]);
    /*
         * java.sql.NClob
         */
    // com.mysql.cj.jdbc.NClob extends Clob implements java.sql.NClob
    clazz = pool.get(NClob.class.getName());
    instrumentJdbcMethods(clazz, java.sql.NClob.class);
    clazz.writeFile(args[0]);
    /*
         * java.sql.ParameterMetaData extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.CallableStatement.CallableStatementParamInfo implements ParameterMetaData
    clazz = pool.get(CallableStatementParamInfo.class.getName());
    instrumentJdbcMethods(clazz, java.sql.ParameterMetaData.class);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.MysqlParameterMetadata implements ParameterMetaData
    clazz = pool.get(MysqlParameterMetadata.class.getName());
    instrumentJdbcMethods(clazz, java.sql.ParameterMetaData.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.PreparedStatement extends java.sql.Statement (java.sql.Statement extends java.sql.Wrapper)
         */
    // com.mysql.cj.jdbc.ClientPreparedStatement extends com.mysql.cj.jdbc.StatementImpl implements java.sql.PreparedStatement
    clazz = pool.get(ClientPreparedStatement.class.getName());
    instrumentJdbcMethods(clazz, java.sql.PreparedStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    instrumentJdbcMethods(clazz, JdbcStatement.class, true, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("asSql", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkBounds", new CtClass[] { CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkReadOnlySafeStatement", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeBatchedInserts", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeBatchSerially", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeInternal", new CtClass[] { CtClass.intType, ctMessageBody, CtClass.booleanType, CtClass.booleanType, ctColumnDefinition, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executePreparedBatchAsMultiStatement", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeUpdateInternal", new CtClass[] { CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeUpdateInternal", new CtClass[] { ctQueryBindings, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generateMultiStatementForBatch", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBytesRepresentation", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getParameterBindings", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("initializeFromParseInfo", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("isNull", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("prepareBatchedInsertSQL", new CtClass[] { ctJdbcConnection, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setBytes", new CtClass[] { CtClass.intType, ctByteArray, CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setRetrieveGeneratedKeys", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * com.mysql.cj.jdbc.ServerPreparedStatement extends ClientPreparedStatement
         */
    clazz = pool.get(ServerPreparedStatement.class.getName());
    instrumentJdbcMethods(clazz, java.sql.PreparedStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    instrumentJdbcMethods(clazz, JdbcStatement.class, true, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBinding", new CtClass[] { CtClass.intType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeInternal", new CtClass[] { CtClass.intType, ctMessageBody, CtClass.booleanType, CtClass.booleanType, ctColumnDefinition, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    // catchRuntimeException(clazz, clazz.getDeclaredMethod("canRewriteAsMultiValueInsertAtSqlLevel", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("realClose", new CtClass[] { CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("serverExecute", new CtClass[] { CtClass.intType, CtClass.booleanType, ctColumnDefinition }), EXCEPTION_INTERCEPTOR_GETTER);
    // catchRuntimeException(clazz, clazz.getDeclaredMethod("serverLongData", new CtClass[] { CtClass.intType, ctServerPreparedQueryBindValue }),
    // EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("serverPrepare", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.ResultSet extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.ResultSetImpl implements com.mysql.cj.jdbc.ResultSetInternalMethods (extends java.sql.ResultSet)
    clazz = pool.get(ResultSetImpl.class.getName());
    instrumentJdbcMethods(clazz, ResultSetInternalMethods.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.UpdatableResultSet extends ResultSetImpl
    clazz = pool.get(UpdatableResultSet.class.getName());
    instrumentJdbcMethods(clazz, ResultSetInternalMethods.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generateStatements", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.ResultSetMetaData extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.ResultSetMetaData implements java.sql.ResultSetMetaData
    clazz = pool.get(ResultSetMetaData.class.getName());
    instrumentJdbcMethods(clazz, java.sql.ResultSetMetaData.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.Savepoint
         */
    // com.mysql.cj.jdbc.MysqlSavepoint implements java.sql.Savepoint
    clazz = pool.get(MysqlSavepoint.class.getName());
    instrumentJdbcMethods(clazz, Savepoint.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.Statement extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.StatementImpl implements com.mysql.cj.jdbc.Statement (extends java.sql.Statement)
    clazz = pool.get(StatementImpl.class.getName());
    instrumentJdbcMethods(clazz, JdbcStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("createResultSetUsingServerFetch", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("doPingInstead", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeInternal", new CtClass[] { ctString, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeBatchUsingMultiQueries", new CtClass[] { CtClass.booleanType, CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeUpdateInternal", new CtClass[] { ctString, CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeSimpleNonQuery", new CtClass[] { ctJdbcConnection, ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generatePingResultSet", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBatchedGeneratedKeys", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBatchedGeneratedKeys", new CtClass[] { ctStatement }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getGeneratedKeysInternal", new CtClass[] { CtClass.longType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getLastInsertID", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getLongUpdateCount", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getOpenResultSetCount", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getResultSetInternal", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("processMultiCountsAndKeys", new CtClass[] { ctStatementImpl, CtClass.intType, ctLongArray }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("removeOpenResultSet", new CtClass[] { ctResultSetInternalMethods }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("resetCancelledState", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setHoldResultsOpenOverClose", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setResultSetConcurrency", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("useServerFetch", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkCancelTimeout", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.SQLXML
         */
    // com.mysql.cj.jdbc.MysqlSQLXML implements SQLXML
    clazz = pool.get(MysqlSQLXML.class.getName());
    instrumentJdbcMethods(clazz, java.sql.SQLXML.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.ConnectionPoolDataSource
         */
    // MysqlConnectionPoolDataSource extends MysqlDataSource implements ConnectionPoolDataSource
    clazz = pool.get(MysqlConnectionPoolDataSource.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.ConnectionPoolDataSource.class);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.DataSource
         */
    // MysqlDataSource extends JdbcPropertySetImpl implements DataSource, Referenceable, Serializable, JdbcPropertySet
    clazz = pool.get(MysqlDataSource.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.DataSource.class);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getStringRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setStringRuntimeProperty", new CtClass[] { ctString, ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBooleanRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setBooleanRuntimeProperty", new CtClass[] { ctString, CtClass.booleanType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getIntegerRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setIntegerRuntimeProperty", new CtClass[] { ctString, CtClass.intType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getLongRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setLongRuntimeProperty", new CtClass[] { ctString, CtClass.longType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getMemorySizeRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setMemorySizeRuntimeProperty", new CtClass[] { ctString, CtClass.intType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getEnumRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setEnumRuntimeProperty", new CtClass[] { ctString, ctString }), null);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.PooledConnection
         */
    // com.mysql.cj.jdbc.MysqlPooledConnection
    clazz = pool.get(MysqlPooledConnection.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.PooledConnection.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.XAConnection
         * javax.transaction.xa.XAResource
         */
    // com.mysql.cj.jdbc.MysqlXAConnection extends MysqlPooledConnection implements XAConnection, XAResource
    clazz = pool.get(MysqlXAConnection.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.XAConnection.class);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.SuspendableXAConnection extends MysqlPooledConnection implements XAConnection, XAResource
    clazz = pool.get(SuspendableXAConnection.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.XAConnection.class);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.XADataSource
         */
    // com.mysql.cj.jdbc.MysqlXADataSource extends MysqlDataSource implements javax.sql.XADataSource
    clazz = pool.get(MysqlXADataSource.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.DataSource.class);
    instrumentJdbcMethods(clazz, javax.sql.XADataSource.class);
    clazz.writeFile(args[0]);
    /*
         * javax.transaction.xa.Xid
         */
    // com.mysql.cj.jdbc.MysqlXid implements Xid
    clazz = pool.get(MysqlXid.class.getName());
    instrumentJdbcMethods(clazz, javax.transaction.xa.Xid.class);
    clazz.writeFile(args[0]);
/*
         * TODO:
         * java.sql.DataTruncation
         */
// com.mysql.cj.jdbc.exceptions.MysqlDataTruncation extends DataTruncation
/*
         * TODO:
         * java.sql.SQLException
         */
// com.mysql.cj.jdbc.exceptions.NotUpdatable extends SQLException
// com.mysql.cj.jdbc.exceptions.OperationNotSupportedException extends SQLException
// com.mysql.cj.jdbc.exceptions.PacketTooBigException extends SQLException
/*
         * TODO:
         * java.sql.SQLNonTransientException
         */
// com.mysql.cj.jdbc.exceptions.MySQLQueryInterruptedException extends SQLNonTransientException
// com.mysql.cj.jdbc.exceptions.MySQLStatementCancelledException extends SQLNonTransientException
/*
         * TODO:
         * java.sql.SQLRecoverableException
         */
// com.mysql.cj.jdbc.exceptions.CommunicationsException extends SQLRecoverableException implements StreamingNotifiable
// ---> com.mysql.cj.jdbc.exceptions.ConnectionFeatureNotAvailableException extends CommunicationsException
/*
         * TODO:
         * java.sql.SQLTransientException
         * ---> java.sql.SQLTimeoutException
         */
// com.mysql.cj.jdbc.exceptions.MySQLTimeoutException extends SQLTimeoutException
/*
         * TODO:
         * java.sql.SQLTransientException
         * ---> java.sql.SQLTransactionRollbackException
         */
// com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException extends SQLTransactionRollbackException implements DeadlockTimeoutRollbackMarker
/*
         * TODO:
         * com.mysql.cj.jdbc.MysqlXAException extends javax.transaction.xa.XAException
         */
/*
         * These classes have no implementations in c/J:
         * 
         * java.sql.Array
         * java.sql.BatchUpdateException
         * java.sql.ClientInfoStatus
         * java.sql.Date
         * java.sql.DriverManager
         * java.sql.DriverPropertyInfo
         * java.sql.PseudoColumnUsage
         * java.sql.Ref
         * java.sql.RowId
         * java.sql.RowIdLifetime
         * java.sql.SQLClientInfoException
         * java.sql.SQLData
         * java.sql.SQLDataException
         * java.sql.SQLFeatureNotSupportedException
         * java.sql.SQLInput
         * java.sql.SQLIntegrityConstraintViolationException
         * java.sql.SQLInvalidAuthorizationSpecException
         * java.sql.SQLNonTransientConnectionException
         * java.sql.SQLOutput
         * java.sql.SQLPermission
         * java.sql.SQLSyntaxErrorException
         * java.sql.SQLTransientConnectionException
         * java.sql.SQLWarning
         * java.sql.Struct
         * java.sql.Time
         * java.sql.Timestamp
         * java.sql.Types
         * 
         * javax.sql.CommonDataSource
         * javax.sql.ConnectionEvent
         * javax.sql.ConnectionEventListener
         * javax.sql.RowSet
         * javax.sql.RowSetEvent
         * javax.sql.RowSetInternal
         * javax.sql.RowSetListener
         * javax.sql.RowSetMetaData
         * javax.sql.RowSetReader
         * javax.sql.RowSetWriter
         * javax.sql.StatementEvent
         * javax.sql.StatementEventListener
         * 
         * javax.sql.rowset.BaseRowSet
         * javax.sql.rowset.CachedRowSet
         * javax.sql.rowset.FilteredRowSet
         * javax.sql.rowset.JdbcRowSet
         * javax.sql.rowset.Joinable
         * javax.sql.rowset.JoinRowSet
         * javax.sql.rowset.Predicate
         * javax.sql.rowset.RowSetFactory
         * javax.sql.rowset.RowSetMetaDataImpl
         * javax.sql.rowset.RowSetProvider
         * javax.sql.rowset.RowSetWarning
         * javax.sql.rowset.WebRowSet
         * 
         * javax.sql.rowset.serial.SerialArray
         * javax.sql.rowset.serial.SerialBlob
         * javax.sql.rowset.serial.SerialClob
         * javax.sql.rowset.serial.SerialDatalink
         * javax.sql.rowset.serial.SerialException
         * javax.sql.rowset.serial.SerialJavaObject
         * javax.sql.rowset.serial.SerialRef
         * javax.sql.rowset.serial.SerialStruct
         * javax.sql.rowset.serial.SQLInputImpl
         * javax.sql.rowset.serial.SQLOutputImpl
         * 
         * javax.sql.rowset.spi.SyncFactory
         * javax.sql.rowset.spi.SyncFactoryException
         * javax.sql.rowset.spi.SyncProvider
         * javax.sql.rowset.spi.SyncProviderException
         * javax.sql.rowset.spi.SyncResolver
         * javax.sql.rowset.spi.TransactionalWriter
         * javax.sql.rowset.spi.XmlReader
         * javax.sql.rowset.spi.XmlWriter
         */
}
Also used : Message(com.mysql.cj.protocol.Message) QueryBindings(com.mysql.cj.QueryBindings) JdbcStatement(com.mysql.cj.jdbc.JdbcStatement) CallableStatement(com.mysql.cj.jdbc.CallableStatement) ServerPreparedStatement(com.mysql.cj.jdbc.ServerPreparedStatement) ClientPreparedStatement(com.mysql.cj.jdbc.ClientPreparedStatement) MysqlSavepoint(com.mysql.cj.jdbc.MysqlSavepoint) JdbcConnection(com.mysql.cj.jdbc.JdbcConnection) Properties(java.util.Properties) ColumnDefinition(com.mysql.cj.protocol.ColumnDefinition) CtClass(javassist.CtClass) ResultSetInternalMethods(com.mysql.cj.jdbc.result.ResultSetInternalMethods) StatementImpl(com.mysql.cj.jdbc.StatementImpl) ResultSet(java.sql.ResultSet) UpdatableResultSet(com.mysql.cj.jdbc.result.UpdatableResultSet)

Example 3 with ClientPreparedStatement

use of com.mysql.cj.jdbc.ClientPreparedStatement in project ABC by RuiPinto96274.

the class SyntaxRegressionTest method testTransportableTablespaces.

/**
 * Test case for transportable tablespaces syntax support:
 *
 * FLUSH TABLES ... FOR EXPORT
 * ALTER TABLE ... DISCARD TABLESPACE
 * ALTER TABLE ... IMPORT TABLESPACE
 *
 * Requires a MySQL server running locally.
 *
 * @throws Exception
 */
@Test
public void testTransportableTablespaces() throws Exception {
    assumeTrue(versionMeetsMinimum(5, 6, 8), "MySQL 5.6.8+ is required to run this test.");
    assumeTrue(isMysqlRunningLocally(), "Skip test as client and server are running on different machines.");
    String tmpdir = null;
    String uuid = null;
    this.rs = this.stmt.executeQuery("SHOW VARIABLES WHERE Variable_name='tmpdir' or Variable_name='innodb_file_per_table' or Variable_name='server_uuid'");
    while (this.rs.next()) {
        if ("tmpdir".equals(this.rs.getString(1))) {
            tmpdir = this.rs.getString(2);
            if (tmpdir.endsWith(File.separator)) {
                tmpdir = tmpdir.substring(0, tmpdir.length() - File.separator.length());
            }
            assumeFalse(versionMeetsMinimum(8, 0, 21) && !getMysqlVariable("innodb_directories").contains(tmpdir), "testTransportableTablespaces: server must be initialized with '--innodb-directories=\"<dir>\"' " + "where <dir> is the same value as the system variable 'tmpdir'.");
        } else if ("innodb_file_per_table".equals(this.rs.getString(1))) {
            assumeTrue(this.rs.getString(2).equals("ON"), "You need to set innodb_file_per_table to ON before running this test!");
        } else if ("server_uuid".equals(this.rs.getString(1))) {
            uuid = this.rs.getString(2);
        }
    }
    if (uuid != null) {
        tmpdir = tmpdir + File.separator + uuid;
    }
    if (File.separatorChar == '\\') {
        tmpdir = StringUtils.escapeQuote(tmpdir, File.separator);
    }
    Properties props = getPropertiesFromTestsuiteUrl();
    String dbname = props.getProperty(PropertyKey.DBNAME.getKeyName());
    if (dbname == null) {
        assertTrue(false, "No database selected");
    }
    dropTable("testTransportableTablespaces1");
    dropTable("testTransportableTablespaces2");
    File checkTableSpaceFile1 = new File(tmpdir + File.separator + dbname + File.separator + "testTransportableTablespaces1.ibd");
    if (checkTableSpaceFile1.exists()) {
        checkTableSpaceFile1.delete();
    }
    File checkTableSpaceFile2 = new File(tmpdir + File.separator + dbname + File.separator + "testTransportableTablespaces2.ibd");
    if (checkTableSpaceFile2.exists()) {
        checkTableSpaceFile2.delete();
    }
    try {
        createTable("testTransportableTablespaces1", "(x VARCHAR(10) NOT NULL DEFAULT '') DATA DIRECTORY = '" + tmpdir + "'");
        createTable("testTransportableTablespaces2", "(x VARCHAR(10) NOT NULL DEFAULT '') DATA DIRECTORY = '" + tmpdir + "'");
        this.stmt.executeUpdate("FLUSH TABLES testTransportableTablespaces1, testTransportableTablespaces2 FOR EXPORT");
        this.stmt.executeUpdate("UNLOCK TABLES");
        File tempFile = File.createTempFile("testTransportableTablespaces1", "tmp");
        tempFile.deleteOnExit();
        String tableSpacePath = tmpdir + File.separator + dbname + File.separator + "testTransportableTablespaces1.ibd";
        File tableSpaceFile = new File(tableSpacePath);
        copyFile(tableSpaceFile, tempFile);
        this.stmt.executeUpdate("ALTER TABLE testTransportableTablespaces1 DISCARD TABLESPACE");
        tableSpaceFile = new File(tableSpacePath);
        copyFile(tempFile, tableSpaceFile);
        this.stmt.executeUpdate("ALTER TABLE testTransportableTablespaces1 IMPORT TABLESPACE");
        this.pstmt = this.conn.prepareStatement("FLUSH TABLES testTransportableTablespaces1, testTransportableTablespaces2 FOR EXPORT");
        assertTrue(this.pstmt instanceof ClientPreparedStatement);
        this.pstmt = this.conn.prepareStatement("ALTER TABLE testTransportableTablespaces1 DISCARD TABLESPACE");
        assertTrue(this.pstmt instanceof ClientPreparedStatement);
        this.pstmt = this.conn.prepareStatement("ALTER TABLE testTransportableTablespaces1 IMPORT TABLESPACE");
        assertTrue(this.pstmt instanceof ClientPreparedStatement);
    } finally {
        // we need to drop them even if retainArtifacts=true, otherwise temp files could be deleted by OS and DB become corrupted
        dropTable("testTransportableTablespaces1");
        dropTable("testTransportableTablespaces2");
    }
}
Also used : ClientPreparedStatement(com.mysql.cj.jdbc.ClientPreparedStatement) Properties(java.util.Properties) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 4 with ClientPreparedStatement

use of com.mysql.cj.jdbc.ClientPreparedStatement in project JavaSegundasQuintas by ecteruel.

the class StatementsTest method testSetNCharacterStream.

/**
 * Tests for PreparedStatement.setNCharacterSteam()
 *
 * @throws Exception
 */
@Test
public void testSetNCharacterStream() throws Exception {
    // suppose sql_mode don't include "NO_BACKSLASH_ESCAPES"
    createTable("testSetNCharacterStream", "(c1 NATIONAL CHARACTER(10), c2 NATIONAL CHARACTER(10), " + "c3 NATIONAL CHARACTER(10)) ENGINE=InnoDB");
    Properties props1 = new Properties();
    props1.setProperty(PropertyKey.sslMode.getKeyName(), "DISABLED");
    props1.setProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName(), "true");
    // use client-side prepared statement
    props1.setProperty(PropertyKey.useServerPrepStmts.getKeyName(), "false");
    // ensure charset isn't utf8 here
    props1.setProperty(PropertyKey.characterEncoding.getKeyName(), "latin1");
    Connection conn1 = getConnectionWithProps(props1);
    ClientPreparedStatement pstmt1 = (ClientPreparedStatement) conn1.prepareStatement("INSERT INTO testSetNCharacterStream (c1, c2, c3) VALUES (?, ?, ?)");
    pstmt1.setNCharacterStream(1, null, 0);
    pstmt1.setNCharacterStream(2, new StringReader("aaa"), 3);
    pstmt1.setNCharacterStream(3, new StringReader("\'aaa\'"), 5);
    pstmt1.execute();
    ResultSet rs1 = this.stmt.executeQuery("SELECT c1, c2, c3 FROM testSetNCharacterStream");
    rs1.next();
    assertEquals(null, rs1.getString(1));
    assertEquals("aaa", rs1.getString(2));
    assertEquals("\'aaa\'", rs1.getString(3));
    rs1.close();
    pstmt1.close();
    conn1.close();
    createTable("testSetNCharacterStream", "(c1 NATIONAL CHARACTER(10), c2 NATIONAL CHARACTER(10), " + "c3 NATIONAL CHARACTER(10)) ENGINE=InnoDB");
    Properties props2 = new Properties();
    props2.setProperty(PropertyKey.sslMode.getKeyName(), "DISABLED");
    props2.setProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName(), "true");
    // use client-side prepared statement
    props2.setProperty(PropertyKey.useServerPrepStmts.getKeyName(), "false");
    // ensure charset is utf8 here
    props2.setProperty(PropertyKey.characterEncoding.getKeyName(), "UTF-8");
    Connection conn2 = getConnectionWithProps(props2);
    ClientPreparedStatement pstmt2 = (ClientPreparedStatement) conn2.prepareStatement("INSERT INTO testSetNCharacterStream (c1, c2, c3) VALUES (?, ?, ?)");
    pstmt2.setNCharacterStream(1, null, 0);
    pstmt2.setNCharacterStream(2, new StringReader("aaa"), 3);
    pstmt2.setNCharacterStream(3, new StringReader("\'aaa\'"), 5);
    pstmt2.execute();
    ResultSet rs2 = this.stmt.executeQuery("SELECT c1, c2, c3 FROM testSetNCharacterStream");
    rs2.next();
    assertEquals(null, rs2.getString(1));
    assertEquals("aaa", rs2.getString(2));
    assertEquals("\'aaa\'", rs2.getString(3));
    rs2.close();
    pstmt2.close();
    conn2.close();
}
Also used : ClientPreparedStatement(com.mysql.cj.jdbc.ClientPreparedStatement) Connection(java.sql.Connection) JdbcConnection(com.mysql.cj.jdbc.JdbcConnection) MysqlConnection(com.mysql.cj.MysqlConnection) StringReader(java.io.StringReader) ResultSet(java.sql.ResultSet) Properties(java.util.Properties) Test(org.junit.jupiter.api.Test)

Example 5 with ClientPreparedStatement

use of com.mysql.cj.jdbc.ClientPreparedStatement in project aws-mysql-jdbc by awslabs.

the class TranslateExceptions method main.

public static void main(String[] args) throws Exception {
    System.out.println("Applying TranslateExceptions.");
    verbose = "true".equalsIgnoreCase(args[1]);
    pool.insertClassPath(args[0]);
    processed.clear();
    runTimeException = pool.get(CJException.class.getName());
    // params classes
    // CtClass ctServerPreparedQueryBindValue = pool.get(ServerPreparedQueryBindValue.class.getName());
    CtClass ctQueryBindings = pool.get(QueryBindings.class.getName());
    CtClass ctByteArray = pool.get(byte[].class.getName());
    CtClass ctColumnDefinition = pool.get(ColumnDefinition.class.getName());
    CtClass ctLongArray = pool.get(long[].class.getName());
    // CtClass ctInputStream = pool.get(InputStream.class.getName());
    CtClass ctJdbcConnection = pool.get(JdbcConnection.class.getName());
    CtClass ctMysqlSavepoint = pool.get(MysqlSavepoint.class.getName());
    // CtClass ctPacketPayload = pool.get(PacketPayload.class.getName());
    CtClass ctProperties = pool.get(Properties.class.getName());
    CtClass ctResultSet = pool.get(ResultSet.class.getName());
    CtClass ctResultSetInternalMethods = pool.get(ResultSetInternalMethods.class.getName());
    CtClass ctStatement = pool.get(java.sql.Statement.class.getName());
    CtClass ctStatementImpl = pool.get(StatementImpl.class.getName());
    CtClass ctString = pool.get(String.class.getName());
    CtClass ctMessageBody = pool.get(Message.class.getName());
    // class we want to instrument
    CtClass clazz;
    /*
         * java.sql.Blob
         */
    // com.mysql.cj.jdbc.Blob implements java.sql.Blob, OutputStreamWatcher
    clazz = pool.get(Blob.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Blob.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.BlobFromLocator implements java.sql.Blob
    clazz = pool.get(BlobFromLocator.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Blob.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.CallableStatement
         */
    // com.mysql.cj.jdbc.CallableStatement extends PreparedStatement implements java.sql.CallableStatement
    clazz = pool.get(CallableStatement.class.getName());
    instrumentJdbcMethods(clazz, java.sql.CallableStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    instrumentJdbcMethods(clazz, JdbcStatement.class, true, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkIsOutputParam", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkParameterIndexBounds", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkReadOnlyProcedure", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("convertGetProcedureColumnsToInternalDescriptors", new CtClass[] { ctResultSet }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("determineParameterTypes", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("fakeParameterTypes", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("fixParameterName", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generateParameterMap", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getNamedParamIndex", new CtClass[] { ctString, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getOutputParameters", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("mapOutputParameterIndexToRsIndex", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("retrieveOutParams", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setInOutParamsOnServer", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setOutParams", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * com.mysql.cj.jdbc.StatementWrapper extends WrapperBase implements Statement
         */
    // TODO: Does it's own typical exception wrapping, could be instrumented with different catch method
    /*
         * com.mysql.cj.jdbc.PreparedStatementWrapper extends StatementWrapper implements PreparedStatement
         */
    // TODO: Does it's own typical exception wrapping, could be instrumented with different catch method
    /*
         * com.mysql.cj.jdbc.CallableStatementWrapper extends PreparedStatementWrapper implements CallableStatement
         */
    // TODO: Does it's own typical exception wrapping, could be instrumented with different catch method
    /*
         * java.sql.Clob
         */
    // com.mysql.cj.jdbc.Clob implements java.sql.Clob, OutputStreamWatcher, WriterWatcher
    clazz = pool.get(Clob.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Clob.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * 
         * java.sql.Connection extends java.sql.Wrapper
         * ----> com.mysql.cj.jdbc.JdbcConnection extends java.sql.Connection, MysqlConnection
         * ----------> com.mysql.cj.jdbc.ConnectionImpl
         * ----------> com.mysql.cj.jdbc.LoadBalancedConnection extends JdbcConnection
         * -------------> com.mysql.cj.jdbc.LoadBalancedMySQLConnection extends MultiHostMySQLConnection implements LoadBalancedConnection
         * ----------> com.mysql.cj.jdbc.MultiHostMySQLConnection
         * -------> com.mysql.cj.jdbc.ReplicationConnection implements JdbcConnection, PingTarget
         * -------> com.mysql.cj.jdbc.ConnectionWrapper
         */
    // ConnectionImpl extends AbstractJdbcConnection implements JdbcConnection
    clazz = pool.get(ConnectionImpl.class.getName());
    instrumentJdbcMethods(clazz, JdbcConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("clientPrepareStatement", new CtClass[] { ctString, CtClass.intType, CtClass.intType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("createNewIO", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getMetaData", new CtClass[] { CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("handleAutoCommitDefaults", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setSavepoint", new CtClass[] { ctMysqlSavepoint }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("versionMeetsMinimum", new CtClass[] { CtClass.intType, CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("rollbackNoChecks", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setupServerForTruncationChecks", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.LoadBalancedMySQLConnection extends MultiHostMySQLConnection implements LoadBalancedConnection
    clazz = pool.get(LoadBalancedMySQLConnection.class.getName());
    instrumentJdbcMethods(clazz, LoadBalancedConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // MultiHostMySQLConnection implements JdbcConnection
    clazz = pool.get(MultiHostMySQLConnection.class.getName());
    instrumentJdbcMethods(clazz, JdbcConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.ReplicationConnection implements JdbcConnection, PingTarget
    clazz = pool.get(ReplicationMySQLConnection.class.getName());
    instrumentJdbcMethods(clazz, ReplicationConnection.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // ConnectionWrapper extends WrapperBase implements JdbcConnection
    clazz = pool.get(ConnectionWrapper.class.getName());
    instrumentJdbcMethods(clazz, JdbcConnection.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("clientPrepare", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_MEMBER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("clientPrepare", new CtClass[] { ctString, CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_MEMBER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setClientInfo", new CtClass[] { ctString, ctString }), EXCEPTION_INTERCEPTOR_MEMBER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setClientInfo", new CtClass[] { ctProperties }), EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.DatabaseMetaData extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.DatabaseMetaData implements java.sql.DatabaseMetaData
    clazz = pool.get(DatabaseMetaData.class.getName());
    instrumentJdbcMethods(clazz, java.sql.DatabaseMetaData.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema extends DatabaseMetaData
    clazz = pool.get(DatabaseMetaDataUsingInfoSchema.class.getName());
    instrumentJdbcMethods(clazz, java.sql.DatabaseMetaData.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.Driver
         */
    // com.mysql.cj.jdbc.Driver extends NonRegisteringDriver implements java.sql.Driver
    clazz = pool.get(NonRegisteringDriver.class.getName());
    instrumentJdbcMethods(clazz, java.sql.Driver.class);
    clazz.writeFile(args[0]);
    /*
         * java.sql.NClob
         */
    // com.mysql.cj.jdbc.NClob extends Clob implements java.sql.NClob
    clazz = pool.get(NClob.class.getName());
    instrumentJdbcMethods(clazz, java.sql.NClob.class);
    clazz.writeFile(args[0]);
    /*
         * java.sql.ParameterMetaData extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.CallableStatement.CallableStatementParamInfo implements ParameterMetaData
    clazz = pool.get(CallableStatementParamInfo.class.getName());
    instrumentJdbcMethods(clazz, java.sql.ParameterMetaData.class);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.MysqlParameterMetadata implements ParameterMetaData
    clazz = pool.get(MysqlParameterMetadata.class.getName());
    instrumentJdbcMethods(clazz, java.sql.ParameterMetaData.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.PreparedStatement extends java.sql.Statement (java.sql.Statement extends java.sql.Wrapper)
         */
    // com.mysql.cj.jdbc.ClientPreparedStatement extends com.mysql.cj.jdbc.StatementImpl implements java.sql.PreparedStatement
    clazz = pool.get(ClientPreparedStatement.class.getName());
    instrumentJdbcMethods(clazz, java.sql.PreparedStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    instrumentJdbcMethods(clazz, JdbcStatement.class, true, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("asSql", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkBounds", new CtClass[] { CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkReadOnlySafeStatement", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeBatchedInserts", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeBatchSerially", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeInternal", new CtClass[] { CtClass.intType, ctMessageBody, CtClass.booleanType, CtClass.booleanType, ctColumnDefinition, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executePreparedBatchAsMultiStatement", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeUpdateInternal", new CtClass[] { CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeUpdateInternal", new CtClass[] { ctQueryBindings, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generateMultiStatementForBatch", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBytesRepresentation", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getParameterBindings", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("initializeFromParseInfo", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("isNull", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("prepareBatchedInsertSQL", new CtClass[] { ctJdbcConnection, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setBytes", new CtClass[] { CtClass.intType, ctByteArray, CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setRetrieveGeneratedKeys", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * com.mysql.cj.jdbc.ServerPreparedStatement extends ClientPreparedStatement
         */
    clazz = pool.get(ServerPreparedStatement.class.getName());
    instrumentJdbcMethods(clazz, java.sql.PreparedStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    instrumentJdbcMethods(clazz, JdbcStatement.class, true, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBinding", new CtClass[] { CtClass.intType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeInternal", new CtClass[] { CtClass.intType, ctMessageBody, CtClass.booleanType, CtClass.booleanType, ctColumnDefinition, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    // catchRuntimeException(clazz, clazz.getDeclaredMethod("canRewriteAsMultiValueInsertAtSqlLevel", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("realClose", new CtClass[] { CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("serverExecute", new CtClass[] { CtClass.intType, CtClass.booleanType, ctColumnDefinition }), EXCEPTION_INTERCEPTOR_GETTER);
    // catchRuntimeException(clazz, clazz.getDeclaredMethod("serverLongData", new CtClass[] { CtClass.intType, ctServerPreparedQueryBindValue }),
    // EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("serverPrepare", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.ResultSet extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.ResultSetImpl implements com.mysql.cj.jdbc.ResultSetInternalMethods (extends java.sql.ResultSet)
    clazz = pool.get(ResultSetImpl.class.getName());
    instrumentJdbcMethods(clazz, ResultSetInternalMethods.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.UpdatableResultSet extends ResultSetImpl
    clazz = pool.get(UpdatableResultSet.class.getName());
    instrumentJdbcMethods(clazz, ResultSetInternalMethods.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generateStatements", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.ResultSetMetaData extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.ResultSetMetaData implements java.sql.ResultSetMetaData
    clazz = pool.get(ResultSetMetaData.class.getName());
    instrumentJdbcMethods(clazz, java.sql.ResultSetMetaData.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.Savepoint
         */
    // com.mysql.cj.jdbc.MysqlSavepoint implements java.sql.Savepoint
    clazz = pool.get(MysqlSavepoint.class.getName());
    instrumentJdbcMethods(clazz, Savepoint.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.Statement extends java.sql.Wrapper
         */
    // com.mysql.cj.jdbc.StatementImpl implements com.mysql.cj.jdbc.Statement (extends java.sql.Statement)
    clazz = pool.get(StatementImpl.class.getName());
    instrumentJdbcMethods(clazz, JdbcStatement.class, false, EXCEPTION_INTERCEPTOR_GETTER);
    // non-JDBC
    catchRuntimeException(clazz, clazz.getDeclaredMethod("createResultSetUsingServerFetch", new CtClass[] { ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("doPingInstead", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeInternal", new CtClass[] { ctString, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeBatchUsingMultiQueries", new CtClass[] { CtClass.booleanType, CtClass.intType, CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeUpdateInternal", new CtClass[] { ctString, CtClass.booleanType, CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("executeSimpleNonQuery", new CtClass[] { ctJdbcConnection, ctString }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("generatePingResultSet", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBatchedGeneratedKeys", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBatchedGeneratedKeys", new CtClass[] { ctStatement }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getGeneratedKeysInternal", new CtClass[] { CtClass.longType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getLastInsertID", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getLongUpdateCount", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getOpenResultSetCount", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getResultSetInternal", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("processMultiCountsAndKeys", new CtClass[] { ctStatementImpl, CtClass.intType, ctLongArray }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("removeOpenResultSet", new CtClass[] { ctResultSetInternalMethods }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("resetCancelledState", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setHoldResultsOpenOverClose", new CtClass[] { CtClass.booleanType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setResultSetConcurrency", new CtClass[] { CtClass.intType }), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("useServerFetch", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("checkCancelTimeout", new CtClass[] {}), EXCEPTION_INTERCEPTOR_GETTER);
    clazz.writeFile(args[0]);
    /*
         * java.sql.SQLXML
         */
    // com.mysql.cj.jdbc.MysqlSQLXML implements SQLXML
    clazz = pool.get(MysqlSQLXML.class.getName());
    instrumentJdbcMethods(clazz, java.sql.SQLXML.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.ConnectionPoolDataSource
         */
    // MysqlConnectionPoolDataSource extends MysqlDataSource implements ConnectionPoolDataSource
    clazz = pool.get(MysqlConnectionPoolDataSource.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.ConnectionPoolDataSource.class);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.DataSource
         */
    // MysqlDataSource extends JdbcPropertySetImpl implements DataSource, Referenceable, Serializable, JdbcPropertySet
    clazz = pool.get(MysqlDataSource.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.DataSource.class);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getStringRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setStringRuntimeProperty", new CtClass[] { ctString, ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getBooleanRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setBooleanRuntimeProperty", new CtClass[] { ctString, CtClass.booleanType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getIntegerRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setIntegerRuntimeProperty", new CtClass[] { ctString, CtClass.intType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getLongRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setLongRuntimeProperty", new CtClass[] { ctString, CtClass.longType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getMemorySizeRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setMemorySizeRuntimeProperty", new CtClass[] { ctString, CtClass.intType }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("getEnumRuntimeProperty", new CtClass[] { ctString }), null);
    catchRuntimeException(clazz, clazz.getDeclaredMethod("setEnumRuntimeProperty", new CtClass[] { ctString, ctString }), null);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.PooledConnection
         */
    // com.mysql.cj.jdbc.MysqlPooledConnection
    clazz = pool.get(MysqlPooledConnection.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.PooledConnection.class, false, EXCEPTION_INTERCEPTOR_MEMBER);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.XAConnection
         * javax.transaction.xa.XAResource
         */
    // com.mysql.cj.jdbc.MysqlXAConnection extends MysqlPooledConnection implements XAConnection, XAResource
    clazz = pool.get(MysqlXAConnection.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.XAConnection.class);
    clazz.writeFile(args[0]);
    // com.mysql.cj.jdbc.SuspendableXAConnection extends MysqlPooledConnection implements XAConnection, XAResource
    clazz = pool.get(SuspendableXAConnection.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.XAConnection.class);
    clazz.writeFile(args[0]);
    /*
         * javax.sql.XADataSource
         */
    // com.mysql.cj.jdbc.MysqlXADataSource extends MysqlDataSource implements javax.sql.XADataSource
    clazz = pool.get(MysqlXADataSource.class.getName());
    instrumentJdbcMethods(clazz, javax.sql.DataSource.class);
    instrumentJdbcMethods(clazz, javax.sql.XADataSource.class);
    clazz.writeFile(args[0]);
    /*
         * javax.transaction.xa.Xid
         */
    // com.mysql.cj.jdbc.MysqlXid implements Xid
    clazz = pool.get(MysqlXid.class.getName());
    instrumentJdbcMethods(clazz, javax.transaction.xa.Xid.class);
    clazz.writeFile(args[0]);
/*
         * TODO:
         * java.sql.DataTruncation
         */
// com.mysql.cj.jdbc.exceptions.MysqlDataTruncation extends DataTruncation
/*
         * TODO:
         * java.sql.SQLException
         */
// com.mysql.cj.jdbc.exceptions.NotUpdatable extends SQLException
// com.mysql.cj.jdbc.exceptions.OperationNotSupportedException extends SQLException
// com.mysql.cj.jdbc.exceptions.PacketTooBigException extends SQLException
/*
         * TODO:
         * java.sql.SQLNonTransientException
         */
// com.mysql.cj.jdbc.exceptions.MySQLQueryInterruptedException extends SQLNonTransientException
// com.mysql.cj.jdbc.exceptions.MySQLStatementCancelledException extends SQLNonTransientException
/*
         * TODO:
         * java.sql.SQLRecoverableException
         */
// com.mysql.cj.jdbc.exceptions.CommunicationsException extends SQLRecoverableException implements StreamingNotifiable
// ---> com.mysql.cj.jdbc.exceptions.ConnectionFeatureNotAvailableException extends CommunicationsException
/*
         * TODO:
         * java.sql.SQLTransientException
         * ---> java.sql.SQLTimeoutException
         */
// com.mysql.cj.jdbc.exceptions.MySQLTimeoutException extends SQLTimeoutException
/*
         * TODO:
         * java.sql.SQLTransientException
         * ---> java.sql.SQLTransactionRollbackException
         */
// com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException extends SQLTransactionRollbackException implements DeadlockTimeoutRollbackMarker
/*
         * TODO:
         * com.mysql.cj.jdbc.MysqlXAException extends javax.transaction.xa.XAException
         */
/*
         * These classes have no implementations in c/J:
         * 
         * java.sql.Array
         * java.sql.BatchUpdateException
         * java.sql.ClientInfoStatus
         * java.sql.Date
         * java.sql.DriverManager
         * java.sql.DriverPropertyInfo
         * java.sql.PseudoColumnUsage
         * java.sql.Ref
         * java.sql.RowId
         * java.sql.RowIdLifetime
         * java.sql.SQLClientInfoException
         * java.sql.SQLData
         * java.sql.SQLDataException
         * java.sql.SQLFeatureNotSupportedException
         * java.sql.SQLInput
         * java.sql.SQLIntegrityConstraintViolationException
         * java.sql.SQLInvalidAuthorizationSpecException
         * java.sql.SQLNonTransientConnectionException
         * java.sql.SQLOutput
         * java.sql.SQLPermission
         * java.sql.SQLSyntaxErrorException
         * java.sql.SQLTransientConnectionException
         * java.sql.SQLWarning
         * java.sql.Struct
         * java.sql.Time
         * java.sql.Timestamp
         * java.sql.Types
         * 
         * javax.sql.CommonDataSource
         * javax.sql.ConnectionEvent
         * javax.sql.ConnectionEventListener
         * javax.sql.RowSet
         * javax.sql.RowSetEvent
         * javax.sql.RowSetInternal
         * javax.sql.RowSetListener
         * javax.sql.RowSetMetaData
         * javax.sql.RowSetReader
         * javax.sql.RowSetWriter
         * javax.sql.StatementEvent
         * javax.sql.StatementEventListener
         * 
         * javax.sql.rowset.BaseRowSet
         * javax.sql.rowset.CachedRowSet
         * javax.sql.rowset.FilteredRowSet
         * javax.sql.rowset.JdbcRowSet
         * javax.sql.rowset.Joinable
         * javax.sql.rowset.JoinRowSet
         * javax.sql.rowset.Predicate
         * javax.sql.rowset.RowSetFactory
         * javax.sql.rowset.RowSetMetaDataImpl
         * javax.sql.rowset.RowSetProvider
         * javax.sql.rowset.RowSetWarning
         * javax.sql.rowset.WebRowSet
         * 
         * javax.sql.rowset.serial.SerialArray
         * javax.sql.rowset.serial.SerialBlob
         * javax.sql.rowset.serial.SerialClob
         * javax.sql.rowset.serial.SerialDatalink
         * javax.sql.rowset.serial.SerialException
         * javax.sql.rowset.serial.SerialJavaObject
         * javax.sql.rowset.serial.SerialRef
         * javax.sql.rowset.serial.SerialStruct
         * javax.sql.rowset.serial.SQLInputImpl
         * javax.sql.rowset.serial.SQLOutputImpl
         * 
         * javax.sql.rowset.spi.SyncFactory
         * javax.sql.rowset.spi.SyncFactoryException
         * javax.sql.rowset.spi.SyncProvider
         * javax.sql.rowset.spi.SyncProviderException
         * javax.sql.rowset.spi.SyncResolver
         * javax.sql.rowset.spi.TransactionalWriter
         * javax.sql.rowset.spi.XmlReader
         * javax.sql.rowset.spi.XmlWriter
         */
}
Also used : Message(com.mysql.cj.protocol.Message) QueryBindings(com.mysql.cj.QueryBindings) JdbcStatement(com.mysql.cj.jdbc.JdbcStatement) CallableStatement(com.mysql.cj.jdbc.CallableStatement) ServerPreparedStatement(com.mysql.cj.jdbc.ServerPreparedStatement) ClientPreparedStatement(com.mysql.cj.jdbc.ClientPreparedStatement) MysqlSavepoint(com.mysql.cj.jdbc.MysqlSavepoint) JdbcConnection(com.mysql.cj.jdbc.JdbcConnection) Properties(java.util.Properties) ColumnDefinition(com.mysql.cj.protocol.ColumnDefinition) CtClass(javassist.CtClass) ResultSetInternalMethods(com.mysql.cj.jdbc.result.ResultSetInternalMethods) StatementImpl(com.mysql.cj.jdbc.StatementImpl) ResultSet(java.sql.ResultSet) UpdatableResultSet(com.mysql.cj.jdbc.result.UpdatableResultSet)

Aggregations

ClientPreparedStatement (com.mysql.cj.jdbc.ClientPreparedStatement)21 Properties (java.util.Properties)21 JdbcConnection (com.mysql.cj.jdbc.JdbcConnection)18 Test (org.junit.jupiter.api.Test)18 Connection (java.sql.Connection)15 MysqlConnection (com.mysql.cj.MysqlConnection)9 ServerPreparedStatement (com.mysql.cj.jdbc.ServerPreparedStatement)9 File (java.io.File)6 ResultSet (java.sql.ResultSet)6 QueryBindings (com.mysql.cj.QueryBindings)3 CallableStatement (com.mysql.cj.jdbc.CallableStatement)3 JdbcStatement (com.mysql.cj.jdbc.JdbcStatement)3 MysqlSavepoint (com.mysql.cj.jdbc.MysqlSavepoint)3 ParameterBindings (com.mysql.cj.jdbc.ParameterBindings)3 StatementImpl (com.mysql.cj.jdbc.StatementImpl)3 ReplicationConnection (com.mysql.cj.jdbc.ha.ReplicationConnection)3 ResultSetInternalMethods (com.mysql.cj.jdbc.result.ResultSetInternalMethods)3 UpdatableResultSet (com.mysql.cj.jdbc.result.UpdatableResultSet)3 ColumnDefinition (com.mysql.cj.protocol.ColumnDefinition)3 Message (com.mysql.cj.protocol.Message)3