use of com.newrelic.agent.bridge.datastore.RecordSql in project newrelic-java-agent by newrelic.
the class SlowQueryInfo method getQuery.
public String getQuery() {
String query = obfuscatedQuery;
// TransactionData can be null but by the time we get here it will already be checked for null and excluded
TransactionTracerConfig ttConfig = getTransactionData().getTransactionTracerConfig();
RecordSql recordSql = RecordSql.get(ttConfig.getRecordSql());
if (recordSql == RecordSql.raw) {
query = rawQuery;
}
return TransactionSegment.truncateSql(query, ttConfig.getInsertSqlMaxLength());
}
use of com.newrelic.agent.bridge.datastore.RecordSql 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());
}
Aggregations