Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Magne.Stenseng
inf226-2021-inchat
Commits
c6048c39
Commit
c6048c39
authored
Nov 14, 2021
by
Magne.Stenseng
Browse files
Replace SessionStorage.java
parent
70cfecf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/inf226/inchat/SessionStorage.java
View file @
c6048c39
package
inf226.inchat
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.*
;
import
java.time.Instant
;
import
java.util.UUID
;
...
...
@@ -79,9 +76,11 @@ public final class SessionStorage
public
Stored
<
Session
>
get
(
UUID
id
)
throws
DeletedException
,
SQLException
{
final
String
sql
=
"SELECT version,account,expiry FROM Session WHERE id = '"
+
id
.
toString
()
+
"'"
;
final
Statement
statement
=
connection
.
createStatement
();
final
ResultSet
rs
=
statement
.
executeQuery
(
sql
);
final
String
sql
=
id
.
toString
();
final
String
query
=
"SELECT version,account,expiry FROM Session WHERE id = ? "
;
final
PreparedStatement
statement
=
connection
.
prepareStatement
(
query
);
statement
.
setString
(
1
,
sql
);
final
ResultSet
rs
=
statement
.
executeQuery
();
if
(
rs
.
next
())
{
final
UUID
version
=
UUID
.
fromString
(
rs
.
getString
(
"version"
));
...
...
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