@SuppressWarnings("unchecked") @Override public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { return (T) getObject(columnLabel); // Just ignore type since we only support built-in types }
@Override public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { return getObject(columnIndex); // Just ignore map since we only support built-in types }
@SuppressWarnings("unchecked") @Override public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { return (T) getObject(columnIndex); // Just ignore type since we only support built-in types }
@Override public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { return getObject(findColumn(columnLabel), map); }
@Override public Object getObject(String columnLabel) throws SQLException { return getObject(findColumn(columnLabel)); }
@SuppressWarnings("unchecked") @Override public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { return (T) getObject(columnLabel); // Just ignore type since we only support built-in types }
@SuppressWarnings("unchecked") @Override public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { return (T) getObject(columnLabel); // Just ignore type since we only support built-in types }
@Override public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { return getObject(columnIndex); // Just ignore map since we only support built-in types }
@Override public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { return getObject(columnIndex); // Just ignore map since we only support built-in types }
@SuppressWarnings("unchecked") @Override public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { return (T) getObject(columnIndex); // Just ignore type since we only support built-in types }
@SuppressWarnings("unchecked") @Override public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { return (T) getObject(columnIndex); // Just ignore type since we only support built-in types }
@Override public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { return getObject(findColumn(columnLabel), map); }
@Override public Object getObject(String columnLabel) throws SQLException { return getObject(findColumn(columnLabel)); }
@Override public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { return getObject(findColumn(columnLabel), map); }
@Override public Object getObject(String columnLabel) throws SQLException { return getObject(findColumn(columnLabel)); }
@Test public void testMapResultsResultSetClassOfR_Long() throws Exception { PhoenixProjectedResultMapper mapper = new PhoenixProjectedResultMapper(null); @SuppressWarnings("resource") PhoenixResultSet rs = mock(PhoenixResultSet.class); ResultSetMetaData rsMeta = mock(ResultSetMetaData.class); when(rs.getMetaData()).thenReturn(rsMeta); when(rs.next()).thenAnswer(new Answer<Boolean>() { boolean t = false; @Override public Boolean answer(InvocationOnMock invocation) throws Throwable { t = !t; return t; } }); when(rsMeta.getColumnCount()).thenReturn(1); when(rsMeta.getColumnName(1)).thenReturn("count"); when(rs.getObject(any())).thenReturn(new Long(1000)); Iterable<Long> longL = mapper.mapResults(rs, Long.class); assertNotNull(longL); Iterator<Long> it = longL.iterator(); assertTrue(it.next() == 1000); assertFalse(it.hasNext()); }
@Test public void testMapResultsResultSetClassOfR_Int() throws Exception { PhoenixProjectedResultMapper mapper = new PhoenixProjectedResultMapper(null); @SuppressWarnings("resource") PhoenixResultSet rs = mock(PhoenixResultSet.class); ResultSetMetaData rsMeta = mock(ResultSetMetaData.class); when(rs.getMetaData()).thenReturn(rsMeta); when(rs.next()).thenAnswer(new Answer<Boolean>() { boolean t = false; @Override public Boolean answer(InvocationOnMock invocation) throws Throwable { t = !t; return t; } }); when(rsMeta.getColumnCount()).thenReturn(1); when(rsMeta.getColumnName(1)).thenReturn("count"); when(rs.getObject(any())).thenReturn(new Integer(1000)); Iterable<Integer> intL = mapper.mapResults(rs, Integer.class); assertNotNull(intL); Iterator<Integer> it = intL.iterator(); assertTrue(it.next() == 1000); assertFalse(it.hasNext()); }