Struct
Stay organized with collections
Save and categorize content based on your preferences.
The standard mapping in the Java programming language for an SQL
structured type. A Struct
object contains a
value for each attribute of the SQL structured type that
it represents.
By default, an instance ofStruct
is valid as long as the
application has a reference to it.
All methods on the Struct
interface must be fully implemented if the
JDBC driver supports the data type.
Public Method Summary
abstract
Object[]
|
getAttributes()
Produces the ordered values of the attributes of the SQL
structured type that this Struct object represents.
|
abstract
Object[]
|
getAttributes( Map< String, Class<?>> map)
Produces the ordered values of the attributes of the SQL
structured type that this Struct object represents.
|
abstract
String
|
getSQLTypeName()
Retrieves the SQL type name of the SQL structured type
that this Struct object represents.
|
Public Methods
public
abstract
Object[]
getAttributes
()
Produces the ordered values of the attributes of the SQL
structured type that this Struct
object represents.
As individual attributes are processed, this method uses the type map
associated with the
connection for customizations of the type mappings.
If there is no
entry in the connection's type map that matches the structured
type that an attribute represents,
the driver uses the standard mapping.
Conceptually, this method calls the method
getObject
on each attribute
of the structured type and returns a Java array containing
the result.
Returns
- an array containing the ordered attribute values
Produces the ordered values of the attributes of the SQL
structured type that this Struct
object represents.
As individual attrbutes are proccessed, this method uses the given type map
for customizations of the type mappings.
If there is no
entry in the given type map that matches the structured
type that an attribute represents,
the driver uses the standard mapping. This method never
uses the type map associated with the connection.
Conceptually, this method calls the method
getObject
on each attribute
of the structured type and returns a Java array containing
the result.
Parameters
map |
a mapping of SQL type names to Java classes |
Returns
- an array containing the ordered attribute values
public
abstract
String
getSQLTypeName
()
Retrieves the SQL type name of the SQL structured type
that this Struct
object represents.
Returns
- the fully-qualified type name of the SQL structured
type for which this
Struct
object
is the generic representation
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eStruct\u003c/code\u003e is a Java mapping for an SQL structured type, holding a value for each attribute of the SQL type.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to retrieve the SQL type name (\u003ccode\u003egetSQLTypeName\u003c/code\u003e) and the ordered attribute values (\u003ccode\u003egetAttributes\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetAttributes\u003c/code\u003e can customize type mappings using a provided map or the connection's type map.\u003c/p\u003e\n"],["\u003cp\u003eJDBC drivers must fully implement \u003ccode\u003eStruct\u003c/code\u003e interface methods if they support the corresponding data type.\u003c/p\u003e\n"]]],[],null,["# Struct\n\npublic interface **Struct** \n\u003cbr /\u003e\n\nThe standard mapping in the Java programming language for an SQL\nstructured type. A `Struct` object contains a\nvalue for each attribute of the SQL structured type that\nit represents.\nBy default, an instance of`Struct` is valid as long as the\napplication has a reference to it.\n\n\nAll methods on the `Struct` interface must be fully implemented if the\nJDBC driver supports the data type. \n\n### Public Method Summary\n\n|-----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Object\\[\\]](../../../reference/java/lang/Object.html) | [getAttributes](../../../reference/java/sql/Struct.html#getAttributes())() Produces the ordered values of the attributes of the SQL structured type that this `Struct` object represents. |\n| abstract [Object\\[\\]](../../../reference/java/lang/Object.html) | [getAttributes](../../../reference/java/sql/Struct.html#getAttributes(java.util.Map\u003cjava.lang.String,%20java.lang.Class\u003c?\u003e\u003e))([Map](../../../reference/java/util/Map.html)\\\u003c[String](../../../reference/java/lang/String.html), [Class](../../../reference/java/lang/Class.html)\\\u003c?\\\u003e\\\u003e map) Produces the ordered values of the attributes of the SQL structured type that this `Struct` object represents. |\n| abstract [String](../../../reference/java/lang/String.html) | [getSQLTypeName](../../../reference/java/sql/Struct.html#getSQLTypeName())() Retrieves the SQL type name of the SQL structured type that this `Struct` object represents. |\n\nPublic Methods\n--------------\n\n#### public abstract [Object\\[\\]](../../../reference/java/lang/Object.html)\n**getAttributes**\n()\n\nProduces the ordered values of the attributes of the SQL\nstructured type that this `Struct` object represents.\nAs individual attributes are processed, this method uses the type map\nassociated with the\nconnection for customizations of the type mappings.\nIf there is no\nentry in the connection's type map that matches the structured\ntype that an attribute represents,\nthe driver uses the standard mapping.\n\n\nConceptually, this method calls the method\n`getObject` on each attribute\nof the structured type and returns a Java array containing\nthe result. \n\n##### Returns\n\n- an array containing the ordered attribute values \n\n##### Throws\n\n| [SQLException](../../../reference/java/sql/SQLException.html) | if a database access error occurs |\n| [SQLFeatureNotSupportedException](../../../reference/java/sql/SQLFeatureNotSupportedException.html) | if the JDBC driver does not support this method |\n|-----------------------------------------------------------------------------------------------------|-------------------------------------------------|\n\n#### public abstract [Object\\[\\]](../../../reference/java/lang/Object.html)\n**getAttributes**\n([Map](../../../reference/java/util/Map.html)\\\u003c[String](../../../reference/java/lang/String.html), [Class](../../../reference/java/lang/Class.html)\\\u003c?\\\u003e\\\u003e map)\n\nProduces the ordered values of the attributes of the SQL\nstructured type that this `Struct` object represents.\nAs individual attrbutes are proccessed, this method uses the given type map\nfor customizations of the type mappings.\nIf there is no\nentry in the given type map that matches the structured\ntype that an attribute represents,\nthe driver uses the standard mapping. This method never\nuses the type map associated with the connection.\n\n\nConceptually, this method calls the method\n`getObject` on each attribute\nof the structured type and returns a Java array containing\nthe result. \n\n##### Parameters\n\n| map | a mapping of SQL type names to Java classes |\n|-----|---------------------------------------------|\n\n##### Returns\n\n- an array containing the ordered attribute values \n\n##### Throws\n\n| [SQLException](../../../reference/java/sql/SQLException.html) | if a database access error occurs |\n| [SQLFeatureNotSupportedException](../../../reference/java/sql/SQLFeatureNotSupportedException.html) | if the JDBC driver does not support this method |\n|-----------------------------------------------------------------------------------------------------|-------------------------------------------------|\n\n#### public abstract [String](../../../reference/java/lang/String.html)\n**getSQLTypeName**\n()\n\nRetrieves the SQL type name of the SQL structured type\nthat this `Struct` object represents. \n\n##### Returns\n\n- the fully-qualified type name of the SQL structured type for which this `Struct` object is the generic representation \n\n##### Throws\n\n| [SQLException](../../../reference/java/sql/SQLException.html) | if a database access error occurs |\n| [SQLFeatureNotSupportedException](../../../reference/java/sql/SQLFeatureNotSupportedException.html) | if the JDBC driver does not support this method |\n|-----------------------------------------------------------------------------------------------------|-------------------------------------------------|"]]