PreparedStatement stmt = null;
String query = null;
try
{
Connection conn = connectionConfig.getAdminConnection();
RelationshipList result = new RelationshipList();
if (ids.size() == 0)
return result;
// build query
String idList = Strings.join(",", ids);
query = String.format(
"SELECT * FROM %s WHERE %s IN (%s) OR %s IN (%s) ORDER BY %s",
SQLUtils.quoteSchemaTable(conn, schemaName, tableName),
SQLUtils.quoteSymbol(conn, FIELD_PARENT), idList,
SQLUtils.quoteSymbol(conn, FIELD_CHILD), idList,
SQLUtils.quoteSymbol(conn, FIELD_ORDER)
);
stmt = conn.prepareStatement(query);
rs = stmt.executeQuery();
rs.setFetchSize(SQLResult.FETCH_SIZE);
while (rs.next())
result.add(new Relationship(rs.getInt(FIELD_PARENT), rs.getInt(FIELD_CHILD)));
return result;
}
catch (SQLException e)
{
if (query != null)