001 package railo.runtime.query.caster; 002 003 import java.sql.ResultSet; 004 import java.sql.SQLException; 005 import java.sql.Types; 006 import java.util.TimeZone; 007 008 public class OtherCast implements Cast { 009 010 011 @Override 012 public Object toCFType(TimeZone tz, int type, ResultSet rst, int columnIndex) throws SQLException { 013 if(type!=Types.SMALLINT) return rst.getObject(columnIndex); 014 015 016 try{ 017 return rst.getObject(columnIndex); 018 } 019 // workaround for MSSQL Driver, in some situation getObject throws a cast exception using getString avoids this 020 catch(SQLException e){ 021 try{ 022 return rst.getString(columnIndex); 023 } 024 catch(SQLException e2){ 025 throw e; 026 } 027 } 028 } 029 030 }