use of com.ibatis.sqlmap.client.SqlMapClient in project pinpoint by naver.
the class SqlMapClientIT method updateShouldBeTraced.
@Test
public void updateShouldBeTraced() throws Exception {
SqlMapClient sqlMapClient = new SqlMapClientImpl(super.mockSqlMapExecutorDelegate);
super.testAndVerifyUpdate(sqlMapClient);
}
use of com.ibatis.sqlmap.client.SqlMapClient in project camel by apache.
the class IBatisProducer method doQueryForList.
private void doQueryForList(Exchange exchange) throws Exception {
SqlMapClient client = endpoint.getSqlMapClient();
Object result;
Object in = exchange.getIn().getBody();
if (in != null) {
LOG.trace("QueryForList: {} using statement: {}", in, statement);
result = client.queryForList(statement, in);
} else {
LOG.trace("QueryForList using statement: {}", statement);
result = client.queryForList(statement);
}
doProcessResult(exchange, result);
}
use of com.ibatis.sqlmap.client.SqlMapClient in project camel by apache.
the class IBatisProducer method doQueryForObject.
private void doQueryForObject(Exchange exchange) throws Exception {
SqlMapClient client = endpoint.getSqlMapClient();
Object result;
Object in = exchange.getIn().getBody();
if (in != null) {
LOG.trace("QueryForObject: {} using statement: {}", in, statement);
result = client.queryForObject(statement, in);
} else {
LOG.trace("QueryForObject using statement: {}", statement);
result = client.queryForObject(statement);
}
doProcessResult(exchange, result);
}
use of com.ibatis.sqlmap.client.SqlMapClient in project camel by apache.
the class IBatisProducer method doUpdate.
private void doUpdate(Exchange exchange) throws Exception {
SqlMapClient client = endpoint.getSqlMapClient();
Object result;
Object in = exchange.getIn().getBody();
if (in != null) {
// lets handle arrays or collections of objects
Iterator<?> iter = ObjectHelper.createIterator(in);
while (iter.hasNext()) {
Object value = iter.next();
LOG.trace("Updating: {} using statement: {}", value, statement);
result = client.update(statement, value);
doProcessResult(exchange, result);
}
} else {
LOG.trace("Updating using statement: {}", statement);
result = client.update(statement);
doProcessResult(exchange, result);
}
}
use of com.ibatis.sqlmap.client.SqlMapClient in project camel by apache.
the class DefaultIBatisProcessingStategy method commit.
public void commit(IBatisEndpoint endpoint, Exchange exchange, Object data, String consumeStatements) throws Exception {
SqlMapClient client = endpoint.getSqlMapClient();
boolean useTrans = endpoint.isUseTransactions();
String[] statements = consumeStatements.split(",");
try {
if (useTrans) {
client.startTransaction(isolation);
}
for (String statement : statements) {
client.update(statement.trim(), data);
}
if (useTrans) {
client.commitTransaction();
}
} finally {
if (useTrans) {
client.endTransaction();
}
}
}
Aggregations