summaryrefslogtreecommitdiffstats
path: root/Dozentenmodulserver/src/sql
diff options
context:
space:
mode:
authorunknown2014-04-11 09:55:31 +0200
committerunknown2014-04-11 09:55:31 +0200
commit7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7 (patch)
tree8d167a7b63e55aeac7bb8c68c6591d1d732da5eb /Dozentenmodulserver/src/sql
parent :) (diff)
parentMerge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff)
downloadtutor-module-7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7.tar.gz
tutor-module-7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7.tar.xz
tutor-module-7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7.zip
Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module
Conflicts: delete Image db and server Dozentenmodul/bin/gui/intro/MainMenue_GUI.class Dozentenmodulserver/bin/server/ServerHandler.class Dozentenmodulserver/bin/sql/SQL.class Dozentenmodulserver/src/sql/SQL.java
Diffstat (limited to 'Dozentenmodulserver/src/sql')
-rw-r--r--Dozentenmodulserver/src/sql/SQL.java93
1 files changed, 49 insertions, 44 deletions
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java
index 9a8c92fc..ed1acbec 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;
@@ -13,6 +14,7 @@ import java.util.Random;
import org.apache.log4j.Logger;
import server.BinaryListener;
+import server.ServerHandler;
public class SQL {
@@ -446,7 +448,7 @@ public class SQL {
}
return -1;
}
-
+
/**
@@ -456,12 +458,10 @@ public class SQL {
* @return
*/
- public boolean deleteImage(String id, String version) {
+ public boolean deleteImage(Connection con, String id, String version) {
try {
-
- Connection con=DriverManager.getConnection
- ("jdbc:mysql://127.0.0.1/bwLehrpool?user=root&password=slx-ng-open");
+
Statement stm=con.createStatement();
System.out.println("delete image");
@@ -470,16 +470,17 @@ public class SQL {
"AND imageVersion = '"+version+"';");
return true;
+
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- return false;
}
+ return false;
}
-
- 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");
@@ -490,36 +491,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();
@@ -528,12 +517,28 @@ public class SQL {
e.printStackTrace();
}
-
- //return false;
- //}
-
return 0;
}
-
+
+ public boolean connectedToEvents (Connection con, String id, String version) {
+
+ try {
+
+ Statement stm=con.createStatement();
+
+ stm.executeUpdate("SELECT ...VERANSTALTUNG_VERKNÜPFUNG... FROM " +
+ "bwLehrpool.m_VLData_imageInfo where GUID_imageID = '"+id+"' " +
+ "AND imageVersion = '"+version+"';");
+
+ return true;
+
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return false;
+
+ }
}