OCILIB (C and C++ Driver for Oracle)  4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
ocilib::Column Class Reference

Encapsulate a Resultset column or object member properties. More...

#include <types.hpp>

Inherits ocilib::core::HandleHolder< OCI_Column * >.

Public Types

enum  PropertyFlagsValues {
  NoFlags = OCI_CPF_NONE , IsIdentity = OCI_CPF_IS_IDENTITY , IsGeneratedAlways = OCI_CPF_IS_GEN_ALWAYS , IsGeneratedByDefaultOnNull = OCI_CPF_IS_GEN_BY_DEFAULT_ON_NULL ,
  IsLogicalPartitioning = OCI_CPF_IS_LPART , IsGeneratedByContainers = OCI_CPF_IS_CONID
}
 Column properties flags values. More...
 
typedef core::Flags< PropertyFlagsValuesPropertyFlags
 Column properties flags.
 

Public Member Functions

ostring GetName () const
 Return the Column name.
 
ostring GetSQLType () const
 Return the Oracle SQL type name of the column data type.
 
ostring GetFullSQLType () const
 Return the Oracle SQL Full name including precision and size of the column data type.
 
DataType GetType () const
 Return the type of the given column.
 
unsigned int GetSubType () const
 Return the OCILIB object subtype of a column.
 
CharsetForm GetCharsetForm () const
 Return the charset form of the given column.
 
CollationID GetCollationID () const
 Return the collation ID of the given column.
 
unsigned int GetSize () const
 Return the size of the column.
 
int GetScale () const
 Return the scale of the column for numeric columns.
 
int GetPrecision () const
 Return the precision of the column for numeric columns.
 
int GetFractionalPrecision () const
 Return the fractional precision of the column for Timestamp and Interval columns.
 
int GetLeadingPrecision () const
 Return the leading precision of the column for Interval columns.
 
PropertyFlags GetPropertyFlags () const
 Return the column property flags.
 
bool IsNullable () const
 Return true if the column is nullable otherwise false.
 
bool IsCharSemanticUsed () const
 Return true if the length of the column is character-length or false if it is byte-length.
 
TypeInfo GetTypeInfo () const
 Return the type information object associated to the column.
 

Detailed Description

Encapsulate a Resultset column or object member properties.

This class wraps the OCILIB object handle OCI_Column and its related methods

Definition at line 6863 of file types.hpp.

Member Typedef Documentation

◆ PropertyFlags

Column properties flags.

Possible values are Column::PropertyFlagsValues

Definition at line 6902 of file types.hpp.

Member Enumeration Documentation

◆ PropertyFlagsValues

Column properties flags values.

Enumerator
NoFlags 

The column has no flags or the OCI client does not support it

IsIdentity 
  • If Set, the column is an IDENTITY column
    • Otherwise, it is not an IDENTITY column
IsGeneratedAlways 

Only valid when IsIdentity is set:

  • If set, means that the value is "ALWAYS GENERATED"
  • Otherwise means that the value is "GENERATED BY"
IsGeneratedByDefaultOnNull 

Only valid when IsIdentity is set:

  • If set, means that the value is generated by default on NULL
IsLogicalPartitioning 

If set, Column is an implicitly generated logical partitioning column for container_map enabled object

IsGeneratedByContainers 

If set, Column is a CON_ID column implicitly generated by CONTAINERS() or is an ORIGIN_CON_ID column implicitly generated for Extended Data Link

Definition at line 6875 of file types.hpp.

Member Function Documentation

◆ GetName()

ostring ocilib::Column::GetName ( ) const
inline

Return the Column name.

Definition at line 33 of file Column.hpp.

References ocilib::core::Check(), ocilib::core::MakeString(), and OCI_ColumnGetName().

◆ GetSQLType()

ostring ocilib::Column::GetSQLType ( ) const
inline

Return the Oracle SQL type name of the column data type.

Note
For possible values, consults Oracle Documentation

Definition at line 38 of file Column.hpp.

References ocilib::core::Check(), ocilib::core::MakeString(), and OCI_ColumnGetSQLType().

◆ GetFullSQLType()

ostring ocilib::Column::GetFullSQLType ( ) const
inline

Return the Oracle SQL Full name including precision and size of the column data type.

Note
This function returns a description that matches the one given by SQL*Plus

Definition at line 43 of file Column.hpp.

References ocilib::core::Check(), ocilib::core::MakeString(), and OCI_ColumnGetFullSQLType().

◆ GetType()

DataType ocilib::Column::GetType ( ) const
inline

Return the type of the given column.

Definition at line 54 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetType().

◆ GetSubType()

unsigned int ocilib::Column::GetSubType ( ) const
inline

Return the OCILIB object subtype of a column.

Note
This call is valid for the following OCILIB types:
Warning
  • Cast returned values to the matching C++ class GetType() property type.
  • For a non valid type, it returns 0.

Definition at line 59 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetSubType().

◆ GetCharsetForm()

CharsetForm ocilib::Column::GetCharsetForm ( ) const
inline

Return the charset form of the given column.

Definition at line 64 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetCharsetForm().

◆ GetCollationID()

CollationID ocilib::Column::GetCollationID ( ) const
inline

Return the collation ID of the given column.

Definition at line 69 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetCollationID().

◆ GetSize()

unsigned int ocilib::Column::GetSize ( ) const
inline

Return the size of the column.

Note
For all types, the size is expressed is bytes, excepted for character based columns that were created with a character based size or of type NCHAR/NVARCHAR

Definition at line 74 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetSize().

◆ GetScale()

int ocilib::Column::GetScale ( ) const
inline

Return the scale of the column for numeric columns.

Definition at line 79 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetScale().

◆ GetPrecision()

int ocilib::Column::GetPrecision ( ) const
inline

Return the precision of the column for numeric columns.

Definition at line 84 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetPrecision().

◆ GetFractionalPrecision()

int ocilib::Column::GetFractionalPrecision ( ) const
inline

Return the fractional precision of the column for Timestamp and Interval columns.

Definition at line 89 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetFractionalPrecision().

◆ GetLeadingPrecision()

int ocilib::Column::GetLeadingPrecision ( ) const
inline

Return the leading precision of the column for Interval columns.

Definition at line 94 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetLeadingPrecision().

◆ GetPropertyFlags()

Column::PropertyFlags ocilib::Column::GetPropertyFlags ( ) const
inline

Return the column property flags.

Note
This was introduced in Oracle 12cR1. It is currently used for identifying Identity columns. For earlier versions, it always return Columns::NoFlags

Definition at line 99 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetPropertyFlags().

◆ IsNullable()

bool ocilib::Column::IsNullable ( ) const
inline

Return true if the column is nullable otherwise false.

Definition at line 104 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetNullable().

◆ IsCharSemanticUsed()

bool ocilib::Column::IsCharSemanticUsed ( ) const
inline

Return true if the length of the column is character-length or false if it is byte-length.

Note
This was introduced in Oracle 9i. So for version that are not supporting this property, it always return false

Definition at line 109 of file Column.hpp.

References ocilib::core::Check(), and OCI_ColumnGetCharUsed().

◆ GetTypeInfo()

TypeInfo ocilib::Column::GetTypeInfo ( ) const
inline

Return the type information object associated to the column.

Note
This call is used only for Named Object typed and collection columns. It returns a null object if the column is not a Named Object or a collection.

Definition at line 114 of file Column.hpp.

References ocilib::core::Check(), OCI_ColumnGetTypeInfo(), and OCI_TypeInfoGetConnection().