001 /*
002 * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package java.sql;
027
028 /**
029 * <p>The standard mapping in the Java programming language for an SQL
030 * structured type. A <code>Struct</code> object contains a
031 * value for each attribute of the SQL structured type that
032 * it represents.
033 * By default, an instance of<code>Struct</code> is valid as long as the
034 * application has a reference to it.
035 * <p>
036 * All methods on the <code>Struct</code> interface must be fully implemented if the
037 * JDBC driver supports the data type.
038 * @since 1.2
039 */
040
041 public interface Struct {
042
043 /**
044 * Retrieves the SQL type name of the SQL structured type
045 * that this <code>Struct</code> object represents.
046 *
047 * @return the fully-qualified type name of the SQL structured
048 * type for which this <code>Struct</code> object
049 * is the generic representation
050 * @exception SQLException if a database access error occurs
051 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
052 * this method
053 * @since 1.2
054 */
055 String getSQLTypeName() throws SQLException;
056
057 /**
058 * Produces the ordered values of the attributes of the SQL
059 * structured type that this <code>Struct</code> object represents.
060 * As individual attributes are processed, this method uses the type map
061 * associated with the
062 * connection for customizations of the type mappings.
063 * If there is no
064 * entry in the connection's type map that matches the structured
065 * type that an attribute represents,
066 * the driver uses the standard mapping.
067 * <p>
068 * Conceptually, this method calls the method
069 * <code>getObject</code> on each attribute
070 * of the structured type and returns a Java array containing
071 * the result.
072 *
073 * @return an array containing the ordered attribute values
074 * @exception SQLException if a database access error occurs
075 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
076 * this method
077 * @since 1.2
078 */
079 Object[] getAttributes() throws SQLException;
080
081 /**
082 * Produces the ordered values of the attributes of the SQL
083 * structured type that this <code>Struct</code> object represents.
084 * As individual attrbutes are proccessed, this method uses the given type map
085 * for customizations of the type mappings.
086 * If there is no
087 * entry in the given type map that matches the structured
088 * type that an attribute represents,
089 * the driver uses the standard mapping. This method never
090 * uses the type map associated with the connection.
091 * <p>
092 * Conceptually, this method calls the method
093 * <code>getObject</code> on each attribute
094 * of the structured type and returns a Java array containing
095 * the result.
096 *
097 * @param map a mapping of SQL type names to Java classes
098 * @return an array containing the ordered attribute values
099 * @exception SQLException if a database access error occurs
100 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
101 * this method
102 * @since 1.2
103 */
104 Object[] getAttributes(java.util.Map<String, Class<?>> map)
105 throws SQLException;
106 }
|