Skip to content

Commit

Permalink
[FLINK-15114][sql client] Print execute result info for alter/create/…
Browse files Browse the repository at this point in the history
…drop database in sql-client

This closes apache#10471
  • Loading branch information
zjuwangg authored and KurtYoung committed Dec 7, 2019
1 parent 7af523d commit 26431ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -608,17 +608,32 @@ private void callSource(SqlCommandCall cmdCall) {

private void callCreateDatabase(SqlCommandCall cmdCall) {
final String createDatabaseStmt = cmdCall.operands[0];
executor.executeUpdate(sessionId, createDatabaseStmt);
try {
executor.executeUpdate(sessionId, createDatabaseStmt);
printInfo(CliStrings.MESSAGE_DATABASE_CREATED);
} catch (SqlExecutionException e) {
printExecutionException(e);
}
}

private void callDropDatabase(SqlCommandCall cmdCall) {
final String dropDatabaseStmt = cmdCall.operands[0];
executor.executeUpdate(sessionId, dropDatabaseStmt);
try {
executor.executeUpdate(sessionId, dropDatabaseStmt);
printInfo(CliStrings.MESSAGE_DATABASE_REMOVED);
} catch (SqlExecutionException e) {
printExecutionException(e);
}
}

private void callAlterDatabase(SqlCommandCall cmdCall) {
final String alterDatabaseStmt = cmdCall.operands[0];
executor.executeUpdate(sessionId, alterDatabaseStmt);
try {
executor.executeUpdate(sessionId, alterDatabaseStmt);
printInfo(CliStrings.MESSAGE_DATABASE_ALTER_SUCCEEDED);
} catch (SqlExecutionException e) {
printExecutionException(CliStrings.MESSAGE_DATABASE_ALTER_FAILED, e);
}
}

private void callAlterTable(SqlCommandCall cmdCall) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ private CliStrings() {

public static final String MESSAGE_VIEW_REMOVED = "View has been removed.";

public static final String MESSAGE_DATABASE_CREATED = "Database has been created.";

public static final String MESSAGE_DATABASE_REMOVED = "Database has been removed.";

public static final String MESSAGE_DATABASE_ALTER_SUCCEEDED = "Alter database succeeded!";

public static final String MESSAGE_DATABASE_ALTER_FAILED = "Alter database failed!";

public static final String MESSAGE_VIEW_ALREADY_EXISTS = "A view with this name has already been defined in the current CLI session.";

public static final String MESSAGE_VIEW_NOT_FOUND = "The given view does not exist in the current CLI session. " +
Expand Down

0 comments on commit 26431ec

Please sign in to comment.