Commit e0815b0d authored by Alina Habibulina's avatar Alina Habibulina

fix 6

parent c33568c5
...@@ -31,16 +31,9 @@ public class UserManager { ...@@ -31,16 +31,9 @@ public class UserManager {
chechExistance.setString(1, login); chechExistance.setString(1, login);
ResultSet res = chechExistance.executeQuery(); ResultSet res = chechExistance.executeQuery();
int columns = res.getMetaData().getColumnCount(); if(res.next()) {
StringBuilder message = new StringBuilder(); return 200;
while (res.next()) {
for (int i = 1; i <= columns; i++){
message.append(res.getString(i) + " ");
}
} }
if(message.toString().length() > 0) return 200;
else return 404; else return 404;
} catch (SQLException | NamingException e) { } catch (SQLException | NamingException e) {
...@@ -80,17 +73,11 @@ public class UserManager { ...@@ -80,17 +73,11 @@ public class UserManager {
searchUser.setString(1, login); searchUser.setString(1, login);
searchUser.setString(2, password); searchUser.setString(2, password);
ResultSet rs = searchUser.executeQuery(); ResultSet rs = searchUser.executeQuery();
int columns = rs.getMetaData().getColumnCount();
StringBuilder message = new StringBuilder();
while (rs.next()) { if(rs.next()) {
for (int i = 1; i <= columns; i++){ return 200;
message.append(rs.getString(i) + " ");
}
} }
if(message.toString().length() > 0) return 200;
return 401; return 401;
} catch (SQLException | NamingException e) { } catch (SQLException | NamingException e) {
...@@ -108,16 +95,10 @@ public class UserManager { ...@@ -108,16 +95,10 @@ public class UserManager {
PreparedStatement isAdminCheck = con.prepareStatement("SELECT * FROM users WHERE login = ? AND isadmin = 1"); PreparedStatement isAdminCheck = con.prepareStatement("SELECT * FROM users WHERE login = ? AND isadmin = 1");
isAdminCheck.setString(1, login); isAdminCheck.setString(1, login);
ResultSet rs = isAdminCheck.executeQuery(); ResultSet rs = isAdminCheck.executeQuery();
int columns = rs.getMetaData().getColumnCount();
StringBuilder message = new StringBuilder();
while (rs.next()) { if(rs.next()) {
for (int i = 1; i <= columns; i++){ return 1;
message.append(rs.getString(i) + " ");
} }
}
if(message.toString().length() > 0) return 1;
return 0; 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