Skip to content

Commit

Permalink
offers fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IdanShp committed Apr 18, 2020
1 parent 018ddd6 commit 2f69fe5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ public List<Items> itemSearch(String search_query) {
// Execute SQL query
ResultSet myRs = myStmt.executeQuery(query);
// Process the result set
System.out.println("1");
while (myRs.next()) {
System.out.println("2");
System.out.println(myRs.getString("name").contains(search_query));
System.out.println(myRs.getString("description").contains(search_query));
System.out.println("**************************************************************");
if (myRs.getString("name").contains(search_query) || myRs.getString("description").contains(search_query)) {
item = new Items();
item.setItemID(myRs.getString("itemID"));
Expand All @@ -48,14 +43,11 @@ public List<Items> itemSearch(String search_query) {
item.setDecription(myRs.getString("description"));
item.setPicture(myRs.getString("picture"));
itemsList.add(item);
System.out.println("3");
}
}
System.out.println("end");
return itemsList;
}
catch (Exception exc){
System.out.println("in exc");
exc.printStackTrace();
return null;
}
Expand Down Expand Up @@ -152,8 +144,9 @@ public String addRequest(Requests request) {
// Create a statement
Statement myStmt = myCon.createStatement();
String query = addQuery("requests", requests_columns, data);
String getID = "SELECT requestID FROM items ORDER BY requestID DESC LIMIT 1";
myStmt.executeQuery(query);
System.out.println(query);
String getID = "SELECT requestID FROM requests ORDER BY requestID DESC LIMIT 1";
myStmt.executeUpdate(query);
ResultSet myRs = myStmt.executeQuery(getID);
while (myRs.next()) {
requestID = myRs.getString("requestID");
Expand Down

0 comments on commit 2f69fe5

Please sign in to comment.