OracleUdt Class

The OracleUdt class defines static methods that are used when converting between Custom Types and Oracle UDTs and vice-versa.

Class Inheritance

System.Object

  System.OracleUdt

Declaration

public sealed class OracleUdt

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4


OracleUdt Members

OracleUdt static methods are listed in Table 16-28.

Table 16-28 OracleUdt Static Methods

Static Method Description

Equals

Inherited from System.Object

GetValue

Gets the attributes or elements from the specified Oracle UDT (Overloaded)

IsDBNull

Indicates whether or not the specified attribute being retrieved is NULL (Overloaded)

SetValue

Sets the attributes or elements on the specified Oracle UDT (Overloaded)



OracleUDT Static Methods

OracleUDT methods are listed in Table 16-29.

Table 16-29 OracleUdt Static Methods

Static Method Description

Equals

Inherited from System.Object

GetValue

Gets the attributes or elements from the specified Oracle UDT (Overloaded)

IsDBNull

Indicates whether or not the specified attribute being retrieved is NULL (Overloaded)

SetValue

Sets the attributes or elements on the specified Oracle UDT (Overloaded)


GetValue

GetValue methods get the attributes or elements from the specified Oracle UDT.

Overload List:

GetValue(OracleConnection, IntPtr, string)

This method gets the attributes or elements from the specified Oracle UDT, using the specified attribute name.

Declaration

public static object GetValue(OracleConnection con, IntPtr pUdt, string attrName);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    A pointer to an Oracle UDT.

  • attrName

    The case-sensitive name of the attribute to be retrieved. Null is specified for retrieving collection elements from a Custom Type that represents an Oracle Collection.

Return Value

An object representing the returned attribute or collection elements.

Exceptions

ArgumentException - The specified name is not a valid attribute name.

Remarks

The IOracleCustomType.ToCustomObject method invokes OracleUdt.GetValue method passing it the con and pUdt parameters. The OracleUdt.GetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type returned for a specified attribute name is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type returned is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.

In the case of NULL attribute values, the appropriate null representation of the type is returned. For example, for attributes that are represented as Custom Types and Provider Specific Types, the static Null property of the type is returned. For attributes that are represented as Nullable types, for example, System.String and System.Array Types, null is returned, and for all other remaining built-in types such as Int32 and DateTime DBNull.Value is returned.

GetValue(OracleConnection, IntPtr, int)

This method gets the attribute or elements from the specified Oracle UDT, using the specified index.

Declaration

// C#
public static object GetValue(OracleConnection con, IntPtr pUdt, int attrIndex,);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    A pointer to an Oracle UDT.

  • attrIndex

    The zero-based index of the attribute to be retrieved. For retrieving collection elements from a Custom Type that represents an Oracle Collection, zero must be specified.

Return Value

An object representing the returned attribute or collection elements.

Exceptions

ArgumentOutOfRangeException - The specified index is not a valid attribute index.

Remarks

The IOracleCustomType.ToCustomObject method invokes OracleUdt.GetValue method passing it the con and pUdt parameters. The OracleUdt.GetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type returned for a specified attribute index is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type returned is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.

In the case of NULL attribute values, the appropriate null representation of the type is returned. For example, for attributes that are represented as Custom Types and Provider Specific Types, the static Null property of the type is returned. For attributes that are represented as Nullable types, for example, System.String and System.Array Types, null is returned, and for all other remaining built-in types such as Int32 and DateTime DBNull.Value is returned.

GetValue(OracleConnection, IntPtr, string, out object)

This method returns either the elements of the specified collection attribute of the specified Oracle Object or the elements of the specified Oracle Collection.

Declaration

// C#
public static object GetValue(OracleConnection con, IntPtr pUdt, string attrName,
  out object statusArray);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    An opaque pointer to an Oracle UDT.

  • attrName

    The case-sensitive name of the attribute to be retrieved. Null must specified for retrieving collection elements from a Custom Type that represents an Oracle Collection.

  • statusArray - The OracleUdtStatus array which returns the null status for the retrieved collection elements.

