提交 b9733170 authored 作者: Thomas Mueller's avatar Thomas Mueller

The Shell tool no longer supports the built-in command "show", because it is a…

The Shell tool no longer supports the built-in command "show", because it is a legal SQL statement for H2 and MySQL.
上级 da7dd900
......@@ -163,7 +163,6 @@ public class Shell extends Tool implements Runnable {
println("help or ? Display this help");
println("list Toggle result list / stack trace mode");
println("maxwidth Set maximum column width (default is 100)");
println("show List all tables");
println("describe Describe a table");
println("autocommit Enable or disable autocommit");
println("history Show the last 20 statements");
......@@ -229,6 +228,15 @@ public class Shell extends Tool implements Runnable {
String tableName = upper.substring("DESCRIBE".length()).trim();
if (tableName.length() == 0) {
println("Usage: describe [<schema name>.]<table name>");
ResultSet rs = null;
try {
rs = stat.executeQuery(
"SELECT CAST(TABLE_SCHEMA AS VARCHAR(32)) AS \"Schema\", TABLE_NAME AS \"Table Name\" " +
"FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_SCHEMA, TABLE_NAME");
printResult(rs, false);
} finally {
JdbcUtils.closeSilently(rs);
}
} else {
String schemaName = null;
int dot = tableName.indexOf('.');
......@@ -262,16 +270,6 @@ public class Shell extends Tool implements Runnable {
JdbcUtils.closeSilently(prep);
}
}
} else if (upper.startsWith("SHOW")) {
ResultSet rs = null;
try {
rs = stat.executeQuery(
"SELECT CAST(TABLE_SCHEMA AS VARCHAR(32)) AS \"Schema\", TABLE_NAME AS \"Table Name\" " +
"FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_SCHEMA, TABLE_NAME");
printResult(rs, false);
} finally {
JdbcUtils.closeSilently(rs);
}
} else if (upper.startsWith("AUTOCOMMIT")) {
upper = upper.substring("AUTOCOMMIT".length()).trim();
if ("TRUE".equals(upper)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论