Search in sources :

Example 11 with DatabaseVendor

use of com.newrelic.agent.bridge.datastore.DatabaseVendor 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)11 Connection (java.sql.Connection)9 JdbcDataSourceConnectionFactory (com.newrelic.agent.bridge.datastore.JdbcDataSourceConnectionFactory)4 Trace (com.newrelic.api.agent.Trace)4 ConnectionFactory (com.newrelic.agent.bridge.datastore.ConnectionFactory)3 Transaction (com.newrelic.agent.Transaction)2 JdbcDriverConnectionFactory (com.newrelic.agent.bridge.datastore.JdbcDriverConnectionFactory)2 UnknownDatabaseVendor (com.newrelic.agent.bridge.datastore.UnknownDatabaseVendor)2 ClassMethodSignature (com.newrelic.agent.tracers.ClassMethodSignature)2 OtherRootSqlTracer (com.newrelic.agent.tracers.OtherRootSqlTracer)2 SqlTracer (com.newrelic.agent.tracers.SqlTracer)2 SimpleMetricNameFormat (com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 DataSource (javax.sql.DataSource)2 DummyConnection (sql.DummyConnection)2 DatastoreVendor (com.newrelic.agent.bridge.datastore.DatastoreVendor)1 RecordSql (com.newrelic.agent.bridge.datastore.RecordSql)1 DatabaseService (com.newrelic.agent.database.DatabaseService)1 ExplainPlanExecutor (com.newrelic.agent.database.ExplainPlanExecutor)1