001 package railo.runtime.query.caster; 002 003 import java.io.IOException; 004 import java.io.Reader; 005 import java.sql.ResultSet; 006 import java.sql.SQLException; 007 008 import railo.commons.io.IOUtil; 009 010 public class ClobCast implements Cast { 011 012 public Object toCFType(int type, ResultSet rst, int columnIndex) throws SQLException, IOException { 013 //IOUtil.toString(rst.getClob(columnIndex).getCharacterStream()) 014 015 Reader reader = null; 016 try { 017 reader = rst.getCharacterStream( columnIndex ); 018 if(reader==null) return null; 019 return IOUtil.toString(reader); 020 } 021 finally { 022 IOUtil.closeEL(reader); 023 } 024 } 025 026 }