-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateRunnable.java
More file actions
39 lines (35 loc) · 1.21 KB
/
UpdateRunnable.java
File metadata and controls
39 lines (35 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.io.*;
import java.net.Socket;
public class UpdateRunnable implements Runnable {
private final JavaSqlCon sql;
private final String bId;
private final String cId;
private final String sId;
private final String bDate;
private final String bTime;
private final String duration;
private final String focus;
private final Socket socket;
public UpdateRunnable(JavaSqlCon sql, String bId, String cId, String sId, String bDate, String bTime, String duration, String focus, Socket socket) {
this.sql = sql;
this.bId = bId;
this.cId = cId;
this.sId = sId;
this.bDate = bDate;
this.bTime = bTime;
this.duration = duration;
this.focus = focus;
this.socket = socket;
}
//A run method which executes the appropriate query and sends the result to the client
public void run() {
PrintWriter out = null;
try {
out = new PrintWriter(socket.getOutputStream());
} catch (IOException ex) {
System.out.println("Output Error " + ex.getMessage());
}
out.println(sql.updateBooking(bId, cId, sId, bDate, bTime, duration, focus));
out.flush();
}
}