1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 12:35:28 +01:00

Delete a column from jobNames before inserting to prevent errors

This commit is contained in:
montlikadani 2020-03-29 13:44:16 +02:00
parent be9af51dc7
commit 9f932db63a

View File

@ -1110,9 +1110,18 @@ public abstract class JobsDAO {
JobsConnection conn = getConnection();
if (conn == null)
return;
PreparedStatement prestt = null;
ResultSet res2 = null;
try {
prestt = conn.prepareStatement("DELETE FROM `" + DBTables.JobNameTable.getTableName()
+ "` WHERE `" + jobsNameTableFields.name.getCollumn() + "` = ?;");
prestt.setString(1, job.getName());
prestt.execute();
close(prestt);
prestt = null;
prestt = conn.prepareStatement("INSERT INTO `" + DBTables.JobNameTable.getTableName() + "` (`" + jobsNameTableFields.name.getCollumn() + "`) VALUES (?);",
Statement.RETURN_GENERATED_KEYS);
prestt.setString(1, job.getName());