KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 2002-2005 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.CallableStatement JavaDoc;
20 import java.sql.SQLException JavaDoc;
21
22 /**
23  * Interface to be implemented for retrieving values for more complex database specific
24  * types not supported by the standard <code>getObject</code> method.
25  *
26  * <p>Implementations perform the actual work of getting the actual values. They must
27  * implement the callback method <code>getTypeValue</code> which can throw SQLExceptions
28  * that will be caught and translated by the calling code. This callback method has
29  * access to the underlying Connection via the given CallableStatement object, if that
30  * should be needed to create any database-specific objects.
31  *
32  * @author Thomas Risberg
33  * @since 1.1
34  * @see java.sql.Types
35  * @see java.sql.CallableStatement#getObject
36  * @see org.springframework.jdbc.object.StoredProcedure#execute(java.util.Map)
37  */

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

47     int TYPE_UNKNOWN = Integer.MIN_VALUE;
48
49     /**
50      * Get the type value from the specific object.
51      * @param cs the CallableStatement to work on
52      * @param paramIndex the index of the parameter for which we need to set the value
53      * @param sqlType SQL type of the parameter we are setting
54      * @param typeName the type name of the parameter
55      * @throws SQLException if a SQLException is encountered setting parameter values
56      * (that is, there's no need to catch SQLException)
57      * @see java.sql.Types
58      * @see java.sql.CallableStatement#getObject
59      */

60     Object JavaDoc getTypeValue(CallableStatement JavaDoc cs, int paramIndex, int sqlType, String JavaDoc typeName)
61             throws SQLException JavaDoc;
62
63 }
64
Popular Tags