use of org.apache.ibatis.executor.parameter.ParameterHandler in project mybatis-3 by mybatis.
the class DefaultResultSetHandlerTest method shouldRetainColumnNameCase.
/**
* Contrary to the spec, some drivers require case-sensitive column names when getting result.
*
* @see <a href="http://code.google.com/p/mybatis/issues/detail?id=557">Issue 557</a>
*/
@Test
public void shouldRetainColumnNameCase() throws Exception {
final MappedStatement ms = getMappedStatement();
final Executor executor = null;
final ParameterHandler parameterHandler = null;
final ResultHandler resultHandler = null;
final BoundSql boundSql = null;
final RowBounds rowBounds = new RowBounds(0, 100);
final DefaultResultSetHandler fastResultSetHandler = new DefaultResultSetHandler(executor, ms, parameterHandler, resultHandler, boundSql, rowBounds);
when(stmt.getResultSet()).thenReturn(rs);
when(rs.getMetaData()).thenReturn(rsmd);
when(rs.getType()).thenReturn(ResultSet.TYPE_FORWARD_ONLY);
when(rs.next()).thenReturn(true).thenReturn(false);
when(rs.getInt("CoLuMn1")).thenReturn(100);
when(rs.wasNull()).thenReturn(false);
when(rsmd.getColumnCount()).thenReturn(1);
when(rsmd.getColumnLabel(1)).thenReturn("CoLuMn1");
when(rsmd.getColumnType(1)).thenReturn(Types.INTEGER);
when(rsmd.getColumnClassName(1)).thenReturn(Integer.class.getCanonicalName());
when(stmt.getConnection()).thenReturn(conn);
when(conn.getMetaData()).thenReturn(dbmd);
// for simplicity.
when(dbmd.supportsMultipleResultSets()).thenReturn(false);
final List<Object> results = fastResultSetHandler.handleResultSets(stmt);
assertEquals(1, results.size());
assertEquals(Integer.valueOf(100), ((HashMap) results.get(0)).get("cOlUmN1"));
}
use of org.apache.ibatis.executor.parameter.ParameterHandler in project pinpoint by naver.
the class BindingLogPlugin32 method getParameters.
private List<String> getParameters(MappedStatement ms, Object parameterObject, BoundSql boundSql) throws SQLException {
// DefaultParameterHandler is the only implementation of parameterHandler interface currently. it may be changed later.
// need additional codes to find a appropriate implementation in that case.
ParameterHandler parameterHandler = new DefaultParameterHandler(ms, parameterObject, boundSql);
PreparedStatementParameterLogger parameterLogger = new PreparedStatementParameterLogger();
parameterHandler.setParameters(parameterLogger);
return parameterLogger.getParameters();
}
use of org.apache.ibatis.executor.parameter.ParameterHandler in project mybatis-3 by mybatis.
the class Configuration method newParameterHandler.
public ParameterHandler newParameterHandler(MappedStatement mappedStatement, Object parameterObject, BoundSql boundSql) {
ParameterHandler parameterHandler = mappedStatement.getLang().createParameterHandler(mappedStatement, parameterObject, boundSql);
parameterHandler = (ParameterHandler) interceptorChain.pluginAll(parameterHandler);
return parameterHandler;
}
Aggregations