File notes/code/java/TestingSemicolon.java added (mode: 100644) (index 0000000..a525f76) |
|
1 |
|
// code/java/TestingSemicolon.java |
|
2 |
|
|
|
3 |
|
// java.util.Scanner is an API to read from the keyboard. |
|
4 |
|
import java.sql.*; |
|
5 |
|
import java.util.Scanner; |
|
6 |
|
|
|
7 |
|
public class TestingSemicolon { |
|
8 |
|
public static void main(String[] args) { |
|
9 |
|
try (Connection conn = |
|
10 |
|
DriverManager.getConnection( |
|
11 |
|
"jdbc:mysql://localhost:3306/?user=testuser&password=password" |
|
12 |
|
+ "&allowMultiQueries=true"); |
|
13 |
|
Statement stmt = |
|
14 |
|
conn.createStatement(); ) { |
|
15 |
|
stmt.addBatch("DROP SCHEMA IF EXISTS HW_Testing_Semicolon"); |
|
16 |
|
stmt.addBatch("CREATE SCHEMA HW_Testing_Semicolon"); |
|
17 |
|
stmt.addBatch("USE HW_Testing_Semicolon"); |
|
18 |
|
stmt.addBatch("CREATE TABLE Test(id INT)"); |
|
19 |
|
stmt.executeBatch(); |
|
20 |
|
stmt.executeUpdate("INSERT INTO Test VALUES(1)"); // Ok |
|
21 |
|
stmt.executeUpdate("INSERT INTO Test VALUES(1);"); // Ok |
|
22 |
|
stmt.executeUpdate("INSERT INTO Test VALUES(1); INSERT INTO Test VALUES(1)"); // Ok |
|
23 |
|
stmt.executeUpdate("INSERT INTO Test VALUES(1); INSERT INTO Test VALUES(1);"); // Ok |
|
24 |
|
} |
|
25 |
|
catch (SQLException ex) { |
|
26 |
|
ex.printStackTrace(); |
|
27 |
|
} |
|
28 |
|
|
|
29 |
|
try (Connection conn = |
|
30 |
|
DriverManager.getConnection( |
|
31 |
|
"jdbc:mysql://localhost:3306/?user=testuser&password=password"); // without + "&allowMultiQueries=true" |
|
32 |
|
Statement stmt = |
|
33 |
|
conn.createStatement(); ) { |
|
34 |
|
stmt.addBatch("DROP SCHEMA IF EXISTS HW_Testing_Semicolon"); |
|
35 |
|
stmt.addBatch("CREATE SCHEMA HW_Testing_Semicolon"); |
|
36 |
|
stmt.addBatch("USE HW_Testing_Semicolon"); |
|
37 |
|
stmt.addBatch("CREATE TABLE Test(id INT)"); |
|
38 |
|
stmt.executeBatch(); |
|
39 |
|
stmt.executeUpdate("INSERT INTO Test VALUES(1)"); // Ok |
|
40 |
|
stmt.executeUpdate("INSERT INTO Test VALUES(1);"); // Ok |
|
41 |
|
// stmt.executeUpdate("INSERT INTO Test VALUES(1);INSERT INTO Test VALUES(1)"); // Not Ok |
|
42 |
|
// stmt.executeUpdate("INSERT INTO Test VALUES(1);INSERT INTO Test VALUES(1);"); // Not Ok |
|
43 |
|
|
|
44 |
|
} |
|
45 |
|
catch (SQLException ex) { |
|
46 |
|
ex.printStackTrace(); |
|
47 |
|
} |
|
48 |
|
|
|
49 |
|
|
|
50 |
|
} |
|
51 |
|
} |
File notes/fig/rel_mod/pet_and_dish.tex added (mode: 100644) (index 0000000..a8a701e) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
% FRIEND(Name (PK), Bonus, Element) |
|
5 |
|
% DISH(Name (PK), FRIEND (FK to FRIEND.Name), XP, LVL) |
|
6 |
|
% RECIPE(Name (PK), Bonus, Possessed-By (FK to DISH.Name)) |
|
7 |
|
% PET(Name (PK), XP) |
|
8 |
|
% COMPLETED-BY(DISH (PK, FK to DISH.Name), PET (PK, FK to PET.Name)) |
|
9 |
|
% SPECIAL-ITEM(Name (P), PET (FK to PET.Name)) |
|
10 |
|
|
|
11 |
|
\Frame(0,0){1}[FRIEND]{ |
|
12 |
|
Name/PK}; |
|
13 |
|
|
|
14 |
|
\Frame(0,2.5){2}[CONTRIBUTION]{ |
|
15 |
|
Contributor/PK, |
|
16 |
|
Dish/PK}; |
|
17 |
|
|
|
18 |
|
\Frame(0,5){3}[DISH]{ |
|
19 |
|
Name/PK}; |
|
20 |
|
|
|
21 |
|
|
|
22 |
|
\Frame(8,0){4}[PET]{ |
|
23 |
|
Owner/PK, |
|
24 |
|
Name/PK, |
|
25 |
|
Gender/A}; |
|
26 |
|
|
|
27 |
|
\Frame(8,2.5){4}[TASTE]{ |
|
28 |
|
PetOwner/PK, |
|
29 |
|
PetName/PK, |
|
30 |
|
Dish/PK}; |
|
31 |
|
|
|
32 |
|
\Frame(8,5){5}[RECIPE]{ |
|
33 |
|
Dish/PK, |
|
34 |
|
Ingredient/PK}; |
|
35 |
|
|
|
36 |
|
\draw[FK] |
|
37 |
|
(Name1)-- ++(0,-.55) -- |
|
38 |
|
++(-1.3,0) |
|
39 |
|
-- ++(0,2.5) -- |
|
40 |
|
++(1.7, 0) -- (Contributor2); |
|
41 |
|
|
|
42 |
|
\draw[FK] |
|
43 |
|
(Name3)-- ++(0,-.55) -- |
|
44 |
|
++(2.5,0) |
|
45 |
|
-- ++(0,-2.5) -- |
|
46 |
|
++(-.65, 0) -- (Dish2); |
|
47 |
|
|
|
48 |
|
\draw[FK] |
|
49 |
|
(Name3)-- ++(0,-.55) -- |
|
50 |
|
++(2.5,0) |
|
51 |
|
-- ++(0,-2.5) -- |
|
52 |
|
++(-.65, 0) -- (Dish5); |
|
53 |
|
% |
|
54 |
|
% |
|
55 |
|
%\draw[FK] % From Possessed-By3 to Name2 |
|
56 |
|
%(Name2)++(-0.1,0) -- ++(0,-.75) -- ++(4.2,0) coordinate (inter) |
|
57 |
|
%-- (Possessed-By3 -| inter) -- ++(0,-0.4) coordinate (inter) |
|
58 |
|
%-- (Possessed-By3 |- inter) --++(0,0.5); |
|
59 |
|
% |
|
60 |
|
% |
|
61 |
|
%\draw[FK] % From DISH5 to Name2 |
|
62 |
|
%(Name2)++(0.1,0) -- ++(0,-.55) -- ++(3.5,0) coordinate (inter) |
|
63 |
|
%-- (DISH5|- inter) --++(0,0.55); |
|
64 |
|
% |
|
65 |
|
% |
|
66 |
|
%\draw[FK] % From PET5 to Name4 |
|
67 |
|
%(Name4)++(-0.1,0) -- ++(0,-.7) -- ++(2.6,0) coordinate (inter) |
|
68 |
|
%-- (PET5 -| inter) -- ++(0,-0.4) coordinate (inter) |
|
69 |
|
%-- (PET5 |- inter) --++(0,0.4); |
|
70 |
|
% |
|
71 |
|
%\draw[FK] % From PET6 to Name4 |
|
72 |
|
%(Name4)++(0.1,0) -- ++(0,-.55) -- ++(2.6,0) coordinate (inter) |
|
73 |
|
%-- (PET6 -| inter) -- ++(0,-0.2) coordinate (inter) |
|
74 |
|
%-- (PET6 |- inter) --++(0,0.3); |
|
75 |
|
|
|
76 |
|
\end{tikzpicture} |
|
77 |
|
\end{document} |