🛠️ adjust auction insert to support dynamic request amounts

Took 24 seconds
This commit is contained in:
Kiran Hart 2024-02-12 15:20:40 -05:00
parent c9dd119ee5
commit 5535fe71ae
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3

View File

@ -324,7 +324,7 @@ public class DataManager extends DataManagerAbstract {
public void insertAuction(AuctionedItem item, Callback<AuctionedItem> callback) {
this.databaseConnector.connect(connection -> {
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + this.getTablePrefix() + "auctions(id, owner, highest_bidder, owner_name, highest_bidder_name, category, base_price, bid_start_price, bid_increment_price, current_price, expired, expires_at, item_material, item_name, item_lore, item_enchants, item, listed_world, infinite, allow_partial_buys, server_auction, is_request) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + this.getTablePrefix() + "auctions(id, owner, highest_bidder, owner_name, highest_bidder_name, category, base_price, bid_start_price, bid_increment_price, current_price, expired, expires_at, item_material, item_name, item_lore, item_enchants, item, listed_world, infinite, allow_partial_buys, server_auction, is_request, request_count) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
final AuctionAPI api = AuctionAPI.getInstance();
PreparedStatement fetch = connection.prepareStatement("SELECT * FROM " + this.getTablePrefix() + "auctions WHERE id = ?");
@ -351,6 +351,7 @@ public class DataManager extends DataManagerAbstract {
statement.setBoolean(20, item.isAllowPartialBuy());
statement.setBoolean(21, item.isServerItem());
statement.setBoolean(22, item.isRequest());
statement.setInt(23, item.getRequestAmount());
statement.executeUpdate();
@ -742,6 +743,7 @@ public class DataManager extends DataManagerAbstract {
auctionItem.setAllowPartialBuy(hasColumn(resultSet, "allow_partial_buys") && resultSet.getBoolean("allow_partial_buys"));
auctionItem.setServerItem(resultSet.getBoolean("server_auction"));
auctionItem.setRequest(resultSet.getBoolean("is_request"));
auctionItem.setRequestAmount(resultSet.getInt("request_count"));
return auctionItem;
}