KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jdbc > core > SqlTypeValue


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.jdbc.core;
18
19 import java.sql.PreparedStatement JavaDoc;
20 import java.sql.SQLException JavaDoc;
21
22 import org.springframework.jdbc.support.JdbcUtils;
23
24 /**
25  * Interface to be implemented for setting values for more complex database specific
26  * types not supported by the standard setObject method.
27  *
28  * <p>Implementations perform the actual work of setting the actual values. They must
29  * implement the callback method <code>setTypeValue</code> which can throw SQLExceptions
30  * that will be caught and translated by the calling code. This callback method has
31  * access to the underlying Connection via the given PreparedStatement object, if that
32  * should be needed to create any database-specific objects.
33  *
34  * @author Thomas Risberg
35  * @author Juergen Hoeller
36  * @since 1.1
37  * @see java.sql.Types
38  * @see java.sql.PreparedStatement#setObject
39  * @see JdbcOperations#update(String, Object[], int[])
40  */

41 public interface SqlTypeValue {
42
43     /**
44      * Constant that indicates an unknown (or unspecified) SQL type.
45      * Passed into <code>setTypeValue</code> if the original operation method
46      * does not specify a SQL type.
47      * @see java.sql.Types
48      * @see JdbcOperations#update(String, Object[])
49      */

50     int TYPE_UNKNOWN = JdbcUtils.TYPE_UNKNOWN;
51
52
53     /**
54      * Set the type value on the given PreparedStatement.
55      * @param ps the PreparedStatement to work on
56      * @param paramIndex the index of the parameter for which we need to set the value
57      * @param sqlType SQL type of the parameter we are setting
58      * @param typeName the type name of the parameter (optional)
59      * @throws SQLException if a SQLException is encountered setting parameter values
60      * (that is, there's no need to catch SQLException)
61      * @see java.sql.Types
62      * @see java.sql.PreparedStatement#setObject
63      */

64     void setTypeValue(PreparedStatement JavaDoc ps, int paramIndex, int sqlType, String JavaDoc typeName) throws SQLException JavaDoc;
65
66 }
67
Popular Tags