Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/henplus/commands/ConnectCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,16 @@ public int execute(final SQLSession currentSession, final String cmd, final Stri
if ("sessions".equals(cmd)) {
showSessions();
return SUCCESS;
} else if ("connect".equals(cmd)) {
if (argc < 1 || argc > 2) {
}

else if ("connect".equals(cmd)) {
if (argc < 1 || argc > 4) {
return SYNTAX_ERROR;
}
String url = (String) st.nextElement();
String alias = argc == 2 ? st.nextToken() : null;
String alias = (argc >=2) ? st.nextToken() : null;
String user = (argc >=3) ? st.nextToken() : null ;
String password = (argc >=4) ? st.nextToken() : null ;
if (alias == null) {
/*
* we only got one parameter. So the that single parameter might
Expand All @@ -338,7 +342,7 @@ public int execute(final SQLSession currentSession, final String cmd, final Stri
}
}
try {
session = new SQLSession(url, null, null);
session = new SQLSession(url, user, password);
_knownUrls.put(url, url);
if (alias != null) {
_knownUrls.put(alias, url);
Expand Down