From 0fbe8c2ce5354de8a2725003e9d259a7d722c184 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Apr 2014 13:13:21 +0200 Subject: Update der Datenbank beim Update der Veranstaltung funktioniert nun --- Dozentenmodulserver/src/sql/SQL.java | 53 ++++++++++++++---------------------- 1 file changed, 21 insertions(+), 32 deletions(-) (limited to 'Dozentenmodulserver/src/sql') diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java index ec1ea11f..27bdc17c 100644 --- a/Dozentenmodulserver/src/sql/SQL.java +++ b/Dozentenmodulserver/src/sql/SQL.java @@ -6,6 +6,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.DateFormat; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; @@ -447,8 +448,8 @@ public class SQL { return -1; } - public int updateLectureData(Connection con, int pk_person, int pk_image, - int imageversion, String name, String desc, String shortdesc, + public int updateLectureData(Connection con, int pk_image, + int imageversion, String name, String newName ,String desc, String shortdesc, String start, String end, boolean isactive, String id) { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); @@ -459,36 +460,24 @@ public class SQL { } try { Statement stm = con.createStatement(); - Random random = new Random(); - int uid = random.nextInt(); - stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_VLData_lecture`(`lectureID`,`name`,`isActive`,`startTime`,`endTime`,`lastUsed`,`shortDescription`,`description`,`imageID`,`imageVersion`,`admin_createTime`,`admin_changeTime`,`admin_owner`,`admin_change_by`)VALUES('" - + uid - + "','" - + name - + "','" - + active_bol - + "','" - + start - + "','" - + end - + "','" - + formatter.format(new Date()) - + "','" - + shortdesc - + "','" - + desc - + "','" - + pk_image - + "','" - + imageversion - + "','" - + formatter.format(new Date()) - + "','" - + formatter.format(new Date()) - + "','" - + pk_person - + "','" - + pk_person + "');"); + stm.executeUpdate("UPDATE `bwLehrpool`.`m_VLData_lecture` SET `name` = '" + +newName + +"',`isActive` = '" + +active_bol + +"',`startTime` = '" + +start + +"',`endTime` = '" + +end + +"',`description` = '" + +desc + +"',`imageID` = '" + +pk_image + +"',`imageVersion` = '" + +imageversion + +"',`admin_changeTime` = '" + +formatter.format(new Date()) + +"'WHERE `lectureID` = '" + +id+"';" ); con.commit(); } catch (SQLException e) { -- cgit v1.2.3-55-g7522