Return Value

An object representing the returned attribute or collection elements.

Exceptions

ArgumentException - The specified name is not a valid attribute name.

Remarks

The IOracleCustomType.ToCustomObject method invokes OracleUdt.GetValue method passing it the con and pUdt parameters. The OracleUdt.GetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type returned for a specified attribute name is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type returned is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.

In the case of NULL attribute values, the appropriate null representation of the type is returned. For example, for attributes that are represented as Custom Types and Provider Specific Types, the static Null property of the type is returned. For attributes that are represented as Nullable types, for example, System.String and System.Array Types, null is returned, and for all other remaining built-in types such as Int32 and DateTime DBNull.Value is returned.

If the collection being returned is not NULL, the output statusArray parameter is populated with the null status for each of the collection elements.

GetValue(OracleConnection, IntPtr, int, out object)

This method returns either the elements of the specified collection attribute of the specified Oracle Object or the elements of the specified Oracle Collection.

Declaration

// C#
public static object GetValue(OracleConnection con, IntPtr pUdt, int attrIndex, 
   out object statusArray);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    An opaque pointer to an Oracle UDT.

  • attrIndex

    The zero-based index of the attribute to be retrieved. For retrieving collection elements from a Custom Type that represents an Oracle Collection, 0 is specified.

  • statusArray

    The OracleUdtStatus array which returns the null status for the retrieved collection elements.

Return Value

An object representing the returned attribute or collection elements.

Exceptions

ArgumentOutOfRangeException - The specified index is not a valid attribute index.

Remarks

The IOracleCustomType.ToCustomObject method invokes OracleUdt.GetValue method passing it the con and pUdt parameters. The OracleUdt.GetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type returned for a specified attribute index is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type returned is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.

In the case of NULL attribute values, the appropriate null representation of the type is returned. For example, for attributes that are represented as Custom Types and Provider Specific Types, the static Null property of the type is returned. For attributes that are represented as Nullable types, for example, System.String and System.Array Types, null is returned, and for all other remaining built-in types such as Int32 and DateTime DBNull.Value is returned.

If the collection being returned is not NULL, the output statusArray parameter is populated with the null status for each of the collection elements.

IsDBNull

IsDBNull methods indicate whether or not the specified attribute being retrieved is NULL.

Overload List:

IsDBNull(OracleConnection, IntPtr, string)

This method indicates whether or not the attribute being retrieved, specified by OracleConnection, pointer, and attribute name, is NULL.

Declaration

// C#
public static bool IsDBNull(OracleConnection con, IntPtr pUdt, string attrName);
 

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    A pointer to an Oracle UDT.

  • attrName

    The case-sensitive name of the attribute.

Return Value

True if the specified attribute is NULL; otherwise, false.

Exceptions

ArgumentException - The specified name is not a valid attribute name.

Remarks

This method is invoked from the IOracleCustomType.ToCustomObject method. The con and pUdt parameter is passed from the IOracleCustomType.ToCustomObject method to the OracleUdt.IsDBNull method. The attrName parameter is case-sensitive.

IsDBNull(OracleConnection, IntPtr, int)

This method indicates whether or not the attribute being retrieved, specified by OracleConnection, pointer, and attribute index, is NULL.

Declaration

// C#
public static bool IsDBNull(OracleConnection con, IntPtr pUdt, int attrIndex);
 

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    An opaque pointer to an Oracle UDT.

  • attrIndex

    The zero-based index of the attribute.

Return Value

True if the specified attribute is NULL; otherwise, false.

Exceptions

ArgumentOutOfRangeException - The specified index is not a valid attribute index

Remarks

This method is invoked from the IOracleCustomType.ToCustomObject method. The con and pUdt parameter is passed from the IOracleCustomType.ToCustomObject method to the OracleUdt.IsDBNull method.

