use of com.yahoo.dba.perf.myperf.common.Sql in project mysql_perf_analyzer by yahoo.
the class TableMetaProcessor method queryMultiple.
@Override
public void queryMultiple(MyPerfContext context, DBInstanceInfo dbinfo, String appUser, DBConnectionWrapper connWrapper, QueryParameters qps, Map<String, ResultList> rListMap) throws java.sql.SQLException {
for (int i = 0; i < TBL_QUERIES.length; i++) {
QueryParameters qps2 = new QueryParameters();
qps2.setSql(TBL_QUERIES[i]);
qps2.getSqlParams().put("p_1", qps.getSqlParams().get("p_1"));
qps2.getSqlParams().put("p_2", qps.getSqlParams().get("p_2"));
ResultList rList = null;
try {
rList = context.getQueryEngine().executeQueryGeneric(qps2, connWrapper, qps.getMaxRows());
} catch (Throwable th) {
logger.log(Level.WARNING, "Error when retrieve meta data", th);
if (th instanceof SQLException) {
//check if the connection is still good
if (!DBUtils.checkConnection(connWrapper.getConnection())) {
throw SQLException.class.cast(th);
}
}
Sql sql = context.getSqlManager().getSql(qps2.getSql());
if (sql != null && sql.isErrorInline()) {
rList = new ResultList();
ColumnDescriptor desc = new ColumnDescriptor();
desc.addColumn("Status", false, 0);
desc.addColumn("Message", false, 1);
rList.setColumnDescriptor(desc);
ResultRow row = new ResultRow();
row.setColumnDescriptor(desc);
row.addColumn("Error");
row.addColumn(th.getMessage());
rList.addRow(row);
}
}
rListMap.put(TBL_QUERIES[i], rList);
}
}
Aggregations