OCILIB (C and C++ Driver for Oracle)  4.7.3
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Column.hpp
1 /*
2  * OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI)
3  *
4  * Website: http://www.ocilib.net
5  *
6  * Copyright (c) 2007-2021 Vincent ROGIER <vince.rogier@ocilib.net>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #pragma once
22 
23 #include "ocilibcpp/types.hpp"
24 
25 namespace ocilib
26 {
27 
28 inline Column::Column(OCI_Column *pColumn, core::Handle *parent)
29 {
30  Acquire(pColumn, nullptr, nullptr, parent);
31 }
32 
33 inline ostring Column::GetName() const
34 {
36 }
37 
39 {
41 }
42 
44 {
45  const unsigned int size = OCI_SIZE_BUFFER;
46 
47  core::ManagedBuffer<otext> buffer(static_cast<size_t>(size + 1));
48 
49  core::Check(OCI_ColumnGetFullSQLType(*this, buffer, size));
50 
51  return core::MakeString(static_cast<const otext *>(buffer));
52 }
53 
54 inline DataType Column::GetType() const
55 {
56  return DataType(static_cast<DataType::Type>(core::Check(OCI_ColumnGetType(*this))));
57 }
58 
59 inline unsigned int Column::GetSubType() const
60 {
61  return core::Check(OCI_ColumnGetSubType(*this));
62 }
63 
65 {
66  return CharsetForm(static_cast<CharsetForm::Type>(core::Check(OCI_ColumnGetCharsetForm(*this))));
67 }
68 
70 {
71  return CollationID(static_cast<CollationID::Type>(core::Check(OCI_ColumnGetCollationID(*this))));
72 }
73 
74 inline unsigned int Column::GetSize() const
75 {
76  return core::Check(OCI_ColumnGetSize(*this));
77 }
78 
79 inline int Column::GetScale() const
80 {
81  return core::Check(OCI_ColumnGetScale(*this));
82 }
83 
84 inline int Column::GetPrecision() const
85 {
86  return core::Check(OCI_ColumnGetPrecision(*this));
87 }
88 
90 {
92 }
93 
94 inline int Column::GetLeadingPrecision() const
95 {
97 }
98 
100 {
101  return PropertyFlags(static_cast<PropertyFlags::Type>(core::Check(OCI_ColumnGetPropertyFlags(*this))));
102 }
103 
104 inline bool Column::IsNullable() const
105 {
106  return (core::Check(OCI_ColumnGetNullable(*this)) == TRUE);
107 }
108 
109 inline bool Column::IsCharSemanticUsed() const
110 {
111  return (core::Check(OCI_ColumnGetCharUsed(*this)) == TRUE);
112 }
113 
115 {
117 }
118 
119 }
core::Enum< CharsetFormValues > CharsetForm
Type of charsetForm.
Definition: types.hpp:175
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSize(OCI_Column *col)
Return the size of the column.
core::Flags< PropertyFlagsValues > PropertyFlags
Column properties flags.
Definition: types.hpp:6883
core::Enum< CollationIDValues > CollationID
Type of Collation ID.
Definition: types.hpp:219
bool IsCharSemanticUsed() const
Return true if the length of the column is character-length or false if it is byte-length.
Definition: Column.hpp:109
OCILIB ++ Namespace.
core::Enum< DataTypeValues > DataType
Column data type.
Definition: types.hpp:117
unsigned int GetSubType() const
Return the OCILIB object subtype of a column.
Definition: Column.hpp:59
ostring GetFullSQLType() const
Return the Oracle SQL Full name including precision and size of the column data type.
Definition: Column.hpp:43
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetType(OCI_Column *col)
Return the type of the given column.
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so, it raises a C++ exception using the retrieved error handle.
Definition: Utils.hpp:53
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetScale(OCI_Column *col)
Return the scale of the column for numeric columns.
bool IsNullable() const
Return true if the column is nullable otherwise false.
Definition: Column.hpp:104
TypeInfo GetTypeInfo() const
Return the type information object associated to the column.
Definition: Column.hpp:114
Template Flags template class providing some type safety to some extends for manipulating flags set v...
Definition: core.hpp:147
OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetNullable(OCI_Column *col)
Return the nullable attribute of the column.
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
Definition: Utils.hpp:65
CharsetForm GetCharsetForm() const
Return the charset form of the given column.
Definition: Column.hpp:64
PropertyFlags GetPropertyFlags() const
Return the column property flags.
Definition: Column.hpp:99
int GetLeadingPrecision() const
Return the leading precision of the column for Interval columns.
Definition: Column.hpp:94
int GetPrecision() const
Return the precision of the column for numeric columns.
Definition: Column.hpp:84
Template Enumeration template class providing some type safety to some extends for manipulating enume...
Definition: core.hpp:117
int GetScale() const
Return the scale of the column for numeric columns.
Definition: Column.hpp:79
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSubType(OCI_Column *col)
Return the OCILIB object subtype of a column.
Internal usage. Provide a buffer class with RAII capabilities.
Definition: core.hpp:196
ostring GetName() const
Return the Column name.
Definition: Column.hpp:33
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCollationID(OCI_Column *col)
Return the column collation ID.
OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetCharUsed(OCI_Column *col)
Return TRUE if the length of the column is character-length or FALSE if it is byte-length.
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetSQLType(OCI_Column *col)
Return the Oracle SQL type name of the column data type.
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetFractionalPrecision(OCI_Column *col)
Return the fractional precision of the column for timestamp and interval columns. ...
OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_ColumnGetTypeInfo(OCI_Column *col)
Return the type information object associated to the column.
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetLeadingPrecision(OCI_Column *col)
Return the leading precision of the column for interval columns.
CollationID GetCollationID() const
Return the collation ID of the given column.
Definition: Column.hpp:69
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetFullSQLType(OCI_Column *col, otext *buffer, unsigned int len)
Return the Oracle SQL Full name including precision and size of the column data type.
Provides type information on Oracle Database objects.
Definition: types.hpp:4508
ostring GetSQLType() const
Return the Oracle SQL type name of the column data type.
Definition: Column.hpp:38
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCharsetForm(OCI_Column *col)
Return the charset form of the given column.
int GetFractionalPrecision() const
Return the fractional precision of the column for Timestamp and Interval columns. ...
Definition: Column.hpp:89
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetPropertyFlags(OCI_Column *col)
Return the column property flags.
unsigned int GetSize() const
Return the size of the column.
Definition: Column.hpp:74
std::basic_string< otext, std::char_traits< otext >, std::allocator< otext > > ostring
string class wrapping the OCILIB otext * type and OTEXT() macros ( see Character sets ) ...
Definition: config.hpp:120
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetPrecision(OCI_Column *col)
Return the precision of the column for numeric columns.
struct OCI_Column OCI_Column
Oracle SQL Column and Type member representation.
Definition: types.h:163
DataType GetType() const
Return the type of the given column.
Definition: Column.hpp:54
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetName(OCI_Column *col)
Return the name of the given column.