OCILIB (C and C++ Driver for Oracle)  4.7.6
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
BindInfo.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-2023 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 BindInfo::BindInfo(OCI_Bind *pBind, core::Handle *parent)
29 {
30  AcquireTransient(pBind, parent);
31 }
32 
33 inline ostring BindInfo::GetName() const
34 {
36 }
37 
39 {
40  return DataType(static_cast<DataType::Type>(core::Check(OCI_BindGetType(*this))));
41 }
42 
43 inline unsigned int BindInfo::GetSubType() const
44 {
45  return core::Check(OCI_BindGetSubtype(*this));
46 }
47 
48 inline unsigned int BindInfo::GetDataCount() const
49 {
50  return core::Check(OCI_BindGetDataCount(*this));
51 }
52 
54 {
56 }
57 
58 inline void BindInfo::SetDataNull(bool value, unsigned int index)
59 {
60  if (value)
61  {
62  core::Check(OCI_BindSetNullAtPos(*this, index));
63  }
64  else
65  {
66  core::Check(OCI_BindSetNotNullAtPos(*this, index));
67  }
68 }
69 
70 inline bool BindInfo::IsDataNull(unsigned int index) const
71 {
72  return (core::Check(OCI_BindIsNullAtPos(*this, index)) == TRUE);
73 }
74 
76 {
77  core::Check(OCI_BindSetCharsetForm(*this, value));
78 }
79 
81 {
82  return BindDirection(static_cast<BindDirection::Type>(core::Check(OCI_BindGetDirection(*this))));
83 }
84 
85 }
DataType GetType() const
Return the OCILIB type of the data associated with the bind object.
Definition: BindInfo.hpp:38
void SetCharsetForm(CharsetForm value)
Set the charset form of the given character based bind object.
Definition: BindInfo.hpp:75
unsigned int GetDataCount() const
Return the number of elements associated with the bind object.
Definition: BindInfo.hpp:48
BindDirection GetDirection() const
Get the direction mode.
Definition: BindInfo.hpp:80
unsigned int GetSubType() const
Return the OCILIB object subtype of a column.
Definition: BindInfo.hpp:43
core::Enum< BindDirectionValues > BindDirection
Bind direction.
Definition: types.hpp:5409
bool IsDataNull(unsigned int index=1) const
Check if the current bind value(s) used in SQL statements is marked as NULL.
Definition: BindInfo.hpp:70
Statement GetStatement() const
Return the statement associated with the bind object.
Definition: BindInfo.hpp:53
ostring GetName() const
Return the name of the bind object.
Definition: BindInfo.hpp:33
void SetDataNull(bool value, unsigned int index=1)
Mark as null or not null the current bind real value(s) used in SQL statements.
Definition: BindInfo.hpp:58
Object used for executing SQL or PL/SQL statement and returning the produced results.
Definition: types.hpp:5559
Template Enumeration template class providing some type safety to some extends for manipulating enume...
Definition: core.hpp:118
OCI_SYM_PUBLIC unsigned int OCI_API OCI_BindGetSubtype(OCI_Bind *bnd)
Return the OCILIB object subtype of the given bind.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindIsNullAtPos(OCI_Bind *bnd, unsigned int position)
Check if the current entry value at the given index of the binded array is marked as NULL.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_BindGetDataCount(OCI_Bind *bnd)
Return the number of elements of the bind handle.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_BindGetDirection(OCI_Bind *bnd)
Get the direction mode of a bind handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindSetNullAtPos(OCI_Bind *bnd, unsigned int position)
Set to null the entry in the bind variable input array.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindSetCharsetForm(OCI_Bind *bnd, unsigned int csfrm)
Set the charset form of the given character based bind variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindSetNotNullAtPos(OCI_Bind *bnd, unsigned int position)
Set to NOT null the entry in the bind variable input array.
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_BindGetStatement(OCI_Bind *bnd)
Return the statement handle associated with a bind handle.
OCI_SYM_PUBLIC const otext *OCI_API OCI_BindGetName(OCI_Bind *bnd)
Return the name of the given bind.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_BindGetType(OCI_Bind *bnd)
Return the OCILIB type of the given bind.
struct OCI_Bind OCI_Bind
Internal bind representation.
Definition: types.h:148
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so,...
Definition: Utils.hpp:53
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
OCILIB ++ Namespace.
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
core::Enum< DataTypeValues > DataType
Column data type.
Definition: types.hpp:124