From: SVN by r. <sv...@ca...> - 2010-01-24 14:05:24
|
Author: roy Date: 2010-01-24 15:05:15 +0100 (Sun, 24 Jan 2010) New Revision: 459 Modified: src/main/java/nl/improved/sqlclient/commands/QueryCommand.java src/main/java/nl/improved/sqlclient/commands/SettingsCommand.java Log: display settings values and variables Modified: src/main/java/nl/improved/sqlclient/commands/QueryCommand.java =================================================================== --- src/main/java/nl/improved/sqlclient/commands/QueryCommand.java 2010-01-24 13:59:02 UTC (rev 458) +++ src/main/java/nl/improved/sqlclient/commands/QueryCommand.java 2010-01-24 14:05:15 UTC (rev 459) @@ -2,6 +2,7 @@ import nl.improved.sqlclient.*; import java.sql.SQLException; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -36,6 +37,11 @@ return variables.remove(var); } + public static Map<String, String> getVariables() { + return Collections.unmodifiableMap(variables); + + } + /** * Execute the sql query. * @param cmd the sqlcommand containing the sql query Modified: src/main/java/nl/improved/sqlclient/commands/SettingsCommand.java =================================================================== --- src/main/java/nl/improved/sqlclient/commands/SettingsCommand.java 2010-01-24 13:59:02 UTC (rev 458) +++ src/main/java/nl/improved/sqlclient/commands/SettingsCommand.java 2010-01-24 14:05:15 UTC (rev 459) @@ -5,6 +5,7 @@ package nl.improved.sqlclient.commands; +import java.util.Map; import nl.improved.sqlclient.SQLCommand; import nl.improved.sqlclient.Point; import nl.improved.sqlclient.TabCompletionInfo; @@ -68,12 +69,26 @@ } public CharSequence getHelp() { - return "Change settings of sqlshell properties" + + StringBuffer result = new StringBuffer(); + result.append("Change settings of sqlshell properties" + "Settings are:\n"+ "hSeparatorChar (current value: '"+ResultBuilder.getHorizontalSeparator()+"')\n"+ "vSeparatorChar (values Y/N) (current value: '"+ResultBuilder.getVerticalSeparator()+"')\n" + "readAutoCommit (current value: '"+(ReadCommand.getAutoCommit() ? "Y" :"N")+"')\n" + - "@variable=value"; + "@variable=value\n"); + + Map<String, String> variables = QueryCommand.getVariables(); + if (variables.size() == 0) { + result.append(" No variables set"); + } else { + for (String key : variables.keySet()) { + result.append(" - "+ key+" = "); + result.append(variables.get(key)); + result.append('\n'); + } + } + + return result; } public boolean abort() { |