stat.execute("CREATE TABLE NEWS (FID NUMERIC(19) PRIMARY KEY, COMMENTS LONGVARCHAR, "
+ "LINK VARCHAR(255), STATE INTEGER, VALUE VARCHAR(255))");
stat.execute("CREATE INDEX IF NOT EXISTS NEWS_GUID_VALUE_INDEX ON NEWS(VALUE)");
stat.execute("CREATE INDEX IF NOT EXISTS NEWS_LINK_INDEX ON NEWS(LINK)");
stat.execute("CREATE INDEX IF NOT EXISTS NEWS_STATE_INDEX ON NEWS(STATE)");
PreparedStatement prep = c.prepareStatement("INSERT INTO NEWS (FID, COMMENTS, LINK, STATE, VALUE) VALUES "
+ "(?, ?, ?, ?, ?) ");
PreparedStatement prep2 = c.prepareStatement("INSERT INTO TEST (NAME) VALUES (?)");
for (int i = 0; i < len; i++) {
int x = random.nextInt(10) * 128;
StringBuilder buff = new StringBuilder();
while (buff.length() < x) {
buff.append("Test ");
buff.append(buff.length());
buff.append(' ');
}
String comment = buff.toString();
// FID
prep.setInt(1, i);
// COMMENTS
prep.setString(2, comment);
// LINK
prep.setString(3, PREFIX_URL + i);
// STATE
prep.setInt(4, 0);
// VALUE
prep.setString(5, PREFIX_URL + i);
prep.execute();
prep2.setString(1, comment);
prep2.execute();
}
}