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/Ref.java (1 of 18352 files). Show all

Unified · Split

java/pkg/java/sql/Ref.java+127−0
@@ -0,0 +1,127 @@
1+/*
2+ * Copyright (c) 1998, 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+ * The mapping in the Java programming language of an SQL <code>REF</code>
30+ * value, which is a reference to an SQL structured type value in the database.
31+ * <P>
32+ * SQL <code>REF</code> values are stored in a table that contains
33+ * instances of a referenceable SQL structured type, and each <code>REF</code>
34+ * value is a unique identifier for one instance in that table.
35+ * An SQL <code>REF</code> value may be used in place of the
36+ * SQL structured type it references, either as a column value in a
37+ * table or an attribute value in a structured type.
38+ * <P>
39+ * Because an SQL <code>REF</code> value is a logical pointer to an
40+ * SQL structured type, a <code>Ref</code> object is by default also a logical
41+ * pointer. Thus, retrieving an SQL <code>REF</code> value as
42+ * a <code>Ref</code> object does not materialize
43+ * the attributes of the structured type on the client.
44+ * <P>
45+ * A <code>Ref</code> object can be stored in the database using the
46+ * <code>PreparedStatement.setRef</code> method.
47+ * <p>
48+ * All methods on the <code>Ref</code> interface must be fully implemented if the
49+ * JDBC driver supports the data type.
50+ *
51+ * @see Struct
52+ * @since 1.2
53+ */
54+public interface Ref {
55+
56+ /**
57+ * Retrieves the fully-qualified SQL name of the SQL structured type that
58+ * this <code>Ref</code> object references.
59+ *
60+ * @return the fully-qualified SQL name of the referenced SQL structured type
61+ * @exception SQLException if a database access error occurs
62+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
63+ * this method
64+ * @since 1.2
65+ */
66+ String getBaseTypeName() throws SQLException;
67+
68+ /**
69+ * Retrieves the referenced object and maps it to a Java type
70+ * using the given type map.
71+ *
72+ * @param map a <code>java.util.Map</code> object that contains
73+ * the mapping to use (the fully-qualified name of the SQL
74+ * structured type being referenced and the class object for
75+ * <code>SQLData</code> implementation to which the SQL
76+ * structured type will be mapped)
77+ * @return a Java <code>Object</code> that is the custom mapping for
78+ * the SQL structured type to which this <code>Ref</code>
79+ * object refers
80+ * @exception SQLException if a database access error occurs
81+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
82+ * this method
83+ * @since 1.4
84+ * @see #setObject
85+ */
86+ Object getObject(java.util.Map<String,Class<?>> map) throws SQLException;
87+
88+
89+ /**
90+ * Retrieves the SQL structured type instance referenced by
91+ * this <code>Ref</code> object. If the connection's type map has an entry
92+ * for the structured type, the instance will be custom mapped to
93+ * the Java class indicated in the type map. Otherwise, the
94+ * structured type instance will be mapped to a <code>Struct</code> object.
95+ *
96+ * @return a Java <code>Object</code> that is the mapping for
97+ * the SQL structured type to which this <code>Ref</code>
98+ * object refers
99+ * @exception SQLException if a database access error occurs
100+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
101+ * this method
102+ * @since 1.4
103+ * @see #setObject
104+ */
105+ Object getObject() throws SQLException;
106+
107+ /**
108+ * Sets the structured type value that this <code>Ref</code>
109+ * object references to the given instance of <code>Object</code>.
110+ * The driver converts this to an SQL structured type when it
111+ * sends it to the database.
112+ *
113+ * @param value an <code>Object</code> representing the SQL
114+ * structured type instance that this
115+ * <code>Ref</code> object will reference
116+ * @exception SQLException if a database access error occurs
117+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
118+ * this method
119+ * @since 1.4
120+ * @see #getObject()
121+ * @see #getObject(Map)
122+ * @see PreparedStatement#setObject(int, Object)
123+ * @see CallableStatement#setObject(String, Object)
124+ */
125+ void setObject(Object value) throws SQLException;
126+
127+}