SetValue

SetValue methods set the attributes or elements on the specified Oracle UDT.

Overload List:

SetValue(OracleConnection, IntPtr, string, object)

This method sets the attribute or elements on the specified Oracle UDT, using the specified attribute name and value.

Declaration

// C#
public static void SetValue(OracleConnection con, IntPtr pUdt, string attrName, 
   object value);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    An opaque pointer to an Oracle UDT.

  • attrName

    The name of the attribute to be set. Specify null for setting collection elements from a Custom Type that represents an Oracle Collection.

  • value

    The attribute or collection value to be set.

Exceptions

ArgumentException - The specified value is not of the appropriate type.

Remarks

The IOracleCustomType.FromCustomObject method invokes OracleUdt.SetValue method passing it the con and pUdt parameters. The OracleUdt.SetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type accepted for a specified attribute name is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type accepted is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.

SetValue(OracleConnection, IntPtr, int, object)

This method sets the attribute or elements on the specified Oracle UDT, using the specified index and value.

Declaration

// C#
public static void SetValue(OracleConnection con, IntPtr pUdt, int attrIndex, object value);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    An opaque pointer to an Oracle UDT.

  • attrIndex

    The index of the attribute to be set. Specify 0 for setting collection elements from a Custom Type that represents an Oracle Collection.

  • value

    The attribute or collection value to be set.

Exceptions

ArgumentException - The specified value is not of the appropriate type.

Remarks

The IOracleCustomType.FromCustomObject method invokes OracleUdt.SetValue method passing it the con and pUdt parameters. The OracleUdt.SetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type accepted for a specified attribute index is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type accepted is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.

SetValue(OracleConnection, IntPtr, string, object, object)

This method sets either the specified collection attribute of the specified Oracle Object or elements of the specified Oracle Collection, to the specified value using the supplied null status of the collection elements.

Declaration

// C#
public static void SetValue(OracleConnection con, IntPtr pUdt, string attrName, 
   object value, object statusArray);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    An opaque pointer to an Oracle UDT.

  • attrName

    The name of the attribute to be set. Specify null for setting collection elements from a Custom Type that represents an Oracle Collection.

  • value

    The attribute or collection value to be set.

  • statusArray

    The null status for the collection elements.

Exceptions

ArgumentException - The specified value is not of the appropriate type.

Remarks

The IOracleCustomType.FromCustomObject method invokes OracleUdt.SetValue method passing it the con and pUdt parameters. The OracleUdt.SetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type accepted for a specified attribute name is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type accepted is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.

SetValue(OracleConnection, IntPtr, int, object, object)

This method sets either the specified collection attribute of the specified Oracle Object or elements of the specified Oracle Collection, to the specified value using the supplied null status of the collection elements.

Declaration

// C#
public static void SetValue(OracleConnection con, IntPtr pUdt, int attrIndex,
  object value, object statusArray);

Parameters

  • con

    An OracleConnection instance.

  • pUdt

    An opaque pointer to an Oracle UDT.

  • attrIndex

    The index of the attribute to be set. Specify 0 for setting collection elements from a Custom Type that represents an Oracle Collection.

  • value

    The attribute or collection value to be set.

  • statusArray

    The null status for the collection elements.

Exceptions

ArgumentException - The specified value is not of the appropriate type.

Remarks

The IOracleCustomType.FromCustomObject method invokes OracleUdt.SetValue method passing it the con and pUdt parameters. The OracleUdt.SetValue method returns these types of object:

  • Oracle Object Type

    For a Custom Type that represents an Oracle Object Type, the type accepted for a specified attribute index is the type of the member in the custom class or struct that is mapped to the attribute using the OracleObjectMappingAttribute object.

  • Oracle Collection Type

    For a Custom Type that represents an Oracle Collection Type, the type accepted is the type of the member in the custom class or struct to which the OracleArrayMappingAttribute object is applied.