public void setHistoryFile(String historyFile) { final String currentValue = get(HISTORY_FILE); if (Objects.equals(currentValue, historyFile) || Objects.equals(currentValue, Commands.expand(historyFile))) { return; } if (DEFAULT.equalsIgnoreCase(historyFile)) { set(HISTORY_FILE, DEFAULT); } else { propertiesMap.put(HISTORY_FILE, Commands.expand(historyFile)); } if (sqlLine != null && sqlLine.getLineReader() != null) { History history = sqlLine.getLineReader().getHistory(); if (history == null) { history = new DefaultHistory(); } else { try { history.save(); } catch (IOException e) { sqlLine.handleException(e); } } sqlLine.getLineReader() .setVariable(LineReader.HISTORY_FILE, get(HISTORY_FILE)); history.attach(sqlLine.getLineReader()); } }
history.attach(this);
fileHistory.attach(lineReader); setLineReader(lineReader); return lineReader;
fileHistory.attach(lineReader); setLineReader(lineReader); return lineReader;