Commit c6048c39 authored by Magne.Stenseng's avatar Magne.Stenseng
Browse files


parent 70cfecf8
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( {
final UUID version = UUID.fromString(rs.getString("version"));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment