KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > sql > ParameterMetaData


1 /*
2  * @(#)ParameterMetaData.java 1.11 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.sql;
9
10 /**
11  * An object that can be used to get information about the types
12  * and properties of the parameters in a <code>PreparedStatement</code> object.
13  *
14  * @since 1.4
15  */

16
17 public interface ParameterMetaData {
18
19     /**
20      * Retrieves the number of parameters in the <code>PreparedStatement</code>
21      * object for which this <code>ParameterMetaData</code> object contains
22      * information.
23      *
24      * @return the number of parameters
25      * @exception SQLException if a database access error occurs
26      * @since 1.4
27      */

28     int getParameterCount() throws SQLException JavaDoc;
29
30     /**
31      * Retrieves whether null values are allowed in the designated parameter.
32      *
33      * @param param the first parameter is 1, the second is 2, ...
34      * @return the nullability status of the given parameter; one of
35      * <code>ParameterMetaData.parameterNoNulls</code>,
36      * <code>ParameterMetaData.parameterNullable</code>, or
37      * <code>ParameterMetaData.parameterNullableUnknown</code>
38      * @exception SQLException if a database access error occurs
39      * @since 1.4
40      */

41     int isNullable(int param) throws SQLException JavaDoc;
42
43     /**
44      * The constant indicating that a
45      * parameter will not allow <code>NULL</code> values.
46      */

47     int parameterNoNulls = 0;
48
49     /**
50      * The constant indicating that a
51      * parameter will allow <code>NULL</code> values.
52      */

53     int parameterNullable = 1;
54
55     /**
56      * The constant indicating that the
57      * nullability of a parameter is unknown.
58      */

59     int parameterNullableUnknown = 2;
60
61     /**
62      * Retrieves whether values for the designated parameter can be signed numbers.
63      *
64      * @param param the first parameter is 1, the second is 2, ...
65      * @return <code>true</code> if so; <code>false</code> otherwise
66      * @exception SQLException if a database access error occurs
67      * @since 1.4
68      */

69     boolean isSigned(int param) throws SQLException JavaDoc;
70
71     /**
72      * Retrieves the designated parameter's number of decimal digits.
73      *
74      * @param param the first parameter is 1, the second is 2, ...
75      * @return precision
76      * @exception SQLException if a database access error occurs
77      * @since 1.4
78      */

79     int getPrecision(int param) throws SQLException JavaDoc;
80
81     /**
82      * Retrieves the designated parameter's number of digits to right of the decimal point.
83      *
84      * @param param the first parameter is 1, the second is 2, ...
85      * @return scale
86      * @exception SQLException if a database access error occurs
87      * @since 1.4
88      */

89     int getScale(int param) throws SQLException JavaDoc;
90
91     /**
92      * Retrieves the designated parameter's SQL type.
93      *
94      * @param param the first parameter is 1, the second is 2, ...
95      * @return SQL type from <code>java.sql.Types</code>
96      * @exception SQLException if a database access error occurs
97      * @since 1.4
98      * @see Types
99      */

100     int getParameterType(int param) throws SQLException JavaDoc;
101
102     /**
103      * Retrieves the designated parameter's database-specific type name.
104      *
105      * @param param the first parameter is 1, the second is 2, ...
106      * @return type the name used by the database. If the parameter type is
107      * a user-defined type, then a fully-qualified type name is returned.
108      * @exception SQLException if a database access error occurs
109      * @since 1.4
110      */

111     String JavaDoc getParameterTypeName(int param) throws SQLException JavaDoc;
112
113  
114     /**
115      * Retrieves the fully-qualified name of the Java class whose instances
116      * should be passed to the method <code>PreparedStatement.setObject</code>.
117      *
118      * @param param the first parameter is 1, the second is 2, ...
119      * @return the fully-qualified name of the class in the Java programming
120      * language that would be used by the method
121      * <code>PreparedStatement.setObject</code> to set the value
122      * in the specified parameter. This is the class name used
123      * for custom mapping.
124      * @exception SQLException if a database access error occurs
125      * @since 1.4
126      */

127     String JavaDoc getParameterClassName(int param) throws SQLException JavaDoc;
128
129     /**
130      * The constant indicating that the mode of the parameter is unknown.
131      */

132     int parameterModeUnknown = 0;
133
134     /**
135      * The constant indicating that the parameter's mode is IN.
136      */

137     int parameterModeIn = 1;
138
139     /**
140      * The constant indicating that the parameter's mode is INOUT.
141      */

142     int parameterModeInOut = 2;
143
144     /**
145      * The constant indicating that the parameter's mode is OUT.
146      */

147     int parameterModeOut = 4;
148
149     /**
150      * Retrieves the designated parameter's mode.
151      *
152      * @param param the first parameter is 1, the second is 2, ...
153      * @return mode of the parameter; one of
154      * <code>ParameterMetaData.parameterModeIn</code>,
155      * <code>ParameterMetaData.parameterModeOut</code>, or
156      * <code>ParameterMetaData.parameterModeInOut</code>
157      * <code>ParameterMetaData.parameterModeUnknown</code>.
158      * @exception SQLException if a database access error occurs
159      * @since 1.4
160      */

161     int getParameterMode(int param) throws SQLException JavaDoc;
162 }
163
Popular Tags