1 2 12 package com.versant.core.jdbc.sql.conv; 13 14 import com.versant.core.jdbc.JdbcConverter; 15 import com.versant.core.jdbc.JdbcConverterFactory; 16 import com.versant.core.jdbc.JdbcTypeRegistry; 17 import com.versant.core.jdbc.metadata.JdbcColumn; 18 19 import javax.jdo.JDOFatalDataStoreException; import java.sql.PreparedStatement ; 21 import java.sql.SQLException ; 22 import java.sql.ResultSet ; 23 import java.sql.Types ; 24 25 32 public class ClobStringConverter extends JdbcConverterBase { 33 34 public static class Factory extends NoArgJdbcConverterFactory { 35 36 private ClobStringConverter converter; 37 38 42 public JdbcConverter createJdbcConverter(JdbcColumn col, Object args, 43 JdbcTypeRegistry jdbcTypeRegistry) { 44 if (converter == null) converter = new ClobStringConverter(); 45 return converter; 46 } 47 48 } 49 50 55 public Object get(ResultSet rs, int index, JdbcColumn col) 56 throws SQLException , JDOFatalDataStoreException { 57 return rs.getString(index); 58 } 59 60 65 public void set(PreparedStatement ps, int index, JdbcColumn col, Object value) 66 throws SQLException , JDOFatalDataStoreException { 67 if (value == null) { 68 ps.setNull(index, Types.LONGVARCHAR); 69 } else { 70 ps.setString(index, (String )value); 71 } 72 } 73 74 78 public Class getValueType() { 79 return String .class; 80 } 81 82 } 83 84 | Popular Tags |