01: package liquibase.database.template;
02:
03: import liquibase.util.JdbcUtils;
04:
05: import java.sql.PreparedStatement;
06:
07: /**
08: * Interface to be implemented for setting values for more complex database specific
09: * types not supported by the standard setObject method.
10: * <p/>
11: * <p>Implementations perform the actual work of setting the actual values. They must
12: * implement the callback method <code>setTypeValue</code> which can throw SQLExceptions
13: * that will be caught and translated by the calling code. This callback method has
14: * access to the underlying Connection via the given PreparedStatement object, if that
15: * should be needed to create any database-specific objects.
16: *
17: * @author Spring Framework
18: * @see java.sql.Types
19: * @see java.sql.PreparedStatement#setObject
20: */
21: interface SqlTypeValue {
22:
23: /**
24: * Constant that indicates an unknown (or unspecified) SQL type.
25: * Passed into <code>setTypeValue</code> if the original operation method
26: * does not specify a SQL type.
27: *
28: * @see java.sql.Types
29: */
30: int TYPE_UNKNOWN = JdbcUtils.TYPE_UNKNOWN;
31:
32: /**
33: * Set the type value on the given PreparedStatement.
34: *
35: * @param ps the PreparedStatement to work on
36: * @param paramIndex the index of the parameter for which we need to set the value
37: * @param sqlType SQL type of the parameter we are setting
38: * @param typeName the type name of the parameter (optional)
39: * @throws java.sql.SQLException if a SQLException is encountered setting parameter values
40: * (that is, there's no need to catch SQLException)
41: * @see java.sql.Types
42: * @see java.sql.PreparedStatement#setObject
43: */
44: void setTypeValue(PreparedStatement ps, int paramIndex,
45: int sqlType, String typeName);
46:
47: }
|