@ -10,6 +10,7 @@
@@ -10,6 +10,7 @@
package engine.db.handlers ;
import engine.gameManager.DbManager ;
import engine.loot.WorkOrder ;
import engine.mbEnums ;
import engine.mbEnums.GameObjectType ;
import engine.mbEnums.TransactionType ;
@ -151,4 +152,23 @@ public class dbWarehouseHandler extends dbHandlerBase {
@@ -151,4 +152,23 @@ public class dbWarehouseHandler extends dbHandlerBase {
Logger . error ( e ) ;
}
}
public boolean UPDATE_WORKORDER ( WorkOrder workOrder ) {
JSONObject warehouseJSON = WorkOrder . toJson ( workOrder ) ;
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "INSERT INTO `dyn_workorders` (`workorderID`, `workorder`) VALUES (?, ?) " +
"ON DUPLICATE KEY UPDATE `workoder` = VALUES(`workoder`)" ) ) {
preparedStatement . setInt ( 1 , workOrder . workOrderID ) ;
preparedStatement . setString ( 2 , warehouseJSON . toString ( ) ) ;
return ( preparedStatement . executeUpdate ( ) > 0 ) ;
} catch ( SQLException e ) {
Logger . error ( e ) ;
}
return false ;
}
}