Answer the question
In order to leave comments, you need to log in
What is the correct way to specify the SET value?
Good afternoon, I need to implement mysql database UPDATE. It is necessary to specify SET from the type variable, I tried to do it through "?" and "*" , but it doesn't work, then you need to specify the value, help me find the error.
My code:
public void addBlocks(UUID uuid,String type, int blocks){
try{
PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("UPDATE PlayerBlocks SET * = ? WHERE UUID=?");
ps.setString(1,type);
ps.setInt(2,(getUpgrade(uuid, type) + blocks));
ps.setString(3, uuid.toString());
ps.executeUpdate();
}catch (SQLException e){
e.printStackTrace();
}
}
Answer the question
In order to leave comments, you need to log in
tried to do it through "?" and "*" , but it doesn't work
PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("UPDATE PlayerBlocks SET ?? = ? WHERE UUID=?");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question