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

The Shell tool does no longer truncate results with only one column.

上级 d0d4f32d
...@@ -464,6 +464,7 @@ public class Shell extends Tool { ...@@ -464,6 +464,7 @@ public class Shell extends Tool {
} }
println(buff.toString()); println(buff.toString());
} }
boolean truncated = false;
int rowCount = 0; int rowCount = 0;
while (rs.next()) { while (rs.next()) {
rowCount++; rowCount++;
...@@ -494,8 +495,10 @@ public class Shell extends Tool { ...@@ -494,8 +495,10 @@ public class Shell extends Tool {
s = "null"; s = "null";
} }
int m = columnSizes[i]; int m = columnSizes[i];
if (!listMode && s.length() > m) { // only truncate if more than once column
if (len > 1 && !listMode && s.length() > m) {
s = s.substring(0, m); s = s.substring(0, m);
truncated = true;
} }
buff.append(s); buff.append(s);
if (i < len - 1) { if (i < len - 1) {
...@@ -515,6 +518,9 @@ public class Shell extends Tool { ...@@ -515,6 +518,9 @@ public class Shell extends Tool {
} }
println(buff.toString()); println(buff.toString());
} }
if (truncated) {
println("(data is partically truncated)");
}
return rowCount; return rowCount;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论