Search in sources :

Example 1 with SqlTracerExplainInfo

use of com.newrelic.agent.tracers.SqlTracerExplainInfo in project newrelic-java-agent by newrelic.

the class DefaultExplainPlanExecutorTest method testMultipleStatementNoExplainPlan.

@Test
public void testMultipleStatementNoExplainPlan() throws SQLException {
    SqlTracerExplainInfo tracer = createSqlTracerInfo("SELECT * FROM users; SELECT * FROM users");
    DefaultExplainPlanExecutor explainPlanExecutor = new DefaultExplainPlanExecutor(tracer, (String) tracer.getSql(), RecordSql.raw);
    explainPlanExecutor.runExplainPlan(null, null, new DatabaseVendor() {

        @Override
        public String getName() {
            return "MyDBVendor";
        }

        @Override
        public String getType() {
            return "MyDB";
        }

        @Override
        public boolean isExplainPlanSupported() {
            return true;
        }

        @Override
        public String getExplainPlanSql(String sql) throws SQLException {
            return sql;
        }

        @Override
        public Collection<Collection<Object>> parseExplainPlanResultSet(int columnCount, ResultSet rs, RecordSql recordSql) throws SQLException {
            return null;
        }

        @Override
        public String getExplainPlanFormat() {
            return null;
        }

        @Override
        public DatastoreVendor getDatastoreVendor() {
            return DatastoreVendor.JDBC;
        }
    });
    assertFalse(tracer.hasExplainPlan());
}
Also used : SqlTracerExplainInfo(com.newrelic.agent.tracers.SqlTracerExplainInfo) DatastoreVendor(com.newrelic.agent.bridge.datastore.DatastoreVendor) DatabaseVendor(com.newrelic.agent.bridge.datastore.DatabaseVendor) SQLException(java.sql.SQLException) RecordSql(com.newrelic.agent.bridge.datastore.RecordSql) ResultSet(java.sql.ResultSet) Collection(java.util.Collection) Test(org.junit.Test)

Aggregations

DatabaseVendor (com.newrelic.agent.bridge.datastore.DatabaseVendor)1 DatastoreVendor (com.newrelic.agent.bridge.datastore.DatastoreVendor)1 RecordSql (com.newrelic.agent.bridge.datastore.RecordSql)1 SqlTracerExplainInfo (com.newrelic.agent.tracers.SqlTracerExplainInfo)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Collection (java.util.Collection)1 Test (org.junit.Test)1