Commit e0815b0d authored by Alina Habibulina's avatar Alina Habibulina

fix 6

parent c33568c5
......@@ -31,16 +31,9 @@ public class UserManager {
chechExistance.setString(1, login);
ResultSet res = chechExistance.executeQuery();
int columns = res.getMetaData().getColumnCount();
StringBuilder message = new StringBuilder();
while (res.next()) {
for (int i = 1; i <= columns; i++){
message.append(res.getString(i) + " ");
}
}
if(message.toString().length() > 0) return 200;
if(res.next()) {
return 200;
}
else return 404;
} catch (SQLException | NamingException e) {
......@@ -80,16 +73,10 @@ public class UserManager {
searchUser.setString(1, login);
searchUser.setString(2, password);
ResultSet rs = searchUser.executeQuery();
int columns = rs.getMetaData().getColumnCount();
StringBuilder message = new StringBuilder();
while (rs.next()) {
for (int i = 1; i <= columns; i++){
message.append(rs.getString(i) + " ");
}
}
if(message.toString().length() > 0) return 200;
if(rs.next()) {
return 200;
}
return 401;
......@@ -108,16 +95,10 @@ public class UserManager {
PreparedStatement isAdminCheck = con.prepareStatement("SELECT * FROM users WHERE login = ? AND isadmin = 1");
isAdminCheck.setString(1, login);
ResultSet rs = isAdminCheck.executeQuery();
int columns = rs.getMetaData().getColumnCount();
StringBuilder message = new StringBuilder();
while (rs.next()) {
for (int i = 1; i <= columns; i++){
message.append(rs.getString(i) + " ");
}
}
if(message.toString().length() > 0) return 1;
if(rs.next()) {
return 1;
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment