History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/java/sql/ParameterMetaData.java (1 of 18352 files). Show all

Unified · Split

java/pkg/java/sql/ParameterMetaData.java+196−0
@@ -0,0 +1,196 @@
1+/*
2+ * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * This code is free software; you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License version 2 only, as
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package java.sql;
27+
28+/**
29+ * An object that can be used to get information about the types
30+ * and properties for each parameter marker in a
31+ * <code>PreparedStatement</code> object. For some queries and driver
32+ * implementations, the data that would be returned by a <code>ParameterMetaData</code>
33+ * object may not be available until the <code>PreparedStatement</code> has
34+ * been executed.
35+ *<p>
36+ *Some driver implementations may not be able to provide information about the
37+ *types and properties for each parameter marker in a <code>CallableStatement</code>
38+ *object.
39+ *
40+ * @since 1.4
41+ */
42+
43+public interface ParameterMetaData extends Wrapper {
44+
45+ /**
46+ * Retrieves the number of parameters in the <code>PreparedStatement</code>
47+ * object for which this <code>ParameterMetaData</code> object contains
48+ * information.
49+ *
50+ * @return the number of parameters
51+ * @exception SQLException if a database access error occurs
52+ * @since 1.4
53+ */
54+ int getParameterCount() throws SQLException;
55+
56+ /**
57+ * Retrieves whether null values are allowed in the designated parameter.
58+ *
59+ * @param param the first parameter is 1, the second is 2, ...
60+ * @return the nullability status of the given parameter; one of
61+ * <code>ParameterMetaData.parameterNoNulls</code>,
62+ * <code>ParameterMetaData.parameterNullable</code>, or
63+ * <code>ParameterMetaData.parameterNullableUnknown</code>
64+ * @exception SQLException if a database access error occurs
65+ * @since 1.4
66+ */
67+ int isNullable(int param) throws SQLException;
68+
69+ /**
70+ * The constant indicating that a
71+ * parameter will not allow <code>NULL</code> values.
72+ */
73+ int parameterNoNulls = 0;
74+
75+ /**
76+ * The constant indicating that a
77+ * parameter will allow <code>NULL</code> values.
78+ */
79+ int parameterNullable = 1;
80+
81+ /**
82+ * The constant indicating that the
83+ * nullability of a parameter is unknown.
84+ */
85+ int parameterNullableUnknown = 2;
86+
87+ /**
88+ * Retrieves whether values for the designated parameter can be signed numbers.
89+ *
90+ * @param param the first parameter is 1, the second is 2, ...
91+ * @return <code>true</code> if so; <code>false</code> otherwise
92+ * @exception SQLException if a database access error occurs
93+ * @since 1.4
94+ */
95+ boolean isSigned(int param) throws SQLException;
96+
97+ /**
98+ * Retrieves the designated parameter's specified column size.
99+ *
100+ * <P>The returned value represents the maximum column size for the given parameter.
101+ * For numeric data, this is the maximum precision. For character data, this is the length in characters.
102+ * For datetime datatypes, this is the length in characters of the String representation (assuming the
103+ * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype,
104+ * this is the length in bytes. 0 is returned for data types where the
105+ * column size is not applicable.
106+ *
107+ * @param param the first parameter is 1, the second is 2, ...
108+ * @return precision
109+ * @exception SQLException if a database access error occurs
110+ * @since 1.4
111+ */
112+ int getPrecision(int param) throws SQLException;
113+
114+ /**
115+ * Retrieves the designated parameter's number of digits to right of the decimal point.
116+ * 0 is returned for data types where the scale is not applicable.
117+ *
118+ * @param param the first parameter is 1, the second is 2, ...
119+ * @return scale
120+ * @exception SQLException if a database access error occurs
121+ * @since 1.4
122+ */
123+ int getScale(int param) throws SQLException;
124+
125+ /**
126+ * Retrieves the designated parameter's SQL type.
127+ *
128+ * @param param the first parameter is 1, the second is 2, ...
129+ * @return SQL type from <code>java.sql.Types</code>
130+ * @exception SQLException if a database access error occurs
131+ * @since 1.4
132+ * @see Types
133+ */
134+ int getParameterType(int param) throws SQLException;
135+
136+ /**
137+ * Retrieves the designated parameter's database-specific type name.
138+ *
139+ * @param param the first parameter is 1, the second is 2, ...
140+ * @return type the name used by the database. If the parameter type is
141+ * a user-defined type, then a fully-qualified type name is returned.
142+ * @exception SQLException if a database access error occurs
143+ * @since 1.4
144+ */
145+ String getParameterTypeName(int param) throws SQLException;
146+
147+
148+ /**
149+ * Retrieves the fully-qualified name of the Java class whose instances
150+ * should be passed to the method <code>PreparedStatement.setObject</code>.
151+ *
152+ * @param param the first parameter is 1, the second is 2, ...
153+ * @return the fully-qualified name of the class in the Java programming
154+ * language that would be used by the method
155+ * <code>PreparedStatement.setObject</code> to set the value
156+ * in the specified parameter. This is the class name used
157+ * for custom mapping.
158+ * @exception SQLException if a database access error occurs
159+ * @since 1.4
160+ */
161+ String getParameterClassName(int param) throws SQLException;
162+
163+ /**
164+ * The constant indicating that the mode of the parameter is unknown.
165+ */
166+ int parameterModeUnknown = 0;
167+
168+ /**
169+ * The constant indicating that the parameter's mode is IN.
170+ */
171+ int parameterModeIn = 1;
172+
173+ /**
174+ * The constant indicating that the parameter's mode is INOUT.
175+ */
176+ int parameterModeInOut = 2;
177+
178+ /**
179+ * The constant indicating that the parameter's mode is OUT.
180+ */
181+ int parameterModeOut = 4;
182+
183+ /**
184+ * Retrieves the designated parameter's mode.
185+ *
186+ * @param param the first parameter is 1, the second is 2, ...
187+ * @return mode of the parameter; one of
188+ * <code>ParameterMetaData.parameterModeIn</code>,
189+ * <code>ParameterMetaData.parameterModeOut</code>, or
190+ * <code>ParameterMetaData.parameterModeInOut</code>
191+ * <code>ParameterMetaData.parameterModeUnknown</code>.
192+ * @exception SQLException if a database access error occurs
193+ * @since 1.4
194+ */
195+ int getParameterMode(int param) throws SQLException;
196+}