在下面的查询中
SELECT grouped_target_tuple FROM targeting_template_target WHERE targeting_template_id='5863' AND target_id="9906"
[{"childTargets":[{"id":472,"name":"AutoCountry","type":"multiselect","rank":1,"selectedTargetOptions":[{"id":322,"name":"Germany","excluded":false},{"id":323,"name":"Italy","excluded":false}]},{"id":473,"name":"AutoCity","type":"multiselect","rank":2,"selectedTargetOptions":[{"id":324,"name":"Newyork","excluded":false},{"id":325,"name":"NewJersey","excluded":false}]}]}]
如何从结果集中获取?
// Get TT id
String query = "SELECT grouped_target_tuple FROM targeting_template_target WHERE targeting_template_id='"
+ ttID + " AND target_id=" + groupedtarID1 + "';";
ResultSet rs = getInstanceUtilsClass(MySQLUtilities.class).executeQuery(query, dbname);
ResultSetMetaData rsmd = rs.getMetaData();
JSONArray array = new JSONArray();
JSONArray json = new JSONArray();
while (rs.next()) {
int numColumns = rsmd.getColumnCount();
JSONObject obj = new JSONObject();
for (int i = 1; i <numColumns; i++) {
String column_name = rsmd.getColumnName(i);
obj.put(column_name, rs.getObject(column_name));
}
json.put(obj);
}
BasePage.log(json.toString());
}
上述方法不起作用。
获取之后,我想迭代并执行Assert。
暂无答案!
目前还没有任何答案,快来回答吧!