use of org.jline.reader.impl.history.DefaultHistory in project herddb by diennea.
the class HerdDBCLI method runSqlConsole.
private static void runSqlConsole(Connection connection, Statement statement, boolean pretty) throws IOException {
Terminal terminal = TerminalBuilder.builder().system(true).build();
LineReader reader = LineReaderBuilder.builder().history(new DefaultHistory()).terminal(terminal).build();
String prompt = "herd: ";
while (true) {
String line = null;
try {
line = reader.readLine(prompt);
if (line == null) {
return;
}
executeStatement(true, true, false, false, line, statement, null, false, pretty);
} catch (UserInterruptException | EndOfFileException e) {
return;
} catch (Exception e) {
e.printStackTrace();
}
}
}
Aggregations