Oracle® Data Provider for .NET Developer's Guide 11g Release 2 (11.2.0.2) Part Number E18754-01 |
|
|
PDF · Mobi · ePub |
The OracleUdt
class defines static methods that are used when converting between Custom Types and Oracle UDTs and vice-versa.
System.Object
System.OracleUdt
public sealed class OracleUdt
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
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
static methods are listed in Table 16-28.
Table 16-28 OracleUdt Static Methods
Static Method | Description |
---|---|
Equals |
Inherited from |
Gets the attributes or elements from the specified Oracle UDT (Overloaded) |
|
Indicates whether or not the specified attribute being retrieved is |
|
Sets the attributes or elements on the specified Oracle UDT (Overloaded) |
OracleUDT
methods are listed in Table 16-29.
Table 16-29 OracleUdt Static Methods
Static Method | Description |
---|---|
Equals |
Inherited from |
Gets the attributes or elements from the specified Oracle UDT (Overloaded) |
|
Indicates whether or not the specified attribute being retrieved is |
|
Sets the attributes or elements on the specified Oracle UDT (Overloaded) |
GetValue
methods get the attributes or elements from the specified Oracle UDT.
GetValue(OracleConnection, IntPtr, string)
This method gets the attributes or elements from the specified Oracle UDT, using the specified attribute name.
GetValue(OracleConnection, IntPtr, int)
This method gets the attribute or elements from the specified Oracle UDT, using the specified index.
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.
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.
This method gets the attributes or elements from the specified Oracle UDT, using the specified attribute name.
public static object GetValue(OracleConnection con, IntPtr pUdt, string attrName);
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.
An object representing the returned attribute or collection elements.
ArgumentException
- The specified name is not a valid attribute name.
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.
See Also:
This method gets the attribute or elements from the specified Oracle UDT, using the specified index.
// C# public static object GetValue(OracleConnection con, IntPtr pUdt, int attrIndex,);
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.
An object representing the returned attribute or collection elements.
ArgumentOutOfRangeException
- The specified index is not a valid attribute index.
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.
See Also:
This method returns either the elements of the specified collection attribute of the specified Oracle Object or the elements of the specified Oracle Collection.
// C# public static object GetValue(OracleConnection con, IntPtr pUdt, string attrName, out object statusArray);
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.
An object representing the returned attribute or collection elements.
ArgumentException
- The specified name is not a valid attribute name.
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.
See Also:
This method returns either the elements of the specified collection attribute of the specified Oracle Object or the elements of the specified Oracle Collection.
// C# public static object GetValue(OracleConnection con, IntPtr pUdt, int attrIndex, out object statusArray);
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.
An object representing the returned attribute or collection elements.
ArgumentOutOfRangeException
- The specified index is not a valid attribute index.
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.
See Also:
IsDBNull
methods indicate whether or not the specified attribute being retrieved is NULL
.
IsDBNull(OracleConnection, IntPtr, string)
This method indicates whether or not the attribute being retrieved, specified by OracleConnection
, pointer, and attribute name, is NULL
.
IsDBNull(OracleConnection, IntPtr, int)
This method indicates whether or not the attribute being retrieved, specified by OracleConnection
, pointer, and attribute index, is NULL
.
See Also:
This method indicates whether or not the attribute being retrieved, specified by OracleConnection
, pointer, and attribute name, is NULL
.
// C# public static bool IsDBNull(OracleConnection con, IntPtr pUdt, string attrName);
con
An OracleConnection
instance.
pUdt
A pointer to an Oracle UDT.
attrName
The case-sensitive name of the attribute.
True
if the specified attribute is NULL
; otherwise, false
.
ArgumentException
- The specified name is not a valid attribute name.
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.
This method indicates whether or not the attribute being retrieved, specified by OracleConnection
, pointer, and attribute index, is NULL
.
// C# public static bool IsDBNull(OracleConnection con, IntPtr pUdt, int attrIndex);
con
An OracleConnection
instance.
pUdt
An opaque pointer to an Oracle UDT.
attrIndex
The zero-based index of the attribute.
True
if the specified attribute is NULL
; otherwise, false
.
ArgumentOutOfRangeException
- The specified index is not a valid attribute index
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
methods set the attributes or elements on the specified Oracle UDT.
SetValue(OracleConnection, IntPtr, string, object)
This method sets the attribute or elements on the specified Oracle UDT, using the specified attribute name and value.
SetValue(OracleConnection, IntPtr, int, object)
This method sets the attribute or elements on the specified Oracle UDT, using the specified index and value.
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.
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.
This method sets the attribute or elements on the specified Oracle UDT, using the specified attribute name and value.
// C# public static void SetValue(OracleConnection con, IntPtr pUdt, string attrName, object value);
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.
ArgumentException
- The specified value is not of the appropriate type.
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.
This method sets the attribute or elements on the specified Oracle UDT, using the specified index and value.
// C# public static void SetValue(OracleConnection con, IntPtr pUdt, int attrIndex, object value);
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.
ArgumentException
- The specified value is not of the appropriate type.
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.
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.
// C# public static void SetValue(OracleConnection con, IntPtr pUdt, string attrName, object value, object statusArray);
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.
ArgumentException
- The specified value is not of the appropriate type.
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.
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.
// C# public static void SetValue(OracleConnection con, IntPtr pUdt, int attrIndex, object value, object statusArray);
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.
ArgumentException
- The specified value is not of the appropriate type.
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.