Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/sql/Ref.java
38829 views
/*1* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.sql;2627/**28* The mapping in the Java programming language of an SQL <code>REF</code>29* value, which is a reference to an SQL structured type value in the database.30* <P>31* SQL <code>REF</code> values are stored in a table that contains32* instances of a referenceable SQL structured type, and each <code>REF</code>33* value is a unique identifier for one instance in that table.34* An SQL <code>REF</code> value may be used in place of the35* SQL structured type it references, either as a column value in a36* table or an attribute value in a structured type.37* <P>38* Because an SQL <code>REF</code> value is a logical pointer to an39* SQL structured type, a <code>Ref</code> object is by default also a logical40* pointer. Thus, retrieving an SQL <code>REF</code> value as41* a <code>Ref</code> object does not materialize42* the attributes of the structured type on the client.43* <P>44* A <code>Ref</code> object can be stored in the database using the45* <code>PreparedStatement.setRef</code> method.46* <p>47* All methods on the <code>Ref</code> interface must be fully implemented if the48* JDBC driver supports the data type.49*50* @see Struct51* @since 1.252*/53public interface Ref {5455/**56* Retrieves the fully-qualified SQL name of the SQL structured type that57* this <code>Ref</code> object references.58*59* @return the fully-qualified SQL name of the referenced SQL structured type60* @exception SQLException if a database access error occurs61* @exception SQLFeatureNotSupportedException if the JDBC driver does not support62* this method63* @since 1.264*/65String getBaseTypeName() throws SQLException;6667/**68* Retrieves the referenced object and maps it to a Java type69* using the given type map.70*71* @param map a <code>java.util.Map</code> object that contains72* the mapping to use (the fully-qualified name of the SQL73* structured type being referenced and the class object for74* <code>SQLData</code> implementation to which the SQL75* structured type will be mapped)76* @return a Java <code>Object</code> that is the custom mapping for77* the SQL structured type to which this <code>Ref</code>78* object refers79* @exception SQLException if a database access error occurs80* @exception SQLFeatureNotSupportedException if the JDBC driver does not support81* this method82* @since 1.483* @see #setObject84*/85Object getObject(java.util.Map<String,Class<?>> map) throws SQLException;868788/**89* Retrieves the SQL structured type instance referenced by90* this <code>Ref</code> object. If the connection's type map has an entry91* for the structured type, the instance will be custom mapped to92* the Java class indicated in the type map. Otherwise, the93* structured type instance will be mapped to a <code>Struct</code> object.94*95* @return a Java <code>Object</code> that is the mapping for96* the SQL structured type to which this <code>Ref</code>97* object refers98* @exception SQLException if a database access error occurs99* @exception SQLFeatureNotSupportedException if the JDBC driver does not support100* this method101* @since 1.4102* @see #setObject103*/104Object getObject() throws SQLException;105106/**107* Sets the structured type value that this <code>Ref</code>108* object references to the given instance of <code>Object</code>.109* The driver converts this to an SQL structured type when it110* sends it to the database.111*112* @param value an <code>Object</code> representing the SQL113* structured type instance that this114* <code>Ref</code> object will reference115* @exception SQLException if a database access error occurs116* @exception SQLFeatureNotSupportedException if the JDBC driver does not support117* this method118* @since 1.4119* @see #getObject()120* @see #getObject(Map)121* @see PreparedStatement#setObject(int, Object)122* @see CallableStatement#setObject(String, Object)123*/124void setObject(Object value) throws SQLException;125126}127128129