use of io.seata.common.exception.StoreException in project XHuiCloud by sindaZeng.
the class LogStoreDataBaseDAO method updateGlobalTransactionDO.
@Override
public boolean updateGlobalTransactionDO(GlobalTransactionDO globalTransactionDO) {
String sql = LogStoreSqlsFactory.getLogStoreSqls(dbType).getUpdateGlobalTransactionStatusSQL(globalTable);
Connection conn = null;
PreparedStatement ps = null;
try {
conn = logStoreDataSource.getConnection();
conn.setAutoCommit(true);
ps = conn.prepareStatement(sql);
ps.setInt(1, globalTransactionDO.getStatus());
ps.setString(2, globalTransactionDO.getXid());
return ps.executeUpdate() > 0;
} catch (SQLException e) {
throw new StoreException(e);
} finally {
IOUtil.close(ps, conn);
}
}
use of io.seata.common.exception.StoreException in project XHuiCloud by sindaZeng.
the class LogStoreDataBaseDAO method insertBranchTransactionDO.
@Override
public boolean insertBranchTransactionDO(BranchTransactionDO branchTransactionDO) {
String sql = LogStoreSqlsFactory.getLogStoreSqls(dbType).getInsertBranchTransactionSQL(branchTable);
Connection conn = null;
PreparedStatement ps = null;
try {
conn = logStoreDataSource.getConnection();
conn.setAutoCommit(true);
ps = conn.prepareStatement(sql);
ps.setString(1, branchTransactionDO.getXid());
ps.setLong(2, branchTransactionDO.getTransactionId());
ps.setLong(3, branchTransactionDO.getBranchId());
ps.setString(4, branchTransactionDO.getResourceGroupId());
ps.setString(5, branchTransactionDO.getResourceId());
ps.setString(6, branchTransactionDO.getBranchType());
ps.setInt(7, branchTransactionDO.getStatus());
ps.setString(8, branchTransactionDO.getClientId());
ps.setString(9, branchTransactionDO.getApplicationData());
return ps.executeUpdate() > 0;
} catch (SQLException e) {
throw new StoreException(e);
} finally {
IOUtil.close(ps, conn);
}
}
use of io.seata.common.exception.StoreException in project XHuiCloud by sindaZeng.
the class LogStoreDataBaseDAO method deleteGlobalTransactionDO.
@Override
public boolean deleteGlobalTransactionDO(GlobalTransactionDO globalTransactionDO) {
String sql = LogStoreSqlsFactory.getLogStoreSqls(dbType).getDeleteGlobalTransactionSQL(globalTable);
Connection conn = null;
PreparedStatement ps = null;
try {
conn = logStoreDataSource.getConnection();
conn.setAutoCommit(true);
ps = conn.prepareStatement(sql);
ps.setString(1, globalTransactionDO.getXid());
ps.executeUpdate();
} catch (SQLException e) {
throw new StoreException(e);
} finally {
IOUtil.close(ps, conn);
}
return true;
}
use of io.seata.common.exception.StoreException in project XHuiCloud by sindaZeng.
the class LogStoreDataBaseDAO method deleteBranchTransactionDO.
@Override
public boolean deleteBranchTransactionDO(BranchTransactionDO branchTransactionDO) {
String sql = LogStoreSqlsFactory.getLogStoreSqls(dbType).getDeleteBranchTransactionByBranchIdSQL(branchTable);
Connection conn = null;
PreparedStatement ps = null;
try {
conn = logStoreDataSource.getConnection();
conn.setAutoCommit(true);
ps = conn.prepareStatement(sql);
ps.setString(1, branchTransactionDO.getXid());
ps.setLong(2, branchTransactionDO.getBranchId());
ps.executeUpdate();
} catch (SQLException e) {
throw new StoreException(e);
} finally {
IOUtil.close(ps, conn);
}
return true;
}
use of io.seata.common.exception.StoreException in project XHuiCloud by sindaZeng.
the class LogStoreDataBaseDAO method updateBranchTransactionDO.
@Override
public boolean updateBranchTransactionDO(BranchTransactionDO branchTransactionDO) {
String sql = LogStoreSqlsFactory.getLogStoreSqls(dbType).getUpdateBranchTransactionStatusSQL(branchTable);
Connection conn = null;
PreparedStatement ps = null;
try {
conn = logStoreDataSource.getConnection();
conn.setAutoCommit(true);
ps = conn.prepareStatement(sql);
ps.setInt(1, branchTransactionDO.getStatus());
ps.setString(2, branchTransactionDO.getXid());
ps.setLong(3, branchTransactionDO.getBranchId());
return ps.executeUpdate() > 0;
} catch (SQLException e) {
throw new StoreException(e);
} finally {
IOUtil.close(ps, conn);
}
}
Aggregations