OCILIB (C and C++ Driver for Oracle)  4.7.3
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
TypeInfo.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 TypeInfo::TypeInfo(const Connection &connection, const ostring& name, TypeInfoType type)
29 {
30  Acquire(core::Check(OCI_TypeInfoGet(connection, name.c_str(), type)), static_cast<HandleFreeFunc>(nullptr), nullptr, connection.GetHandle());
31 }
32 
33 inline TypeInfo::TypeInfo(OCI_TypeInfo *pTypeInfo)
34 {
35  Acquire(pTypeInfo, nullptr, nullptr, nullptr);
36 }
37 
39 {
40  return TypeInfoType(static_cast<TypeInfoType::Type>(core::Check(OCI_TypeInfoGetType(*this))));
41 }
42 
43 inline ostring TypeInfo::GetName() const
44 {
45  return core::Check(OCI_TypeInfoGetName(*this));
46 }
47 
49 {
50  return Connection(core::Check(OCI_TypeInfoGetConnection(*this)), nullptr);
51 }
52 
53 inline unsigned int TypeInfo::GetColumnCount() const
54 {
56 }
57 
58 inline Column TypeInfo::GetColumn(unsigned int index) const
59 {
60  return Column(core::Check(OCI_TypeInfoGetColumn(*this, index)), GetHandle());
61 }
62 
63 inline boolean TypeInfo::IsFinalType() const
64 {
65  return (core::Check(OCI_TypeInfoIsFinalType(*this)) == TRUE);
66 }
67 
69 {
71 }
72 
73 }
Encapsulate a Resultset column or object member properties.
Definition: types.hpp:6844
OCILIB ++ Namespace.
A connection or session with a specific database.
Definition: types.hpp:1563
OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_TypeInfoGet(OCI_Connection *con, const otext *name, unsigned int type)
Retrieve the available type info information.
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
Column GetColumn(unsigned int index) const
Return the column from its index in the resultset.
Definition: TypeInfo.hpp:58
OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_TypeInfoGetSuperType(OCI_TypeInfo *typinf)
Return the super type of the given type (e.g. parent type for a derived ORACLE UDT type) ...
OCI_SYM_PUBLIC const otext *OCI_API OCI_TypeInfoGetName(OCI_TypeInfo *typinf)
Return the name described by the type info object.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetColumnCount(OCI_TypeInfo *typinf)
Return the number of columns of a table/view/object.
Template Enumeration template class providing some type safety to some extends for manipulating enume...
Definition: core.hpp:117
core::Enum< TypeInfoTypeValues > TypeInfoType
Type of object information.
Definition: types.hpp:4539
Connection GetConnection() const
Return the connection associated with a statement.
Definition: TypeInfo.hpp:48
ostring GetName() const
Return the type info name.
Definition: TypeInfo.hpp:43
Provides type information on Oracle Database objects.
Definition: types.hpp:4508
struct OCI_TypeInfo OCI_TypeInfo
Type info metadata handle.
Definition: types.h:354
TypeInfoType GetType() const
Return the type of the given TypeInfo object.
Definition: TypeInfo.hpp:38
unsigned int GetColumnCount() const
Return the number of columns contained in the type.
Definition: TypeInfo.hpp:53
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetType(OCI_TypeInfo *typinf)
Return the type of the type info object.
OCI_SYM_PUBLIC boolean OCI_API OCI_TypeInfoIsFinalType(OCI_TypeInfo *typinf)
Indicate if the given UDT type if final.
TypeInfo GetSuperType() const
Return the super type of the given type (e.g. parent type for a derived ORACLE UDT type) ...
Definition: TypeInfo.hpp:68
TypeInfo(const Connection &connection, const ostring &name, TypeInfoType type)
Parametrized constructor.
Definition: TypeInfo.hpp:28
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_TypeInfoGetColumn(OCI_TypeInfo *typinf, unsigned int index)
Return the column object handle at the given index in the table.
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 OCI_Connection *OCI_API OCI_TypeInfoGetConnection(OCI_TypeInfo *typinf)
Retrieve connection handle from the type info handle.
boolean IsFinalType() const
Indicate if the given UDT type is final.
Definition: TypeInfo.hpp:63