logger.info("Inserting relation between session and transaction into database");
logger.info("Inserting relation between session with id "+session.getSessionId()+" and transaction with id "+transaction.getTransactionId()+" into database");
Connectionconnection=dataSource.getConnection();
PreparedStatementstatement=connection.prepareStatement("insert into sessionsWithTransactions(sessionId,transactionId) values(?, ?);");
statement.setInt(1,session.getSessionId());
...
...
@@ -125,7 +125,7 @@ public class DBConnectionImpl implements DBConnection {
logger.info("Updating transaction with id "+transaction.getTransactionId()+"in database");
Connectionconnection=dataSource.getConnection();
PreparedStatementstatement=connection.prepareStatement("update transactions set startingTime=?,finishingTime=?,transactionType=?,username=? where transactionId=?;");
logger.info("Updating session with id "+session.getSessionId()+" in database");
Connectionconnection=dataSource.getConnection();
PreparedStatementstatement=connection.prepareStatement("update sessions set startingTime=?, finishingTime=?,username=?,sshHostname=?,sshPort=?,sessionStatus=? where sessionId=?;");
logger.info("Requesting incomplete transaction from a specific user");
logger.info("Requesting incomplete transactions belonging to user "+user+" from database");
Connectionconnection=dataSource.getConnection();
PreparedStatementstatement=connection.prepareStatement("select t.* from transactions t where exists(select null from files f where f.transactionId = t.transactionId and f.fileStatus=? and t.username=?);");
statement.setInt(1,FileStatus.STARTED.toInt());
...
...
@@ -217,7 +217,7 @@ public class DBConnectionImpl implements DBConnection {
logger.info("Requesting transactions which were executed during a given ssh session");
logger.info("Requesting transactions which were executed during ssh session with id "+session.getSessionId());
Connectionconnection=dataSource.getConnection();
PreparedStatementstatement=connection.prepareStatement("select t.* from transactions as t inner join transactionsWithSessions as ts on t.transactionId = ts.transactionId where ts.sessionId = ?;");
statement.setInt(1,session.getSessionId());
...
...
@@ -233,7 +233,7 @@ public class DBConnectionImpl implements DBConnection {
logger.info("Requesting sessions during which a given transaction was executed");
logger.info("Requesting sessions during which transaction with id "+transaction.getTransactionId()+" was executed");
Connectionconnection=dataSource.getConnection();
PreparedStatementstatement=connection.prepareStatement("select s.* from sessions as s inner join transactionsWithSessions as ts on s.sessionId = ts.sessionId where ts.transactionId = ?;");