Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
G
GoikLectures
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Dr. Martin Goik
GoikLectures
Commits
fbf52d69
Commit
fbf52d69
authored
Jun 18, 2019
by
Dr. Martin Goik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using Postgresql, dependency upgrades
parent
095a2a6a
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
2054 additions
and
179 deletions
+2054
-179
Klausuren/Sda1/2018Summer/Exam/Schema/schema.sql
Klausuren/Sda1/2018Summer/Exam/Schema/schema.sql
+27
-10
Klausuren/Sda1/2018Summer/Exam/pom.xml
Klausuren/Sda1/2018Summer/Exam/pom.xml
+24
-16
Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java
...am/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java
+8
-8
Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java
...m/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java
+32
-32
Klausuren/Sda1/2018Summer/Exam/src/main/javadoc/localstyles.css
...ren/Sda1/2018Summer/Exam/src/main/javadoc/localstyles.css
+922
-0
Klausuren/Sda1/2018Summer/Solve/Schema/schema.sql
Klausuren/Sda1/2018Summer/Solve/Schema/schema.sql
+9
-9
Klausuren/Sda1/2018Summer/Solve/pom.xml
Klausuren/Sda1/2018Summer/Solve/pom.xml
+23
-14
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java
...ve/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java
+10
-10
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/FinalResults.java
.../src/main/java/de/hdm_stuttgart/mi/sda1/FinalResults.java
+10
-10
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java
...e/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java
+64
-64
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadDuplicate.java
...n/java/de/hdm_stuttgart/mi/sda1/impl/DbReadDuplicate.java
+1
-1
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadUnique.java
...main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadUnique.java
+2
-5
Klausuren/Sda1/2018Summer/Solve/src/main/javadoc/localstyles.css
...en/Sda1/2018Summer/Solve/src/main/javadoc/localstyles.css
+922
-0
No files found.
Klausuren/Sda1/2018Summer/Exam/Schema/schema.sql
View file @
fbf52d69
DROP
TABLE
IF
EXISTS
Competition
;
DROP
TABLE
IF
EXISTS
Athlete
;
/* TODO add schema here */
CREATE
TABLE
Athlete
(
id
INT
NOT
NULL
PRIMARY
KEY
,
fullName
CHAR
(
20
)
NOT
NULL
);
CREATE
TABLE
Competition
(
id
INT
PRIMARY
KEY
,
athlete
INT
NOT
NULL
REFERENCES
Athlete
(
id
)
,
time
NUMERIC
(
6
,
2
)
NOT
NULL
,
badStart
BOOLEAN
NOT
NULL
);
INSERT
INTO
Athlete
VALUES
(
1
,
'Jesse Owens'
);
INSERT
INTO
Athlete
VALUES
(
2
,
'Tim Culver'
);
...
...
@@ -9,13 +19,20 @@ INSERT INTO Athlete VALUES(3, 'Sid Gascoine');
INSERT
INTO
Athlete
VALUES
(
4
,
'John Hooker'
);
INSERT
INTO
Athlete
VALUES
(
5
,
'Brad Duncan'
);
/* 100 metre race results */
INSERT
INTO
Competition
VALUES
(
1
,
1
,
10
.
23
,
0
);
/* Jesse Owens */
INSERT
INTO
Competition
VALUES
(
2
,
2
,
11
.
55
,
0
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
3
,
3
,
11
.
94
,
0
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
4
,
4
,
10
.
02
,
0
);
/* John Hooker */
INSERT
INTO
Competition
VALUES
(
5
,
5
,
10
.
84
,
0
);
/* Brad Duncan */
INSERT
INTO
Competition
VALUES
(
6
,
2
,
10
.
02
,
0
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
7
,
3
,
10
.
49
,
0
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
8
,
2
,
9
.
35
,
1
);
/* Tim Culver */
/* 100 metre race */
INSERT
INTO
Competition
VALUES
(
1
,
1
,
10
.
23
,
FALSE
);
/* Jesse Owens */
INSERT
INTO
Competition
VALUES
(
2
,
2
,
11
.
55
,
FALSE
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
3
,
3
,
11
.
94
,
FALSE
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
4
,
4
,
10
.
02
,
FALSE
);
/* John Hooker */
INSERT
INTO
Competition
VALUES
(
5
,
5
,
10
.
84
,
FALSE
);
/* Brad Duncan */
INSERT
INTO
Competition
VALUES
(
6
,
2
,
10
.
02
,
FALSE
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
7
,
3
,
10
.
49
,
FALSE
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
8
,
2
,
9
.
35
,
TRUE
);
/* Tim Culver */
SELECT
fullName
,
min
(
time
)
as
time
FROM
Competition
,
Athlete
WHERE
Competition
.
athlete
=
Athlete
.
id
AND
badStart
=
FALSE
GROUP
BY
(
fullName
)
ORDER
BY
time
,
fullName
;
\ No newline at end of file
Klausuren/Sda1/2018Summer/Exam/pom.xml
View file @
fbf52d69
...
...
@@ -9,7 +9,7 @@
<name>
Exam
</name>
<url>
http
://www.mi.hdm-stuttgart.de/freedocs/topic/de.hdm_stuttgart.mi.lectures/sd1SectUsingMaven
.html
</url>
<url>
http
s://freedocs.mi.hdm-stuttgart.de/sd1_sect_mavenCli
.html
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
...
...
@@ -56,9 +56,9 @@
</dependency>
<dependency>
<groupId>
my
sql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
6.0.6
</version>
<groupId>
postgre
sql
</groupId>
<artifactId>
postgresql
</artifactId>
<version>
9.1-901-1.jdbc4
</version>
</dependency>
<dependency>
...
...
@@ -109,16 +109,15 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.
7.0
</version>
<version>
3.
8.1
</version>
<configuration>
<source>
1
.9
</source>
<target>
1
.9
</target>
<source>
1
1
</source>
<target>
1
1
</target>
<compilerArgument>
-proc:none
</compilerArgument>
</configuration>
</plugin>
...
...
@@ -126,22 +125,32 @@
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-javadoc-plugin
</artifactId>
<version>
3.
0.1
</version>
<version>
3.
1.0
</version>
<configuration>
<links>
<link>
https://docs.oracle.com/javase/10/docs/api
</link>
</links>
<javaApiLinks>
<property>
<name>
api_11
</name>
<value>
https://klausur.mi.hdm-stuttgart.de/doc/openjdk-11-doc/api/
</value>
</property>
</javaApiLinks>
<stylesheetfile>
localstyles.css
</stylesheetfile>
<additionalJOptions>
<additionalJOption>
-html5
</additionalJOption>
</additionalJOptions>
<javadocExecutable>
${java.home}/bin/javadoc
</javadocExecutable>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<version>
2.3
</version>
<version>
3.1.1
</version>
<configuration>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
<descriptors>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
...
...
@@ -160,7 +169,6 @@
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>
\ No newline at end of file
Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java
View file @
fbf52d69
package
de.hdm_stuttgart.mi.sda1
;
package
de.hdm_stuttgart.mi.sda1
;
import
de.hdm_stuttgart.mi.sda1.impl.DbRead
;
import
de.hdm_stuttgart.mi.sda1.impl.DbRead
;
public
class
AllResults
{
public
class
AllResults
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
final
DbRead
sports
=
new
DbRead
();
final
DbRead
sports
=
new
DbRead
();
sports
.
toHtml
(
System
.
out
);
}
}
\ No newline at end of file
sports
.
toHtml
(
System
.
out
);
}
}
\ No newline at end of file
Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java
View file @
fbf52d69
package
de.hdm_stuttgart.mi.sda1.impl
;
package
de.hdm_stuttgart.mi.sda1.impl
;
import
org.jdom2.Element
;
import
org.jdom2.output.Format
;
import
org.jdom2.output.XMLOutputter
;
import
org.jdom2.Element
;
import
org.jdom2.output.Format
;
import
org.jdom2.output.XMLOutputter
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
public
class
DbRead
{
public
class
DbRead
{
public
final
Element
html
;
public
final
Element
html
;
private
final
Connection
conn
;
private
final
Connection
conn
;
public
DbRead
()
{
html
=
new
Element
(
"html"
);
public
DbRead
()
{
html
=
new
Element
(
"html"
);
Connection
connTmp
=
null
;
try
{
connTmp
=
DriverManager
.
getConnection
(
"jdbc:mysql://localhost/hdm?serverTimezone=UTC"
,
"hdmuser"
,
"XYZ"
);
}
catch
(
SQLException
e
)
{
System
.
err
.
println
(
"Unable to establish connection: "
+
e
);
System
.
exit
(
1
);
}
conn
=
connTmp
;
Connection
connTmp
=
null
;
try
{
connTmp
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5432/hdm"
,
"hdmuser"
,
"XYZ"
);
}
catch
(
final
SQLException
e
)
{
System
.
err
.
println
(
"Unable to establish connection: "
+
e
);
System
.
exit
(
1
);
}
conn
=
connTmp
;
}
public
void
toHtml
(
final
OutputStream
out
)
{
public
void
toHtml
(
final
OutputStream
out
)
{
final
XMLOutputter
printer
=
new
XMLOutputter
(
Format
.
getPrettyFormat
());
try
{
printer
.
output
(
html
,
out
);
}
catch
(
final
IOException
e
)
{
System
.
err
.
println
(
"Unable to write output: "
+
e
);
}
final
XMLOutputter
printer
=
new
XMLOutputter
(
Format
.
getPrettyFormat
());
try
{
printer
.
output
(
html
,
out
);
}
catch
(
final
IOException
e
)
{
System
.
err
.
println
(
"Unable to write output: "
+
e
);
}
}
\ No newline at end of file
}
}
\ No newline at end of file
Klausuren/Sda1/2018Summer/Exam/src/main/javadoc/localstyles.css
0 → 100644
View file @
fbf52d69
This diff is collapsed.
Click to expand it.
Klausuren/Sda1/2018Summer/Solve/Schema/schema.sql
View file @
fbf52d69
...
...
@@ -20,19 +20,19 @@ INSERT INTO Athlete VALUES(4, 'John Hooker');
INSERT
INTO
Athlete
VALUES
(
5
,
'Brad Duncan'
);
/* 100 metre race */
INSERT
INTO
Competition
VALUES
(
1
,
1
,
10
.
23
,
0
);
/* Jesse Owens */
INSERT
INTO
Competition
VALUES
(
2
,
2
,
11
.
55
,
0
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
3
,
3
,
11
.
94
,
0
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
4
,
4
,
10
.
02
,
0
);
/* John Hooker */
INSERT
INTO
Competition
VALUES
(
5
,
5
,
10
.
84
,
0
);
/* Brad Duncan */
INSERT
INTO
Competition
VALUES
(
6
,
2
,
10
.
02
,
0
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
7
,
3
,
10
.
49
,
0
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
8
,
2
,
9
.
35
,
1
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
1
,
1
,
10
.
23
,
FALSE
);
/* Jesse Owens */
INSERT
INTO
Competition
VALUES
(
2
,
2
,
11
.
55
,
FALSE
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
3
,
3
,
11
.
94
,
FALSE
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
4
,
4
,
10
.
02
,
FALSE
);
/* John Hooker */
INSERT
INTO
Competition
VALUES
(
5
,
5
,
10
.
84
,
FALSE
);
/* Brad Duncan */
INSERT
INTO
Competition
VALUES
(
6
,
2
,
10
.
02
,
FALSE
);
/* Tim Culver */
INSERT
INTO
Competition
VALUES
(
7
,
3
,
10
.
49
,
FALSE
);
/* Sid Gascoine */
INSERT
INTO
Competition
VALUES
(
8
,
2
,
9
.
35
,
TRUE
);
/* Tim Culver */
SELECT
fullName
,
min
(
time
)
as
time
FROM
Competition
,
Athlete
WHERE
Competition
.
athlete
=
Athlete
.
id
AND
badStart
=
0
AND
badStart
=
FALSE
GROUP
BY
(
fullName
)
ORDER
BY
time
,
fullName
;
\ No newline at end of file
Klausuren/Sda1/2018Summer/Solve/pom.xml
View file @
fbf52d69
...
...
@@ -9,7 +9,7 @@
<name>
Solve
</name>
<url>
http
://www.mi.hdm-stuttgart.de/freedocs/topic/de.hdm_stuttgart.mi.lectures/sd1SectUsingMaven
.html
</url>
<url>
http
s://freedocs.mi.hdm-stuttgart.de/sd1_sect_mavenCli
.html
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
...
...
@@ -56,9 +56,9 @@
</dependency>
<dependency>
<groupId>
my
sql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
6.0.6
</version>
<groupId>
postgre
sql
</groupId>
<artifactId>
postgresql
</artifactId>
<version>
9.1-901-1.jdbc4
</version>
</dependency>
<dependency>
...
...
@@ -109,16 +109,15 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.
7.0
</version>
<version>
3.
8.1
</version>
<configuration>
<source>
1
.9
</source>
<target>
1
.9
</target>
<source>
1
1
</source>
<target>
1
1
</target>
<compilerArgument>
-proc:none
</compilerArgument>
</configuration>
</plugin>
...
...
@@ -126,22 +125,32 @@
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-javadoc-plugin
</artifactId>
<version>
3.
0.1
</version>
<version>
3.
1.0
</version>
<configuration>
<links>
<link>
https://docs.oracle.com/javase/10/docs/api
</link>
</links>
<javaApiLinks>
<property>
<name>
api_11
</name>
<value>
https://klausur.mi.hdm-stuttgart.de/doc/openjdk-11-doc/api/
</value>
</property>
</javaApiLinks>
<stylesheetfile>
localstyles.css
</stylesheetfile>
<additionalJOptions>
<additionalJOption>
-html5
</additionalJOption>
</additionalJOptions>
<javadocExecutable>
${java.home}/bin/javadoc
</javadocExecutable>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<version>
2.3
</version>
<version>
3.1.1
</version>
<configuration>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
<descriptors>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
...
...
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java
View file @
fbf52d69
package
de.hdm_stuttgart.mi.sda1
;
package
de.hdm_stuttgart.mi.sda1
;
import
de.hdm_stuttgart.mi.sda1.impl.DbRead
;
import
de.hdm_stuttgart.mi.sda1.impl.DbReadDuplicate
;
import
de.hdm_stuttgart.mi.sda1.impl.DbRead
;
import
de.hdm_stuttgart.mi.sda1.impl.DbReadDuplicate
;
public
class
AllResults
{
public
class
AllResults
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
final
DbRead
sports
=
new
DbReadDuplicate
();
sports
.
readDatabase
();
final
DbRead
sports
=
new
DbReadDuplicate
();
sports
.
readDatabase
();
sports
.
toHtml
(
System
.
out
);
}
}
\ No newline at end of file
sports
.
toHtml
(
System
.
out
);
}
}
\ No newline at end of file
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/FinalResults.java
View file @
fbf52d69
package
de.hdm_stuttgart.mi.sda1
;
package
de.hdm_stuttgart.mi.sda1
;
import
de.hdm_stuttgart.mi.sda1.impl.DbRead
;
import
de.hdm_stuttgart.mi.sda1.impl.DbReadUnique
;
import
de.hdm_stuttgart.mi.sda1.impl.DbRead
;
import
de.hdm_stuttgart.mi.sda1.impl.DbReadUnique
;
public
class
FinalResults
{
public
class
FinalResults
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
final
DbRead
sports
=
new
DbReadUnique
();
sports
.
readDatabase
();
final
DbRead
sports
=
new
DbReadUnique
();
sports
.
readDatabase
();
sports
.
toHtml
(
System
.
out
);
}
}
\ No newline at end of file
sports
.
toHtml
(
System
.
out
);
}
}
\ No newline at end of file
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java
View file @
fbf52d69
package
de.hdm_stuttgart.mi.sda1.impl
;
package
de.hdm_stuttgart.mi.sda1.impl
;
import
org.jdom2.Element
;
import
org.jdom2.output.Format
;
import
org.jdom2.output.XMLOutputter
;
import
org.jdom2.Element
;
import
org.jdom2.output.Format
;
import
org.jdom2.output.XMLOutputter
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
abstract
public
class
DbRead
{
abstract
public
class
DbRead
{
final
String
sqlQuery
;
final
String
sqlQuery
;
public
final
Element
html
;
private
final
Element
table
;
public
final
Element
html
;
private
final
Element
table
;
private
final
Connection
conn
;
private
final
Connection
conn
;
public
DbRead
(
final
String
sqlQuery
)
{
this
.
sqlQuery
=
sqlQuery
;
html
=
new
Element
(
"html"
);
append
(
append
(
html
,
"head"
),
"title"
,
"Results"
);
table
=
append
(
append
(
html
,
"body"
),
"table"
);
public
DbRead
(
final
String
sqlQuery
)
{
this
.
sqlQuery
=
sqlQuery
;
html
=
new
Element
(
"html"
);
append
(
append
(
html
,
"head"
),
"title"
,
"Results"
);
table
=
append
(
append
(
html
,
"body"
),
"table"
);
final
Element
headerLine
=
append
(
table
,
"tr"
);
append
(
headerLine
,
"th"
,
"Rank"
);
append
(
headerLine
,
"th"
,
"Name"
);
append
(
headerLine
,
"th"
,
"Time / seconds"
);
final
Element
headerLine
=
append
(
table
,
"tr"
);
append
(
headerLine
,
"th"
,
"Rank"
);
append
(
headerLine
,
"th"
,
"Name"
);
append
(
headerLine
,
"th"
,
"Time / seconds"
);
Connection
connTmp
=
null
;
try
{
connTmp
=
DriverManager
.
getConnection
(
"jdbc:mysql://localhost/hdm?serverTimezone=UTC"
,
"hdmuser"
,
"XYZ"
);
}
catch
(
SQLException
e
)
{
System
.
err
.
println
(
"Unable to establish connection: "
+
e
);
System
.
exit
(
1
);
}
conn
=
connTmp
;
Connection
connTmp
=
null
;
try
{
connTmp
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5432/hdm"
,
"hdmuser"
,
"XYZ"
);
}
catch
(
final
SQLException
e
)
{
System
.
err
.
println
(
"Unable to establish connection: "
+
e
);
System
.
exit
(
1
);
}
conn
=
connTmp
;
}
protected
abstract
void
insertRecord
(
final
ResultSet
result
,
final
Element
row
,
final
int
rank
)
throws
SQLException
;
protected
abstract
void
insertRecord
(
final
ResultSet
result
,
final
Element
row
,
final
int
rank
)
throws
SQLException
;
public
void
readDatabase
()
{
try
{
final
ResultSet
results
=
conn
.
createStatement
().
executeQuery
(
sqlQuery
);
int
rank
=
1
;
while
(
results
.
next
())
{
insertRecord
(
results
,
append
(
table
,
"tr"
),
rank
++);
}
}
catch
(
final
SQLException
e
)
{
System
.
err
.
println
(
"Database access error: "
+
e
);
System
.
exit
(
1
);
public
void
readDatabase
()
{
try
{
final
ResultSet
results
=
conn
.
createStatement
().
executeQuery
(
sqlQuery
);
int
rank
=
1
;
while
(
results
.
next
())
{
insertRecord
(
results
,
append
(
table
,
"tr"
),
rank
++);
}
}
catch
(
final
SQLException
e
)
{
System
.
err
.
println
(
"Database access error: "
+
e
);
System
.
exit
(
1
);
}
}
static
protected
Element
append
(
final
Element
parent
,
final
String
tagname
)
{
final
Element
child
=
new
Element
(
tagname
);
parent
.
addContent
(
child
);
return
child
;
}
static
protected
void
append
(
final
Element
parent
,
final
String
tagname
,
final
String
text
)
{
final
Element
child
=
new
Element
(
tagname
);
child
.
addContent
(
text
);
parent
.
addContent
(
child
);
}
static
protected
Element
append
(
final
Element
parent
,
final
String
tagname
)
{
final
Element
child
=
new
Element
(
tagname
);
parent
.
addContent
(
child
);
return
child
;
}
static
protected
void
append
(
final
Element
parent
,
final
String
tagname
,
final
String
text
)
{
final
Element
child
=
new
Element
(
tagname
);
child
.
addContent
(
text
);
parent
.
addContent
(
child
);
}
public
void
toHtml
(
final
OutputStream
out
)
{
public
void
toHtml
(
final
OutputStream
out
)
{
final
XMLOutputter
printer
=
new
XMLOutputter
(
Format
.
getPrettyFormat
());
try
{
printer
.
output
(
html
,
out
);
}
catch
(
final
IOException
e
)
{
System
.
err
.
println
(
"Unable to write output: "
+
e
);
}
final
XMLOutputter
printer
=
new
XMLOutputter
(
Format
.
getPrettyFormat
());
try
{
printer
.
output
(
html
,
out
);
}
catch
(
final
IOException
e
)
{
System
.
err
.
println
(
"Unable to write output: "
+
e
);
}
}
\ No newline at end of file
}
}
\ No newline at end of file
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadDuplicate.java
View file @
fbf52d69
...
...
@@ -27,4 +27,4 @@ public class DbReadDuplicate extends DbRead {
row
.
setAttribute
(
"style"
,
"background: red;"
);
}
}
}
}
\ No newline at end of file
Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadUnique.java
View file @
fbf52d69
...
...
@@ -10,20 +10,17 @@ public class DbReadUnique extends DbRead {
"SELECT fullName, min(time) as time\n"
+
"FROM Competition, Athlete\n"
+
"WHERE Competition.athlete = Athlete.id\n"
+
" AND badStart =
0
\n"
+
" AND badStart =
FALSE
\n"
+
"GROUP BY (fullName)\n"
+
"ORDER BY time, fullName"
;
public
DbReadUnique
()
{
super
(
sqlQuery
);
}
@Override
protected
void
insertRecord
(
final
ResultSet
result
,
final
Element
row
,
final
int
rank
)
throws
SQLException
{
append
(
row
,
"td"
,
""
+
rank
);
append
(
row
,
"td"
,
result
.
getString
(
"fullName"
));
append
(
row
,
"td"
,
result
.
getString
(
"time"
));
}
}
}
\ No newline at end of file
Klausuren/Sda1/2018Summer/Solve/src/main/javadoc/localstyles.css
0 → 100644
View file @
fbf52d69
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment