Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Snir001/ShareIT
Browse files Browse the repository at this point in the history
  • Loading branch information
snirye committed Apr 18, 2020
2 parents 10e1069 + 2958356 commit 02f01f1
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public List<Items> itemSearch(String search_query) {
try {
// Create a statement
Statement myStmt = myCon.createStatement();
System.out.println("0");
// Execute SQL query
ResultSet myRs = myStmt.executeQuery(query);
// Process the result set
Expand Down Expand Up @@ -79,7 +78,6 @@ public Users login(String user_name, String password) { // TODO: check if userNa
}
}
catch (Exception exc){
System.out.println("in catch");
exc.printStackTrace();
}
return user;
Expand All @@ -96,7 +94,6 @@ public String addUser(Users user) {

if(myDoubleRs.next() == false) { // if no such user name in dataBase
String query = addQuery("users", users_columns, data);
System.out.println(query);
String getID = "SELECT userID FROM users ORDER BY userID DESC LIMIT 1";
myStmt.executeUpdate(query);
ResultSet myRs = myStmt.executeQuery(getID);
Expand All @@ -122,7 +119,6 @@ public String addItem(Items item) {
// Create a statement
Statement myStmt = myCon.createStatement();
String query = addQuery("items", items_columns, data);
System.out.println("preparty");
String getID = "SELECT itemID FROM items ORDER BY itemID DESC LIMIT 1";
myStmt.executeUpdate(query);
ResultSet myRs = myStmt.executeQuery(getID);
Expand All @@ -144,7 +140,6 @@ public String addRequest(Requests request) {
// Create a statement
Statement myStmt = myCon.createStatement();
String query = addQuery("requests", requests_columns, data);
System.out.println(query);
String getID = "SELECT requestID FROM requests ORDER BY requestID DESC LIMIT 1";
myStmt.executeUpdate(query);
ResultSet myRs = myStmt.executeQuery(getID);
Expand All @@ -165,7 +160,7 @@ public boolean editUser(Users user) {
// Create a statement
Statement myStmt = myCon.createStatement();
String query = editQuery("users", "userID", users_columns, data, user.getUserID());
myStmt.executeQuery(query);
myStmt.executeUpdate(query);
return true;
}
catch (Exception exc){
Expand All @@ -180,7 +175,7 @@ public boolean editItem(Items item) {
// Create a statement
Statement myStmt = myCon.createStatement();
String query = editQuery("items", "itemID", items_columns, data, item.getItemID());
myStmt.executeQuery(query);
myStmt.executeUpdate(query);
return true;
}
catch (Exception exc){
Expand All @@ -195,7 +190,7 @@ public boolean editRequest(Requests request) {
// Create a statement
Statement myStmt = myCon.createStatement();
String query = editQuery("requests", "requestID", requests_columns, data, request.getRequestID());
myStmt.executeQuery(query);
myStmt.executeUpdate(query);
return true;
}
catch (Exception exc){
Expand Down Expand Up @@ -534,7 +529,6 @@ private String[] userToList(Users user) {
for (int i = 0; i < data.length; i++) {
data[i] = (String) functions[i];
}
System.out.println("data list: " + data);
return data;
}
//##################################################################################################################################################
Expand Down

0 comments on commit 02f01f1

Please sign in to comment.