use of jp.ossc.nimbus.core.ServiceNotFoundException in project nimbus by nimbus-org.
the class TransactionLoggingConnection method writeLog.
protected void writeLog(String sql, int queryType, PrepareValue[] params) throws SQLException {
if (!isUpdateQuery(sql)) {
return;
}
initTransactionStatement();
Sequence sequence = this.sequence;
if (sequence == null && sequenceServiceName != null) {
try {
sequence = (Sequence) ServiceManagerFactory.getServiceObject(sequenceServiceName);
} catch (ServiceNotFoundException e) {
}
}
if (sequence == null) {
throw new SQLException("Sequence is null.");
}
final String seq = sequence.increment();
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (params[i] == null) {
continue;
}
transactionParamInsertStatement.setString(1, seq);
transactionParamInsertStatement.setInt(2, i + 1);
setParam(params[i]);
if (isBatch) {
transactionParamInsertStatement.addBatch();
} else {
transactionParamInsertStatement.executeUpdate();
}
}
if (isBatch && getAutoCommit()) {
transactionParamInsertStatement.executeBatch();
}
}
transactionInsertStatement.setString(1, seq);
transactionInsertStatement.setCharacterStream(2, new CharArrayReader(sql.toCharArray()), sql.length());
transactionInsertStatement.setInt(3, queryType);
transactionInsertStatement.setTimestamp(4, new Timestamp(System.currentTimeMillis()));
transactionInsertStatement.setString(5, updateUser);
if (!isBatch || getAutoCommit()) {
transactionInsertStatement.executeUpdate();
} else {
transactionInsertStatement.addBatch();
}
}
Aggregations