This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 85517aa2af Changed some hint in cli (#7528)
85517aa2af is described below
commit 85517aa2af22b54d48b2d5f4c7fde9fa3769e20d
Author: Caideyipi <[email protected]>
AuthorDate: Sat Oct 8 17:16:32 2022 +0800
Changed some hint in cli (#7528)
---
cli/src/main/java/org/apache/iotdb/cli/Cli.java | 17 +++++++++--------
.../java/org/apache/iotdb/cli/StartClientScriptIT.java | 8 ++++----
jdbc/src/main/java/org/apache/iotdb/jdbc/Config.java | 2 ++
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/cli/src/main/java/org/apache/iotdb/cli/Cli.java
b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
index 535a714e03..90a1cf9869 100644
--- a/cli/src/main/java/org/apache/iotdb/cli/Cli.java
+++ b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
@@ -40,6 +40,7 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import static org.apache.iotdb.cli.utils.IoTPrinter.println;
+import static org.apache.iotdb.jdbc.Config.IOTDB_ERROR_PREFIX;
/** args[]: -h 127.0.0.1 -p 6667 -u root -pw root */
public class Cli extends AbstractCli {
@@ -81,10 +82,10 @@ public class Cli extends AbstractCli {
port = checkRequiredArg(PORT_ARGS, PORT_NAME, commandLine, false, port);
username = checkRequiredArg(USERNAME_ARGS, USERNAME_NAME, commandLine,
true, null);
} catch (ArgsErrorException e) {
- println(IOTDB_CLI_PREFIX + "> input params error because" +
e.getMessage());
+ println(IOTDB_ERROR_PREFIX + "Input params error because" +
e.getMessage());
System.exit(CODE_ERROR);
} catch (Exception e) {
- println(IOTDB_CLI_PREFIX + "> exit cli with error " + e.getMessage());
+ println(IOTDB_ERROR_PREFIX + "Exit cli with error " + e.getMessage());
System.exit(CODE_ERROR);
}
@@ -118,8 +119,8 @@ public class Cli extends AbstractCli {
return false;
} catch (NumberFormatException e) {
println(
- IOTDB_CLI_PREFIX
- + "> error format of max print row count, it should be an
integer number");
+ IOTDB_ERROR_PREFIX
+ + ": error format of max print row count, it should be an
integer number");
return false;
}
return true;
@@ -139,7 +140,7 @@ public class Cli extends AbstractCli {
processCommand(execute, connection);
System.exit(lastProcessStatus);
} catch (SQLException e) {
- println(IOTDB_CLI_PREFIX + "> can't execute sql because" +
e.getMessage());
+ println(IOTDB_ERROR_PREFIX + "Can't execute sql because" +
e.getMessage());
System.exit(CODE_ERROR);
}
}
@@ -148,7 +149,7 @@ public class Cli extends AbstractCli {
}
receiveCommands(lineReader);
} catch (Exception e) {
- println(IOTDB_CLI_PREFIX + "> exit cli with error " + e.getMessage());
+ println(IOTDB_ERROR_PREFIX + ": Exit cli with error: " + e.getMessage());
System.exit(CODE_ERROR);
}
}
@@ -165,7 +166,7 @@ public class Cli extends AbstractCli {
echoStarting();
displayLogo(properties.getVersion(), properties.getBuildInfo());
- println(IOTDB_CLI_PREFIX + "> login successfully");
+ println(String.format("Successfully login at %s:%s", host, port));
while (true) {
try {
s = reader.readLine(IOTDB_CLI_PREFIX + "> ", null);
@@ -188,7 +189,7 @@ public class Cli extends AbstractCli {
} catch (SQLException e) {
println(
String.format(
- "%s> %s Host is %s, port is %s.", IOTDB_CLI_PREFIX,
e.getMessage(), host, port));
+ "%s: %s Host is %s, port is %s.", IOTDB_ERROR_PREFIX,
e.getMessage(), host, port));
System.exit(CODE_ERROR);
}
}
diff --git a/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
b/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
index 60cbcf32ad..6d8809568e 100644
--- a/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
+++ b/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
@@ -53,7 +53,7 @@ public class StartClientScriptIT extends AbstractScript {
protected void testOnWindows() throws IOException {
String dir = getCliPath();
final String[] output = {
- "IoTDB> Connection Error, please check whether the network is available
or the server has started. Host is 127.0.0.1, port is 6668."
+ "Error: Connection Error, please check whether the network is available
or the server has started. Host is 127.0.0.1, port is 6668."
};
ProcessBuilder builder =
new ProcessBuilder(
@@ -89,7 +89,7 @@ public class StartClientScriptIT extends AbstractScript {
testOutput(builder2, output2, 0);
final String[] output3 = {
- "IoTDB> error format of max print row count, it should be an integer
number"
+ "Error: error format of max print row count, it should be an integer
number"
};
ProcessBuilder builder3 =
new ProcessBuilder(
@@ -108,7 +108,7 @@ public class StartClientScriptIT extends AbstractScript {
protected void testOnUnix() throws IOException {
String dir = getCliPath();
final String[] output = {
- "IoTDB> Connection Error, please check whether the network is available
or the server has started. Host is 127.0.0.1, port is 6668."
+ "Error: Connection Error, please check whether the network is available
or the server has started. Host is 127.0.0.1, port is 6668."
};
ProcessBuilder builder =
new ProcessBuilder(
@@ -136,7 +136,7 @@ public class StartClientScriptIT extends AbstractScript {
testOutput(builder2, output2, 0);
final String[] output3 = {
- "IoTDB> error format of max print row count, it should be an integer
number"
+ "Error: error format of max print row count, it should be an integer
number"
};
ProcessBuilder builder3 =
new ProcessBuilder(
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/Config.java
b/jdbc/src/main/java/org/apache/iotdb/jdbc/Config.java
index 83da38be83..2187ec8144 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/Config.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/Config.java
@@ -25,6 +25,8 @@ public class Config {
/** The required prefix for the connection URL. */
public static final String IOTDB_URL_PREFIX = "jdbc:iotdb://";
+ public static final String IOTDB_ERROR_PREFIX = "Error";
+
static final String IOTDB_DEFAULT_HOST = "localhost";
/** If host is provided, without a port. */
static final int IOTDB_DEFAULT_PORT = 6667;