deleteDb("scriptSimple");
reconnect();
String inFile = "org/h2/test/testSimple.in.txt";
InputStream is = getClass().getClassLoader().getResourceAsStream(inFile);
LineNumberReader lineReader = new LineNumberReader(new InputStreamReader(is, "Cp1252"));
ScriptReader reader = new ScriptReader(lineReader);
while (true) {
String sql = reader.readStatement();
if (sql == null) {
break;
}
sql = sql.trim();
try {
if ("@reconnect".equals(sql.toLowerCase())) {
reconnect();
} else if (sql.length() == 0) {
// ignore
} else if (sql.toLowerCase().startsWith("select")) {
ResultSet rs = conn.createStatement().executeQuery(sql);
while (rs.next()) {
String expected = reader.readStatement().trim();
String got = "> " + rs.getString(1);
assertEquals(sql, expected, got);
}
} else {
conn.createStatement().execute(sql);