Search in sources :

Example 1 with SqlMapClient

use of com.ibatis.sqlmap.client.SqlMapClient in project camel by apache.

the class IBatisProducer method doDelete.

private void doDelete(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("Deleting: {} using statement: {}", value, statement);
            result = client.delete(statement, value);
            doProcessResult(exchange, result);
        }
    } else {
        LOG.trace("Deleting using statement: {}", statement);
        result = client.delete(statement);
        doProcessResult(exchange, result);
    }
}
Also used : SqlMapClient(com.ibatis.sqlmap.client.SqlMapClient)

Example 2 with SqlMapClient

use of com.ibatis.sqlmap.client.SqlMapClient in project camel by apache.

the class IBatisProducer method doInsert.

private void doInsert(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("Inserting: {} using statement: {}", value, statement);
            result = client.insert(statement, value);
            doProcessResult(exchange, result);
        }
    } else {
        LOG.trace("Inserting using statement: {}", statement);
        result = client.insert(statement);
        doProcessResult(exchange, result);
    }
}
Also used : SqlMapClient(com.ibatis.sqlmap.client.SqlMapClient)

Example 3 with SqlMapClient

use of com.ibatis.sqlmap.client.SqlMapClient in project pinpoint by naver.

the class SqlMapClientIT method queryForPaginagedListShouldBeTraced.

@Test
public void queryForPaginagedListShouldBeTraced() throws Exception {
    SqlMapClient sqlMapClient = new SqlMapClientImpl(super.mockSqlMapExecutorDelegate);
    super.testAndVerifyQueryForPaginatedList(sqlMapClient);
}
Also used : SqlMapClientImpl(com.ibatis.sqlmap.engine.impl.SqlMapClientImpl) SqlMapClient(com.ibatis.sqlmap.client.SqlMapClient) Test(org.junit.Test)

Example 4 with SqlMapClient

use of com.ibatis.sqlmap.client.SqlMapClient in project pinpoint by naver.

the class SqlMapClientIT method insertShouldBeTraced.

@Test
public void insertShouldBeTraced() throws Exception {
    SqlMapClient sqlMapClient = new SqlMapClientImpl(super.mockSqlMapExecutorDelegate);
    super.testAndVerifyInsert(sqlMapClient);
}
Also used : SqlMapClientImpl(com.ibatis.sqlmap.engine.impl.SqlMapClientImpl) SqlMapClient(com.ibatis.sqlmap.client.SqlMapClient) Test(org.junit.Test)

Example 5 with SqlMapClient

use of com.ibatis.sqlmap.client.SqlMapClient in project pinpoint by naver.

the class SqlMapClientIT method queryForListShouldBeTraced.

@Test
public void queryForListShouldBeTraced() throws Exception {
    SqlMapClient sqlMapClient = new SqlMapClientImpl(super.mockSqlMapExecutorDelegate);
    super.testAndVerifyQueryForList(sqlMapClient);
}
Also used : SqlMapClientImpl(com.ibatis.sqlmap.engine.impl.SqlMapClientImpl) SqlMapClient(com.ibatis.sqlmap.client.SqlMapClient) Test(org.junit.Test)

Aggregations

SqlMapClient (com.ibatis.sqlmap.client.SqlMapClient)15 Test (org.junit.Test)9 SqlMapClientImpl (com.ibatis.sqlmap.engine.impl.SqlMapClientImpl)8 SQLException (java.sql.SQLException)1 Anotherawfultable (mbg.test.ib2j5.generated.miscellaneous.model.Anotherawfultable)1