Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. @Override
  2. public synchronized boolean create_auction(CreateAuctionObject obj) throws RemoteException
  3. {
  4.  
  5. String sql_request = "INSERT INTO AUCTION(auctionid,onwner,code,title,description,max_amount,data) VALUES (auction_seq.nextval,?,?,?,?,?,?)";
  6. String seq = "auction_seq.nextval";
  7. //String data = "to_date('" +obj.getDeadline()+ "', 'yyyy/mm/dd hh24:mm')";
  8.  
  9. // Get user auctions
  10. PreparedStatement prepStat;
  11. try
  12. {
  13. prepStat = conn.prepareStatement(sql_request);
  14.  
  15. //Create Auction
  16. prepStat.setInt(1, obj.getOwnerId());
  17. prepStat.setInt(2, obj.getCode());
  18. prepStat.setString(3, obj.getTitle());
  19. prepStat.setString(4, obj.getDescription());
  20. prepStat.setInt(5,obj.getAmount());
  21. prepStat.setString(6, obj.getDeadline());
  22. prepStat.executeUpdate();
  23. update_database();
  24. update_user_data(obj.getOwnerId());
  25.  
  26. System.out.println("Created Auction");
  27. }catch(SQLException se)
  28. {
  29. System.out.println("CREATING AUCTION SQL: " + se.getMessage());
  30. return false;
  31. }
  32.  
  33. return true;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement