1. /*
  2. * @(#)Struct.java 1.20 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.sql;
  8. /**
  9. * <p>The standard mapping in the Java programming language for an SQL
  10. * structured type. A <code>Struct</code> object contains a
  11. * value for each attribute of the SQL structured type that
  12. * it represents.
  13. * By default, an instance of<code>Struct</code> is valid as long as the
  14. * application has a reference to it.
  15. * @since 1.2
  16. */
  17. public interface Struct {
  18. /**
  19. * Retrieves the SQL type name of the SQL structured type
  20. * that this <code>Struct</code> object represents.
  21. *
  22. * @return the fully-qualified type name of the SQL structured
  23. * type for which this <code>Struct</code> object
  24. * is the generic representation
  25. * @exception SQLException if a database access error occurs
  26. */
  27. String getSQLTypeName() throws SQLException;
  28. /**
  29. * Produces the ordered values of the attributes of the SQL
  30. * structurec type that this <code>Struct</code> object represents.
  31. * This method uses the type map associated with the
  32. * connection for customizations of the type mappings.
  33. * If there is no
  34. * entry in the connection's type map that matches the structured
  35. * type that this <code>Struct</code> object represents,
  36. * the driver uses the standard mapping.
  37. * <p>
  38. * Conceptually, this method calls the method
  39. * <code>getObject</code> on each attribute
  40. * of the structured type and returns a Java array containing
  41. * the result.
  42. *
  43. * @return an array containing the ordered attribute values
  44. * @exception SQLException if a database access error occurs
  45. */
  46. Object[] getAttributes() throws SQLException;
  47. /**
  48. * Produces the ordered values of the attributes of the SQL
  49. * structurec type that this <code>Struct</code> object represents.
  50. * This method uses the given type map
  51. * for customizations of the type mappings.
  52. * If there is no
  53. * entry in the given type map that matches the structured
  54. * type that this <code>Struct</code> object represents,
  55. * the driver uses the standard mapping. This method never
  56. * uses the type map associated with the connection.
  57. * <p>
  58. * Conceptually, this method calls the method
  59. * <code>getObject</code> on each attribute
  60. * of the structured type and returns a Java array containing
  61. * the result.
  62. *
  63. * @param map a mapping of SQL type names to Java classes
  64. * @return an array containing the ordered attribute values
  65. * @exception SQLException if a database access error occurs
  66. */
  67. Object[] getAttributes(java.util.Map map) throws SQLException;
  68. }