use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.
the class SqlRunnerTest method getSameBirthPlaceCouplesTest.
@Ignore
@Test
public void getSameBirthPlaceCouplesTest() throws Exception {
for (TableEntry te : querun.getSameBirthPlaceCouples()) {
String sName = te.getSpouseName(), checkBirthPlaceQuery = "SELECT birthPlace FROM basic_info WHERE name=? LIMIT 1";
Object[] inp = new Object[1];
inp[0] = sName;
ArrayList<Row> res = querun.runQuery(checkBirthPlaceQuery, inp);
Row row = res.get(0);
assertEquals(te.getBirthPlace(), (String) row.row.get(0).getValue().cast(row.row.get(0).getKey()));
}
}
use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.
the class ConnectorTest method basicInfoTableSizeTest.
@Ignore
@Test
public void basicInfoTableSizeTest() throws Exception {
Connector conn = new Connector();
assert conn.getConnection() != null;
ArrayList<Row> rows = conn.runQuery("SELECT COUNT(*) FROM basic_info");
Row row = rows.get(0);
Entry<Object, Class> col = row.row.get(0);
Object size = col.getValue().cast(col.getKey());
assertEquals(ENTRIES_NUM, size);
Extractor ext = new Extractor();
ext.executeQuery(QueryTypes.BASIC_INFO);
assertEquals(ext.getResults().size(), size);
conn.close();
}
use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.
the class ConnectorTest method runQueryTest.
@Test
@SuppressWarnings("rawtypes")
public void runQueryTest() throws Exception {
Connector conn = new Connector();
Row row = conn.runQuery("SELECT photoLink FROM basic_info LIMIT 1").get(0);
Entry<Object, Class> col = row.row.get(0);
assertNotNull(col.getValue().cast(col.getKey()));
int res = conn.runUpdate("INSERT INTO WikiID VALUES('osher','1234')");
assert res == 1;
res = conn.runUpdate("DELETE FROM WikiID WHERE name LIKE 'osher'");
assert res == 1;
conn.close();
}
use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.
the class SqlTablesFillerTest method wikiIdTableSizeTest.
@SuppressWarnings("rawtypes")
@Ignore
@Test
public void wikiIdTableSizeTest() throws Exception {
Row row = new Connector().runQuery("SELECT COUNT(*) FROM WikiID").get(0);
Entry<Object, Class> col = row.row.get(0);
assertEquals(ENTRIES_NUM, (long) col.getValue().cast(col.getKey()));
}
use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.
the class Connector method runQuery.
public ArrayList<Row> runQuery(final String query, final Object[] inputs) throws SQLException, ClassNotFoundException, IOException {
Connection conn = getConnection();
ArrayList<Row> table = new ArrayList<Row>();
PreparedStatement ps = conn.prepareStatement(query);
for (int ¢ = 1; ¢ <= inputs.length; ++¢) ps.setObject(¢, inputs[¢ - 1]);
ResultSet rs = ps.executeQuery();
if (rs != null) {
Row.formTable(rs, table);
rs.close();
}
if (ps != null)
ps.close();
if (conn != null)
conn.close();
return table;
}
Aggregations