mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 05:30:43 +00:00
Add transaction to AggregateInput and CountInput
This commit is contained in:
@ -108,7 +108,19 @@ public class RDBMSAggregateAction extends AbstractRDBMSAction implements Aggrega
|
||||
|
||||
Long mark = System.currentTimeMillis();
|
||||
|
||||
try(Connection connection = getConnection(aggregateInput))
|
||||
Connection connection;
|
||||
boolean needToCloseConnection = false;
|
||||
if(aggregateInput.getTransaction() != null && aggregateInput.getTransaction() instanceof RDBMSTransaction rdbmsTransaction)
|
||||
{
|
||||
connection = rdbmsTransaction.getConnection();
|
||||
}
|
||||
else
|
||||
{
|
||||
connection = getConnection(aggregateInput);
|
||||
needToCloseConnection = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
statement = connection.prepareStatement(sql);
|
||||
|
||||
@ -185,6 +197,11 @@ public class RDBMSAggregateAction extends AbstractRDBMSAction implements Aggrega
|
||||
finally
|
||||
{
|
||||
logSQL(sql, params, mark);
|
||||
|
||||
if(needToCloseConnection)
|
||||
{
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
return rs;
|
||||
|
@ -88,7 +88,19 @@ public class RDBMSCountAction extends AbstractRDBMSAction implements CountInterf
|
||||
CountOutput rs = new CountOutput();
|
||||
long mark = System.currentTimeMillis();
|
||||
|
||||
try(Connection connection = getConnection(countInput))
|
||||
Connection connection;
|
||||
boolean needToCloseConnection = false;
|
||||
if(countInput.getTransaction() != null && countInput.getTransaction() instanceof RDBMSTransaction rdbmsTransaction)
|
||||
{
|
||||
connection = rdbmsTransaction.getConnection();
|
||||
}
|
||||
else
|
||||
{
|
||||
connection = getConnection(countInput);
|
||||
needToCloseConnection = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
statement = connection.prepareStatement(sql);
|
||||
|
||||
@ -130,6 +142,11 @@ public class RDBMSCountAction extends AbstractRDBMSAction implements CountInterf
|
||||
finally
|
||||
{
|
||||
logSQL(sql, params, mark);
|
||||
|
||||
if(needToCloseConnection)
|
||||
{
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
return rs;
|
||||
|
Reference in New Issue
Block a user