Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manwithhonor sqldb #220

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

manwithhonor
Copy link

I have completed conversationSevice class.
Implementation into client and server class i will add later

String dataBaseName = null;
int counter=0;
for ( counter = 0; counter < 3; counter++){
dataBaseName = "tdb-"+Integer.toString(counter+1)+".trail5.net:";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше counter = 1; counter <= 3

append("user=track_student&"). //login
append("password=7EsH.H6x"); //password
listOfConnections.put( counter, DriverManager.getConnection(url.toString()));
} catch ( SQLException e ) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно типы исключений отловить через ИЛИ

catch ( SQLException | IllegalAccessException e) {...}

private Connection findShardInDataBase(String userName) throws IllegalArgumentException{
char firstLetterOfUsername = userName.charAt(0);
try {
if ( ( ('a' <= firstLetterOfUsername) && (firstLetterOfUsername <= 'j') ) || ( ('A' <= firstLetterOfUsername) && (firstLetterOfUsername <= 'J') ) ){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

проще сделать заранее Character::toLowerCase()

}
});
int res=0;
if (limit < listOfMessage.size()){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res = Math.min(limit, listOfMessages.size())

} else {
res= listOfMessage.size();
}
return listOfMessage.subList(0, res);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return происходит из первой итерации цикла?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants