| 1 16 17 package org.springframework.jdbc.core.support; 18 19 import java.sql.Connection ; 20 import java.sql.PreparedStatement ; 21 import java.sql.SQLException ; 22 23 import org.springframework.jdbc.core.SqlTypeValue; 24 25 53 public abstract class AbstractSqlTypeValue implements SqlTypeValue { 54 55 public final void setTypeValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName) 56 throws SQLException { 57 58 Object value = createTypeValue(ps.getConnection(), sqlType, typeName); 59 if (sqlType == TYPE_UNKNOWN) { 60 ps.setObject(paramIndex, value); 61 } 62 else { 63 ps.setObject(paramIndex, value, sqlType); 64 } 65 } 66 67 77 protected abstract Object createTypeValue(Connection con, int sqlType, String typeName) throws SQLException ; 78 79 } 80 | Popular Tags |