in phoenix-queryserver-orchestrator/src/main/java/org/apache/phoenix/tool/PhoenixCanaryTool.java [132:154]
void onExecute() throws Exception {
result.setTestName("readTable");
PreparedStatement ps = connection.prepareStatement("SELECT * FROM "
+ FQ_TABLE_NAME+" WHERE INSERT_DATE = ?");
ps.setTimestamp(1,timestamp);
ResultSet rs = ps.executeQuery();
int totalRows = 0;
while (rs.next()) {
totalRows += 1;
Integer myKey = rs.getInt(1);
String myColumn = rs.getString(2);
if (myKey != 1 || !myColumn.equals("Hello World")) {
throw new Exception("Retrieved values do not " +
"match the inserted values");
}
}
if (totalRows != 1) {
throw new Exception(totalRows + " rows fetched instead of just one.");
}
ps.close();
rs.close();
}