jdk/src/share/classes/java/sql/Ref.java
author yan
Fri, 28 Mar 2014 15:56:24 +0400
changeset 23590 ffd8b0b70511
parent 5506 202f599c92aa
permissions -rw-r--r--
8038493: Tidy warnings cleanup for java.sql Reviewed-by: lancea, chegar Contributed-by: Alexander Stepanov <alexander.v.stepanov@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * The mapping in the Java programming language of an SQL <code>REF</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * value, which is a reference to an SQL structured type value in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * SQL <code>REF</code> values are stored in a table that contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * instances of a referenceable SQL structured type, and each <code>REF</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * value is a unique identifier for one instance in that table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * An SQL <code>REF</code> value may be used in place of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * SQL structured type it references, either as a column value in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * table or an attribute value in a structured type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * Because an SQL <code>REF</code> value is a logical pointer to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * SQL structured type, a <code>Ref</code> object is by default also a logical
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * pointer. Thus, retrieving an SQL <code>REF</code> value as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * a <code>Ref</code> object does not materialize
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * the attributes of the structured type on the client.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * A <code>Ref</code> object can be stored in the database using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <code>PreparedStatement.setRef</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * All methods on the <code>Ref</code> interface must be fully implemented if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * JDBC driver supports the data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @see Struct
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
public interface Ref {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * Retrieves the fully-qualified SQL name of the SQL structured type that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * this <code>Ref</code> object references.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @return the fully-qualified SQL name of the referenced SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    String getBaseTypeName() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Retrieves the referenced object and maps it to a Java type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * using the given type map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * @param map a <code>java.util.Map</code> object that contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     *        the mapping to use (the fully-qualified name of the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     *        structured type being referenced and the class object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *        <code>SQLData</code> implementation to which the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *        structured type will be mapped)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @return  a Java <code>Object</code> that is the custom mapping for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *          the SQL structured type to which this <code>Ref</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *          object refers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @see #setObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    Object getObject(java.util.Map<String,Class<?>> map) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Retrieves the SQL structured type instance referenced by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * this <code>Ref</code> object.  If the connection's type map has an entry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * for the structured type, the instance will be custom mapped to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * the Java class indicated in the type map.  Otherwise, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * structured type instance will be mapped to a <code>Struct</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @return  a Java <code>Object</code> that is the mapping for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *          the SQL structured type to which this <code>Ref</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     *          object refers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @see #setObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    Object getObject() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Sets the structured type value that this <code>Ref</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * object references to the given instance of <code>Object</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * The driver converts this to an SQL structured type when it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @param value an <code>Object</code> representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *        structured type instance that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *        <code>Ref</code> object will reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @see #getObject()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @see #getObject(Map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @see PreparedStatement#setObject(int, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @see CallableStatement#setObject(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    void setObject(Object value) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
}