protected void dumpResultSet(final int limit) { new OTableFormatter(this).setMaxWidthSize(getConsoleWidth()).setMaxMultiValueEntries(getMaxMultiValueEntries()) .writeRecords(currentResultSet, limit); }
@Override public Object executeBlock() { return console.run(); } }
@ConsoleCommand(description = "Move the current record cursor to the previous one in result set") public void prev() { setCurrentRecord(currentRecordIdx - 1); dumpRecordDetails(); }
@ConsoleCommand(description = "Reload the database schema") public void reloadSchema() throws IOException { message("\nreloading database schema..."); updateDatabaseInfo(); message("\n\nDone."); }
@Override public void error(final String message, final Object... args) { // clean up error messages to remove redundant/irrelevant content if (!message.contains("Unrecognized command")) { super.error(message.replaceFirst("(?s)!Wrong syntax.*Expected", "Syntax"), args); } } }
@Override protected void onBefore() { super.onBefore(); setResultset(new ArrayList<OIdentifiable>()); // DISABLE THE NETWORK AND STORAGE TIMEOUTS properties.put("limit", "20"); properties.put("debug", "false"); properties.put("collectionMaxItems", "10"); properties.put("maxBinaryDisplay", "150"); properties.put("verbose", "2"); properties.put("ignoreErrors", "false"); properties.put("backupCompressionLevel", "9"); // 9 = MAX properties.put("backupBufferSize", "1048576"); // 1MB }
protected static void restoreTerminal() { try { stty("echo"); } catch (Exception ignored) { } }
/** * Execute the stty command with the specified arguments against the current active terminal. */ protected static int stty(final String args) throws IOException, InterruptedException { String cmd = "stty " + args + " < /dev/tty"; return exec(new String[] { "sh", "-c", cmd }); }
@Override public void onMessage(String text, Object... args) { message(text, args); }
@Override protected void onBefore() { printApplicationInfo(); }
public void writeRecords(final List<? extends OIdentifiable> resultSet, final int limit) { writeRecords(resultSet, limit, null); }
@Override protected String getPrompt() { return String.format("orientdb%s> ", getContext()); }
@Override protected boolean isCollectingCommands(final String iLine) { return super.isCollectingCommands(iLine) || iLine.trim().equalsIgnoreCase("gremlin"); } }
@Override public Object executeBlock() { return console.run(); } }
@ConsoleCommand(description = "Move the current record cursor to the next one in result set") public void next() { setCurrentRecord(currentRecordIdx + 1); dumpRecordDetails(); }
public void onMessage(final String iText) { message(iText); }