Java Code Examples for java.sql.ResultSet.getSQLXML()

The following are Jave code examples for showing how to use getSQLXML() of the java.sql.ResultSet class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: calcite-avatica   File: AvaticaResultSetConversionsTest.java   Source Code and License Vote up 5 votes
public void testGetSQLXML(ResultSet resultSet) throws SQLException {
  try {
    resultSet.getSQLXML(ordinal);
    fail("Was expecting to throw SQLDataException");
  } catch (Exception e) {
    assertThat(e, isA((Class) SQLDataException.class)); // success
  }
}
 
Example 2
Project: jforgame   File: BeanProcessor.java   Source Code and License Vote up 4 votes
protected Object processColumn(ResultSet rs, int index, Class<?> propType)
        throws SQLException
{
    if ((!propType.isPrimitive()) && (rs.getObject(index) == null)) {
        return null;
    }
    if (propType.equals(String.class)) {
        return rs.getString(index);
    }
    if ((propType.equals(Integer.TYPE)) || (propType.equals(Integer.class))) {
        return Integer.valueOf(rs.getInt(index));
    }
    if ((propType.equals(Boolean.TYPE)) || (propType.equals(Boolean.class))) {
        return Boolean.valueOf(rs.getBoolean(index));
    }
    if ((propType.equals(Long.TYPE)) || (propType.equals(Long.class))) {
        return Long.valueOf(rs.getLong(index));
    }
    if ((propType.equals(Double.TYPE)) || (propType.equals(Double.class))) {
        return Double.valueOf(rs.getDouble(index));
    }
    if ((propType.equals(Float.TYPE)) || (propType.equals(Float.class))) {
        return Float.valueOf(rs.getFloat(index));
    }
    if ((propType.equals(Short.TYPE)) || (propType.equals(Short.class))) {
        return Short.valueOf(rs.getShort(index));
    }
    if ((propType.equals(Byte.TYPE)) || (propType.equals(Byte.class))) {
        return Byte.valueOf(rs.getByte(index));
    }
    if (propType.equals(Timestamp.class)) {
        return rs.getTimestamp(index);
    }
    if (propType.equals(SQLXML.class)) {
        return rs.getSQLXML(index);
    }
    if (propType.isEnum()) {
    	return Enum.valueOf( (Class<? extends Enum>) propType, rs.getString(index));
    }
    return rs.getObject(index);
}
 
Example 3
Project: lams   File: Jdbc4SqlXmlHandler.java   Source Code and License Vote up 4 votes
@Override
public Source getXmlAsSource(ResultSet rs, String columnName, Class<? extends Source> sourceClass) throws SQLException {
	SQLXML xmlObject = rs.getSQLXML(columnName);
	return (sourceClass != null ? xmlObject.getSource(sourceClass) : xmlObject.getSource(DOMSource.class));
}
 
Example 4
Project: lams   File: Jdbc4SqlXmlHandler.java   Source Code and License Vote up 4 votes
@Override
public Source getXmlAsSource(ResultSet rs, int columnIndex, Class<? extends Source> sourceClass) throws SQLException {
	SQLXML xmlObject = rs.getSQLXML(columnIndex);
	return (sourceClass != null ? xmlObject.getSource(sourceClass) : xmlObject.getSource(DOMSource.class));
}