OCILIB (C and C++ Driver for Oracle)  4.6.0
ocilib_impl.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-2018 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 /*
22  * IMPORTANT NOTICE
23  *
24  * This C++ header defines C++ wrapper classes around the OCILIB C API
25  * It requires a compatible version of OCILIB
26  *
27  */
28 
29 #pragma once
30 
31 #include <algorithm>
32 
33 namespace ocilib
34 {
35 
36 /* ********************************************************************************************* *
37  * IMPLEMENTATION
38  * ********************************************************************************************* */
39 
50 
61 
67 template<class I, class O>
69 {
70  typedef I InputType;
71  typedef O OutputType;
72 };
73 
79 template<class T>
81 
82 template<> struct BindResolver<bool> : BindResolverType<bool, boolean>{};
83 template<> struct BindResolver<short> : BindResolverScalarType<short>{};
84 template<> struct BindResolver<unsigned short> : BindResolverScalarType<unsigned short>{};
85 template<> struct BindResolver<int> : BindResolverScalarType<int>{};
86 template<> struct BindResolver<unsigned int> : BindResolverScalarType<unsigned int>{};
87 template<> struct BindResolver<big_int> : BindResolverScalarType<big_int>{};
88 template<> struct BindResolver<big_uint> : BindResolverScalarType<big_uint>{};
89 template<> struct BindResolver<float> : BindResolverScalarType<float>{};
90 template<> struct BindResolver<double> : BindResolverScalarType<double>{};
91 template<> struct BindResolver<ostring> : BindResolverType<ostring, otext>{};
92 template<> struct BindResolver<Raw> : BindResolverType<ostring, unsigned char>{};
93 template<> struct BindResolver<Number> : BindResolverType<Number, OCI_Number*>{};
94 template<> struct BindResolver<Date> : BindResolverType<Date, OCI_Date*>{};
95 template<> struct BindResolver<Timestamp> : BindResolverType<Timestamp, OCI_Timestamp*>{};
96 template<> struct BindResolver<Interval> : BindResolverType<Interval, OCI_Interval*>{};
97 template<> struct BindResolver<Clob> : BindResolverType<Clob, OCI_Lob*>{};
98 template<> struct BindResolver<NClob> : BindResolverType<NClob, OCI_Lob*>{};
99 template<> struct BindResolver<Blob> : BindResolverType<Blob, OCI_Lob*>{};
100 template<> struct BindResolver<File> : BindResolverType<File, OCI_File*>{};
101 template<> struct BindResolver<Clong> : BindResolverType<Clong, OCI_Long*>{};
102 template<> struct BindResolver<Blong> : BindResolverType<Blong, OCI_Long*>{};
103 template<> struct BindResolver<Reference> : BindResolverType<Reference, OCI_Ref*>{};
104 template<> struct BindResolver<Object> : BindResolverType<Object, OCI_Object*>{};
105 template<> struct BindResolver<Statement> : BindResolverType<Statement, OCI_Statement*>{};
106 
110 template<class T> struct NumericTypeResolver{};
111 
112 template<> struct NumericTypeResolver<OCI_Number*> { enum { Value = NumericNumber }; };
113 template<> struct NumericTypeResolver<Number> { enum { Value = NumericNumber }; };
114 template<> struct NumericTypeResolver<short> { enum { Value = NumericShort }; };
115 template<> struct NumericTypeResolver<unsigned short> { enum { Value = NumericUnsignedShort }; };
116 template<> struct NumericTypeResolver<int> { enum { Value = NumericInt }; };
117 template<> struct NumericTypeResolver<unsigned int> { enum { Value = NumericUnsignedInt }; };
118 template<> struct NumericTypeResolver<big_int> { enum { Value = NumericBigInt }; };
119 template<> struct NumericTypeResolver<big_uint> { enum { Value = NumericUnsignedBigInt }; };
120 template<> struct NumericTypeResolver<double> { enum { Value = NumericDouble }; };
121 template<> struct NumericTypeResolver<float> { enum { Value = NumericFloat }; };
122 
123 template<class T>
124 T Check(T result)
125 {
126  OCI_Error *err = OCI_GetLastError();
127 
128  if (err)
129  {
130  throw Exception(err);
131  }
132 
133  return result;
134 }
135 
136 inline ostring MakeString(const otext *result, int size)
137 {
138  return result ? (size >= 0 ? ostring(result, result + size) : ostring(result)) : ostring();
139 }
140 
141 inline Raw MakeRaw(void *result, unsigned int size)
142 {
143  unsigned char *ptr = static_cast<unsigned char *>(result);
144 
145  return (ptr && size > 0 ? Raw(ptr, ptr + size) : Raw());
146 }
147 
148 template<class S, class C>
149 void ConverString(S &dest, const C *src, size_t length)
150 {
151  size_t i = 0;
152 
153  dest.clear();
154 
155  if (src)
156  {
157  dest.resize(length);
158 
159  while (i < length)
160  {
161  dest[i] = static_cast<typename S::value_type>(src[i]);
162 
163  ++i;
164  }
165  }
166 }
167 
168 inline unsigned int ComputeCharMaxSize(Environment::CharsetMode charsetMode)
169 {
170  const int UTF8_BytesPerChar = 4;
171 
172  unsigned int res = sizeof(ostring::value_type);
173 
174  if (charsetMode == Environment::CharsetAnsi)
175  {
176 #ifdef _MSC_VER
177 #pragma warning(disable: 4996)
178 #endif
179  char *str = getenv("NLS_LANG");
180 
181 #ifdef _MSC_VER
182 #pragma warning(default: 4996)
183 #endif
184 
185  if (str)
186  {
187  std::string nlsLang = str;
188 
189  for (int i = 0; i < nlsLang.size(); ++i)
190  {
191  nlsLang[i] = static_cast<std::string::value_type>(toupper(nlsLang[i]));
192  }
193 
194  if (ostring::npos != nlsLang.find("UTF8"))
195  {
196  res = UTF8_BytesPerChar;
197  }
198  }
199  }
200 
201  return res;
202 }
203 
204 /* --------------------------------------------------------------------------------------------- *
205  * Enum
206  * --------------------------------------------------------------------------------------------- */
207 
208 template<class T>
209 Enum<T>::Enum() : _value(0)
210 {
211 }
212 
213 template<class T>
214 Enum<T>::Enum(T value) : _value(value)
215 {
216 }
217 
218 template<class T>
220 {
221  return _value;
222 }
223 
224 template<class T>
226 {
227  return GetValue();
228 }
229 
230 template<class T>
231 Enum<T>::operator unsigned int () const
232 {
233  return static_cast<unsigned int>(_value);
234 }
235 
236 template<class T>
237 bool Enum<T>::operator == (const Enum& other) const
238 {
239  return other._value == _value;
240 }
241 
242 template<class T>
243 bool Enum<T>::operator != (const Enum& other) const
244 {
245  return !(*this == other);
246 }
247 
248 template<class T>
249 bool Enum<T>::operator == (const T& other) const
250 {
251  return other == _value;
252 }
253 
254 template<class T>
255 bool Enum<T>::operator != (const T& other) const
256 {
257  return !(*this == other);
258 }
259 
260 /* --------------------------------------------------------------------------------------------- *
261  * Flags
262  * --------------------------------------------------------------------------------------------- */
263 
264 template<class T>
265 Flags<T>::Flags() : _flags(static_cast<T>(0))
266 {
267 }
268 
269 template<class T>
270 Flags<T>::Flags(T flag) : _flags( flag)
271 {
272 }
273 
274 template<class T>
275 Flags<T>::Flags(const Flags& other) : _flags(other._flags)
276 {
277 }
278 
279 template<class T>
280 Flags<T>::Flags(unsigned int flag) : _flags(static_cast<T>(flag))
281 {
282 }
283 
284 template<class T>
286 {
287  return Flags<T>(~_flags);
288 }
289 
290 template<class T>
291 Flags<T> Flags<T>::operator | (const Flags& other) const
292 {
293  return Flags<T>(_flags | other._flags);
294 }
295 
296 template<class T>
297 Flags<T> Flags<T>::operator & (const Flags& other) const
298 {
299  return Flags<T>(_flags & other._flags);
300 }
301 
302 template<class T>
303 Flags<T> Flags<T>::operator ^ (const Flags& other) const
304 {
305  return Flags<T>(_flags ^ other._flags);
306 }
307 
308 template<class T>
309 Flags<T> Flags<T>::operator | (T other) const
310 {
311  return Flags<T>(_flags | other);
312 }
313 
314 template<class T>
315 Flags<T> Flags<T>::operator & (T other) const
316 {
317  return Flags<T>(_flags & other);
318 }
319 
320 template<class T>
321 Flags<T> Flags<T>::operator ^ (T other) const
322 {
323  return Flags<T>(_flags ^ other);
324 }
325 
326 template<class T>
328 {
329  _flags |= other._flags;
330  return *this;
331 }
332 
333 template<class T>
335 {
336  _flags &= other._flags;
337  return *this;
338 }
339 
340 template<class T>
342 {
343  _flags ^= other._flags;
344  return *this;
345 }
346 
347 template<class T>
349 {
350  _flags |= other;
351  return *this;
352 }
353 
354 template<class T>
356 {
357  _flags &= other;
358  return *this;
359 }
360 
361 template<class T>
363 {
364  _flags ^= other;
365  return *this;
366 }
367 
368 template<class T>
369 bool Flags<T>::operator == (T other) const
370 {
371  return _flags == static_cast<unsigned int>(other);
372 }
373 
374 template<class T>
375 bool Flags<T>::operator == (const Flags& other) const
376 {
377  return _flags == other._flags;
378 }
379 
380 template<class T>
381 bool Flags<T>::IsSet(T other) const
382 {
383  return ((_flags & other) == _flags);
384 }
385 
386 template<class T>
387 unsigned int Flags<T>::GetValues() const
388 {
389  return _flags;
390 }
391 
392 #define OCI_DEFINE_FLAG_OPERATORS(T) \
393 inline Flags<T> operator | (T a, T b) { return Flags<T>(a) | Flags<T>(b); } \
394 
395 OCI_DEFINE_FLAG_OPERATORS(Environment::EnvironmentFlagsValues)
396 OCI_DEFINE_FLAG_OPERATORS(Environment::SessionFlagsValues)
397 OCI_DEFINE_FLAG_OPERATORS(Environment::StartFlagsValues)
398 OCI_DEFINE_FLAG_OPERATORS(Environment::StartModeValues)
399 OCI_DEFINE_FLAG_OPERATORS(Environment::ShutdownModeValues)
400 OCI_DEFINE_FLAG_OPERATORS(Environment::ShutdownFlagsValues)
401 OCI_DEFINE_FLAG_OPERATORS(Environment::AllocatedBytesValues)
402 OCI_DEFINE_FLAG_OPERATORS(Transaction::TransactionFlagsValues)
403 OCI_DEFINE_FLAG_OPERATORS(Column::PropertyFlagsValues)
404 OCI_DEFINE_FLAG_OPERATORS(Subscription::ChangeTypesValues)
405 
406 /* --------------------------------------------------------------------------------------------- *
407  * ManagedBuffer
408  * --------------------------------------------------------------------------------------------- */
409 
410 template<typename T>
411 ManagedBuffer<T>::ManagedBuffer() : _buffer(nullptr), _size(0)
412 {
413 }
414 
415 template<typename T>
416 ManagedBuffer<T>::ManagedBuffer(T *buffer, size_t size) : _buffer(buffer), _size(size)
417 {
418 }
419 
420 template<typename T>
421 ManagedBuffer<T>::ManagedBuffer(size_t size) : _buffer(new T[size]), _size(size)
422 {
423  memset(_buffer, 0, sizeof(T) * _size);
424 }
425 template<typename T>
426 ManagedBuffer<T>::~ManagedBuffer()
427 {
428  delete [] _buffer;
429 }
430 
431 template<typename T>
432 ManagedBuffer<T>::operator T* () const
433 {
434  return _buffer;
435 }
436 
437 template<typename T>
438 ManagedBuffer<T>::operator const T* () const
439 {
440  return _buffer;
441 }
442 
443 /* --------------------------------------------------------------------------------------------- *
444  * Handle
445  * --------------------------------------------------------------------------------------------- */
446 
447 template<class T>
448 HandleHolder<T>::HandleHolder() : _smartHandle(nullptr)
449 {
450 }
451 
452 template<class T>
453 HandleHolder<T>::HandleHolder(const HandleHolder &other) : _smartHandle(nullptr)
454 {
455  Acquire(other, nullptr, nullptr, other._smartHandle ? other._smartHandle->GetParent() : nullptr);
456 }
457 
458 template<class T>
460 {
461  Release();
462 }
463 
464 template<class T>
466 {
467  Acquire(other, nullptr, nullptr, other._smartHandle ? other._smartHandle->GetParent() : nullptr);
468  return *this;
469 }
470 
471 template<class T>
472 bool HandleHolder<T>::IsNull() const
473 {
474  return (static_cast<T>(*this) == 0);
475 }
476 
477 template<class T>
479 {
480  return _smartHandle ? _smartHandle->GetHandle() : nullptr;
481 }
482 
483 template<class T>
485 {
486  return _smartHandle ? _smartHandle->GetHandle() : nullptr;
487 }
488 
489 template<class T>
491 {
492  return !IsNull();
493 }
494 
495 template<class T>
496 HandleHolder<T>::operator bool() const
497 {
498  return !IsNull();
499 }
500 
501 template<class T>
502 Handle * HandleHolder<T>::GetHandle() const
503 {
504  return static_cast<Handle *>(_smartHandle);
505 }
506 
507 template<class T>
508 void HandleHolder<T>::Acquire(T handle, HandleFreeFunc handleFreefunc, SmartHandleFreeNotifyFunc freeNotifyFunc, Handle *parent)
509 {
510  Release();
511 
512  if (handle)
513  {
514  _smartHandle = Environment::GetSmartHandle<SmartHandle*>(handle);
515 
516  if (!_smartHandle)
517  {
518  _smartHandle = new SmartHandle(this, handle, handleFreefunc, freeNotifyFunc, parent);
519  }
520  else
521  {
522  _smartHandle->Acquire(this);
523  }
524  }
525 }
526 
527 template<class T>
529 {
530  if (&other != this && _smartHandle != other._smartHandle)
531  {
532  Release();
533 
534  if (other._smartHandle)
535  {
536  other._smartHandle->Acquire(this);
537  _smartHandle = other._smartHandle;
538  }
539  }
540 }
541 
542 template<class T>
544 {
545  if (_smartHandle)
546  {
547  _smartHandle->Release(this);
548  }
549 
550  _smartHandle = nullptr;
551 }
552 
553 inline Locker::Locker() : _mutex(nullptr)
554 {
555  SetAccessMode(false);
556 }
557 
558 inline Locker::~Locker()
559 {
560  SetAccessMode(false);
561 }
562 
563 inline void Locker::SetAccessMode(bool threaded)
564 {
565  if (threaded && !_mutex)
566  {
567  _mutex = Mutex::Create();
568  }
569  else if (!threaded && _mutex)
570  {
571  Mutex::Destroy(_mutex);
572  _mutex = nullptr;
573  }
574 }
575 
576 inline void Locker::Lock() const
577 {
578  if (_mutex)
579  {
580  Mutex::Acquire(_mutex);
581  }
582 }
583 
584 inline void Locker::Unlock() const
585 {
586  if (_mutex)
587  {
588  Mutex::Release(_mutex);
589  }
590 }
591 
592 inline Lockable::Lockable() : _locker(nullptr)
593 {
594 
595 }
596 
597 inline Lockable::~Lockable()
598 {
599 
600 }
601 
602 inline void Lockable::Lock() const
603 {
604  if (_locker)
605  {
606  _locker->Lock();
607  }
608 }
609 
610 inline void Lockable::Unlock() const
611 {
612  if (_locker)
613  {
614  _locker->Unlock();
615  }
616 }
617 
618 inline void Lockable::SetLocker(Locker *locker)
619 {
620  _locker = locker;
621 }
622 
623 template<class K, class V>
624 ConcurrentMap<K, V>::ConcurrentMap()
625 {
626 
627 }
628 
629 template<class K, class V>
630 ConcurrentMap<K, V>::~ConcurrentMap()
631 {
632  Clear();
633 }
634 
635 template<class K, class V>
636 void ConcurrentMap<K, V>::Remove(K key)
637 {
638  Lock();
639  _map.erase(key);
640  Unlock();
641 }
642 
643 template<class K, class V>
644 V ConcurrentMap<K, V>::Get(K key)
645 {
646  V value = 0;
647 
648  Lock();
649  typename std::map< K, V >::const_iterator it = _map.find(key);
650  if (it != _map.end())
651  {
652  value = it->second;
653  }
654  Unlock();
655 
656  return value;
657 }
658 
659 template<class K, class V>
660 void ConcurrentMap<K, V>::Set(K key, V value)
661 {
662  Lock();
663  _map[key] = value;
664  Unlock();
665 }
666 
667 template<class K, class V>
668 void ConcurrentMap<K, V>::Clear()
669 {
670  Lock();
671  _map.clear();
672  Unlock();
673 }
674 
675 template<class K, class V>
676 size_t ConcurrentMap<K, V>::GetSize()
677 {
678  Lock();
679  size_t size = _map.size();
680  Unlock();
681 
682  return size;
683 }
684 
685 template<class T>
686 ConcurrentList<T>::ConcurrentList() : _list()
687 {
688 
689 }
690 
691 template<class T>
692 ConcurrentList<T>::~ConcurrentList()
693 {
694  Clear();
695 }
696 
697 template<class T>
698 void ConcurrentList<T>::Add(T value)
699 {
700  Lock();
701  _list.push_back(value);
702  Unlock();
703 }
704 
705 template<class T>
706 void ConcurrentList<T>::Remove(T value)
707 {
708  Lock();
709  _list.remove(value);
710  Unlock();
711 }
712 
713 template<class T>
714 void ConcurrentList<T>::Clear()
715 {
716  Lock();
717  _list.clear();
718  Unlock();
719 }
720 
721 template<class T>
722 size_t ConcurrentList<T>::GetSize()
723 {
724  Lock();
725  size_t size = _list.size();
726  Unlock();
727 
728  return size;
729 }
730 
731 template<class T>
732 bool ConcurrentList<T>::Exists(const T &value)
733 {
734  Lock();
735 
736  bool res = std::find(_list.begin(), _list.end(), value) != _list.end();
737 
738  Unlock();
739 
740  return res;
741 }
742 
743 template<class T>
744 template<class P>
745 bool ConcurrentList<T>::FindIf(P predicate, T &value)
746 {
747  bool res = false;
748 
749  Lock();
750 
751  typename std::list<T>::iterator it = std::find_if(_list.begin(), _list.end(), predicate);
752 
753  if (it != _list.end())
754  {
755  value = *it;
756  res = true;
757  }
758 
759  Unlock();
760 
761  return res;
762 }
763 
764 template<class T>
765 template<class A>
766 void ConcurrentList<T>::ForEach(A action)
767 {
768  Lock();
769 
770  std::for_each(_list.begin(), _list.end(), action);
771 
772  Unlock();
773 }
774 
775 template<class T>
777 (
778  HandleHolder *holder, T handle, HandleFreeFunc handleFreefunc,
779  SmartHandleFreeNotifyFunc freeNotifyFunc, Handle *parent
780 )
781  : _holders(), _children(), _locker(), _handle(handle), _handleFreeFunc(handleFreefunc),
782  _freeNotifyFunc(freeNotifyFunc), _parent(parent), _extraInfo(nullptr)
783 {
784  _locker.SetAccessMode((Environment::GetMode() & Environment::Threaded) == Environment::Threaded);
785 
786  _holders.SetLocker(&_locker);
787  _children.SetLocker(&_locker);
788 
789  Environment::SetSmartHandle<SmartHandle*>(handle, this);
790 
791  Acquire(holder);
792 
793  if (_parent && _handle)
794  {
795  _parent->GetChildren().Add(this);
796  }
797 }
798 
799 template<class T>
801 {
802  boolean ret = TRUE;
803  boolean chk = FALSE;
804 
805  if (_parent && _handle)
806  {
807  _parent->GetChildren().Remove(this);
808  }
809 
810  _children.ForEach(DeleteHandle);
811  _children.Clear();
812 
813  _holders.SetLocker(nullptr);
814  _children.SetLocker(nullptr);
815 
816  Environment::SetSmartHandle<SmartHandle*>(_handle, nullptr);
817 
818  if (_freeNotifyFunc)
819  {
820  _freeNotifyFunc(this);
821  }
822 
823  if (_handleFreeFunc && _handle)
824  {
825  ret = _handleFreeFunc(_handle);
826  chk = TRUE;
827  }
828 
829  if (chk)
830  {
831  Check(ret);
832  }
833 }
834 
835 template<class T>
837 {
838  if (handle)
839  {
840  handle->DetachFromParent();
841  handle->DetachFromHolders();
842 
843  delete handle;
844  }
845 }
846 
847 template<class T>
849 {
850  if (holder)
851  {
852  holder->_smartHandle = nullptr;
853  }
854 }
855 
856 template<class T>
858 {
859  _holders.Add(holder);
860 }
861 
862 template<class T>
864 {
865  _holders.Remove(holder);
866 
867  if (_holders.GetSize() == 0)
868  {
869  delete this;
870  }
871 
872  holder->_smartHandle = nullptr;
873 }
874 
875 template<class T>
877 {
878  return _handle;
879 }
880 
881 template<class T>
883 {
884  return _parent;
885 }
886 
887 template<class T>
889 {
890  return _extraInfo;
891 }
892 
893 template<class T>
895 {
896  _extraInfo = extraInfo;
897 }
898 
899 template<class T>
900 ConcurrentList<Handle *> & HandleHolder<T>::SmartHandle::GetChildren()
901 {
902  return _children;
903 }
904 
905 template<class T>
907 {
908  _holders.ForEach(ResetHolder);
909  _holders.Clear();
910 }
911 
912 template<class T>
914 {
915  _parent = nullptr;
916 }
917 
918 /* --------------------------------------------------------------------------------------------- *
919  * Exception
920  * --------------------------------------------------------------------------------------------- */
921 
922 inline Exception::Exception()
923  : _what(),
924  _pStatement(nullptr),
925  _pConnnection(nullptr),
926  _row(0),
927  _type(static_cast<ExceptionType::Type>(0)),
928  _errLib(0),
929  _errOracle(0)
930 {
931 
932 }
933 
934 inline Exception::~Exception() throw ()
935 {
936 
937 }
938 
939 inline Exception::Exception(OCI_Error *err)
940  : _what(),
941  _pStatement(OCI_ErrorGetStatement(err)),
942  _pConnnection(OCI_ErrorGetConnection(err)),
943  _row(OCI_ErrorGetRow(err)),
944  _type(static_cast<ExceptionType::Type>(OCI_ErrorGetType(err))),
945  _errLib(OCI_ErrorGetInternalCode(err)),
946  _errOracle(OCI_ErrorGetOCICode(err))
947 {
948  const otext *str = OCI_ErrorGetString(err);
949 
950  if (str)
951  {
952  ConverString(_what, str, ostrlen(str));
953  }
954 }
955 
956 inline const char * Exception::what() const throw()
957 {
958  return _what.c_str();
959 }
960 
961 inline ostring Exception::GetMessage() const
962 {
963  ostring message;
964 
965 #ifdef OCI_CHARSET_WIDE
966 
967  ConverString(message, _what.c_str(), _what.size());
968 
969 #else
970 
971  message = _what;
972 
973 #endif
974 
975  return message;
976 }
977 
979 {
980  return _type;
981 }
982 
984 {
985  return _errOracle;
986 }
987 
989 {
990  return _errLib;
991 }
992 
993 inline Statement Exception::GetStatement() const
994 {
995  return Statement(_pStatement, nullptr);
996 }
997 
999 {
1000  return Connection(_pConnnection, nullptr);
1001 }
1002 
1003 inline unsigned int Exception::GetRow() const
1004 {
1005  return _row;
1006 }
1007 
1008 /* --------------------------------------------------------------------------------------------- *
1009  * Environment
1010  * --------------------------------------------------------------------------------------------- */
1011 
1012 inline void Environment::Initialize(EnvironmentFlags mode, const ostring& libpath)
1013 {
1014  GetInstance().SelfInitialize(mode, libpath);
1015 }
1016 
1018 {
1019  GetInstance().SelfCleanup();
1020 }
1021 
1023 {
1024  return GetInstance()._mode;
1025 }
1026 
1028 {
1029  return ImportMode(static_cast<ImportMode::Type>(Check(OCI_GetImportMode())));
1030 }
1031 
1033 {
1034  return CharsetMode(static_cast<CharsetMode::Type>(Check(OCI_GetCharset())));
1035 }
1036 
1037 inline unsigned int Environment::GetCharMaxSize()
1038 {
1039  return GetInstance()._charMaxSize;
1040 }
1041 
1043 {
1044  return Check(OCI_GetAllocatedBytes(type.GetValues()));
1045 }
1046 
1048 {
1049  return GetInstance()._initialized;
1050 }
1051 
1053 {
1054  return OracleVersion(static_cast<OracleVersion::Type>(Check(OCI_GetOCICompileVersion())));
1055 }
1056 
1058 {
1059  return OracleVersion(static_cast<OracleVersion::Type>(Check(OCI_GetOCIRuntimeVersion())));
1060 }
1061 
1063 {
1064  return OCI_VER_MAJ(Check(OCI_GetOCICompileVersion()));
1065 }
1066 
1068 {
1069  return OCI_VER_MIN(Check(OCI_GetOCICompileVersion()));
1070 }
1071 
1073 {
1074  return OCI_VER_REV(Check(OCI_GetOCICompileVersion()));
1075 }
1076 
1078 {
1079  return OCI_VER_MAJ(Check(OCI_GetOCIRuntimeVersion()));
1080 }
1081 
1083 {
1084  return OCI_VER_MIN(Check(OCI_GetOCIRuntimeVersion()));
1085 }
1086 
1088 {
1089  return OCI_VER_REV(Check(OCI_GetOCIRuntimeVersion()));
1090 }
1091 
1092 inline void Environment::EnableWarnings(bool value)
1093 {
1094  OCI_EnableWarnings(static_cast<boolean>(value));
1095 }
1096 
1097 inline bool Environment::SetFormat(FormatType formatType, const ostring& format)
1098 {
1099  return Check(OCI_SetFormat(nullptr, formatType, format.c_str()) == TRUE);
1100 }
1101 
1102 inline ostring Environment::GetFormat(FormatType formatType)
1103 {
1104  return MakeString(Check(OCI_GetFormat(nullptr, formatType)));
1105 }
1106 
1107 inline void Environment::StartDatabase(const ostring& db, const ostring& user, const ostring &pwd, Environment::StartFlags startFlags,
1108  Environment::StartMode startMode, Environment::SessionFlags sessionFlags, const ostring& spfile)
1109 {
1110  Check(OCI_DatabaseStartup(db.c_str(), user.c_str(), pwd.c_str(), sessionFlags.GetValues(),
1111  startMode.GetValues(), startFlags.GetValues(), spfile.c_str() ));
1112 }
1113 
1114 inline void Environment::ShutdownDatabase(const ostring& db, const ostring& user, const ostring &pwd, Environment::ShutdownFlags shutdownFlags,
1115  Environment::ShutdownMode shutdownMode, Environment::SessionFlags sessionFlags)
1116 {
1117  Check(OCI_DatabaseShutdown(db.c_str(), user.c_str(), pwd.c_str(), sessionFlags.GetValues(),
1118  shutdownMode.GetValues(), shutdownFlags.GetValues() ));
1119 }
1120 
1121 inline void Environment::ChangeUserPassword(const ostring& db, const ostring& user, const ostring& pwd, const ostring& newPwd)
1122 {
1123  Check(OCI_SetUserPassword(db.c_str(), user.c_str(), pwd.c_str(), newPwd.c_str()));
1124 }
1125 
1126 inline void Environment::SetHAHandler(HAHandlerProc handler)
1127 {
1128  Check(OCI_SetHAHandler(static_cast<POCI_HA_HANDLER>(handler != nullptr ? Environment::HAHandler : nullptr)));
1129 
1130  Environment::SetUserCallback<HAHandlerProc>(GetEnvironmentHandle(), handler);
1131 }
1132 
1133 inline void Environment::HAHandler(OCI_Connection *pConnection, unsigned int source, unsigned int event, OCI_Timestamp *pTimestamp)
1134 {
1135  HAHandlerProc handler = Environment::GetUserCallback<HAHandlerProc>(GetEnvironmentHandle());
1136 
1137  if (handler)
1138  {
1139  Connection connection(pConnection, nullptr);
1140  Timestamp timestamp(pTimestamp, connection.GetHandle());
1141 
1142  handler(connection,
1143  HAEventSource(static_cast<HAEventSource::Type>(source)),
1144  HAEventType (static_cast<HAEventType::Type> (event)),
1145  timestamp);
1146  }
1147 }
1148 
1149 inline unsigned int Environment::TAFHandler(OCI_Connection *pConnection, unsigned int type, unsigned int event)
1150 {
1151  unsigned int res = OCI_FOC_OK;
1152 
1153  Connection::TAFHandlerProc handler = Environment::GetUserCallback<Connection::TAFHandlerProc>(Check(pConnection));
1154 
1155  if (handler)
1156  {
1157  Connection connection(pConnection, nullptr);
1158 
1159  res = handler(connection,
1160  Connection::FailoverRequest( static_cast<Connection::FailoverRequest::Type> (type)),
1161  Connection::FailoverEvent ( static_cast<Connection::FailoverEvent::Type> (event)));
1162  }
1163 
1164  return res;
1165 }
1166 
1167 inline void Environment::NotifyHandler(OCI_Event *pEvent)
1168 {
1169  Subscription::NotifyHandlerProc handler = Environment::GetUserCallback<Subscription::NotifyHandlerProc>((Check(OCI_EventGetSubscription(pEvent))));
1170 
1171  if (handler)
1172  {
1173  Event evt(pEvent);
1174  handler(evt);
1175  }
1176 }
1177 
1178 inline void Environment::NotifyHandlerAQ(OCI_Dequeue *pDequeue)
1179 {
1180  Dequeue::NotifyAQHandlerProc handler = Environment::GetUserCallback<Dequeue::NotifyAQHandlerProc>(Check(pDequeue));
1181 
1182  if (handler)
1183  {
1184  Dequeue dequeue(pDequeue);
1185  handler(dequeue);
1186  }
1187 }
1188 
1189 template<class T>
1190 T Environment::GetUserCallback(AnyPointer ptr)
1191 {
1192  return reinterpret_cast<T>(GetInstance()._callbacks.Get(ptr));
1193 }
1194 
1195 template<class T>
1196 void Environment::SetUserCallback(AnyPointer ptr, T callback)
1197 {
1198  if (callback)
1199  {
1200  GetInstance()._callbacks.Set(ptr, reinterpret_cast<CallbackPointer>(callback));
1201  }
1202  else
1203  {
1204  GetInstance()._callbacks.Remove(ptr);
1205  }
1206 }
1207 
1208 template<class T>
1209 void Environment::SetSmartHandle(AnyPointer ptr, T handle)
1210 {
1211  if (handle)
1212  {
1213  GetInstance()._handles.Set(ptr, handle);
1214  }
1215  else
1216  {
1217  GetInstance()._handles.Remove(ptr);
1218  }
1219 }
1220 
1221 template<class T>
1222 T Environment::GetSmartHandle(AnyPointer ptr)
1223 {
1224  return dynamic_cast<T>(GetInstance()._handles.Get(ptr));
1225 }
1226 
1227 inline Handle * Environment::GetEnvironmentHandle()
1228 {
1229  return GetInstance()._handle.GetHandle();
1230 }
1231 
1232 inline Environment& Environment::GetInstance()
1233 {
1234  static Environment envHandle;
1235 
1236  return envHandle;
1237 }
1238 
1239 inline Environment::Environment() : _locker(), _handle(), _handles(), _callbacks(), _mode(), _initialized(false)
1240 {
1241 
1242 }
1243 
1244 inline void Environment::SelfInitialize(EnvironmentFlags mode, const ostring& libpath)
1245 {
1246  _mode = mode;
1247 
1248  Check(OCI_Initialize(nullptr, libpath.c_str(), _mode.GetValues() | OCI_ENV_CONTEXT));
1249 
1250  _initialized = true;
1251 
1252  _locker.SetAccessMode((_mode & Environment::Threaded) == Environment::Threaded);
1253 
1254  _callbacks.SetLocker(&_locker);
1255  _handles.SetLocker(&_locker);
1256 
1257  _handle.Acquire(const_cast<AnyPointer>(Check(OCI_HandleGetEnvironment())), nullptr, nullptr, nullptr);
1258 
1259  _charMaxSize = ComputeCharMaxSize(GetCharset());
1260 }
1261 
1262 inline void Environment::SelfCleanup()
1263 {
1264  _locker.SetAccessMode(false);
1265 
1266  _callbacks.SetLocker(nullptr);
1267  _handles.SetLocker(nullptr);
1268 
1269  _handle.Release();
1270 
1271  if (_initialized)
1272  {
1273  Check(OCI_Cleanup());
1274  }
1275 
1276  _initialized = false;
1277 }
1278 
1279 /* --------------------------------------------------------------------------------------------- *
1280  * Mutex
1281  * --------------------------------------------------------------------------------------------- */
1282 
1284 {
1285  return Environment::GetInstance().Initialized() ? Check(OCI_MutexCreate()) : nullptr;
1286 }
1287 
1288 inline void Mutex::Destroy(MutexHandle mutex)
1289 {
1290  Check(OCI_MutexFree(mutex));
1291 }
1292 
1293 inline void Mutex::Acquire(MutexHandle mutex)
1294 {
1295  Check(OCI_MutexAcquire(mutex));
1296 }
1297 
1298 inline void Mutex::Release(MutexHandle mutex)
1299 {
1300  Check(OCI_MutexRelease(mutex));
1301 }
1302 
1303 /* --------------------------------------------------------------------------------------------- *
1304  * Thread
1305  * --------------------------------------------------------------------------------------------- */
1306 
1308 {
1309  return Check(OCI_ThreadCreate());
1310 }
1311 
1312 inline void Thread::Destroy(ThreadHandle handle)
1313 {
1314  Check(OCI_ThreadFree(handle));
1315 }
1316 
1317 inline void Thread::Run(ThreadHandle handle, ThreadProc func, AnyPointer args)
1318 {
1319  Check(OCI_ThreadRun(handle, func, args));
1320 }
1321 
1322 inline void Thread::Join(ThreadHandle handle)
1323 {
1324  Check(OCI_ThreadJoin(handle));
1325 }
1326 
1328 {
1329  return Check(OCI_HandleGetThreadID(handle));
1330 }
1331 
1332 /* --------------------------------------------------------------------------------------------- *
1333  * ThreadKey
1334  * --------------------------------------------------------------------------------------------- */
1335 
1336 inline void ThreadKey::Create(const ostring& name, ThreadKeyFreeProc freeProc)
1337 {
1338  Check(OCI_ThreadKeyCreate(name.c_str(), freeProc));
1339 }
1340 
1341 inline void ThreadKey::SetValue(const ostring& name, AnyPointer value)
1342 {
1343  Check(OCI_ThreadKeySetValue(name.c_str(), value));
1344 }
1345 
1346 inline AnyPointer ThreadKey::GetValue(const ostring& name)
1347 {
1348  return Check(OCI_ThreadKeyGetValue(name.c_str()));
1349 }
1350 
1351 /* --------------------------------------------------------------------------------------------- *
1352  * Pool
1353  * --------------------------------------------------------------------------------------------- */
1354 
1355 inline Pool::Pool()
1356 {
1357 
1358 }
1359 
1360 inline Pool::Pool(const ostring& db, const ostring& user, const ostring& pwd, Pool::PoolType poolType,
1361  unsigned int minSize, unsigned int maxSize, unsigned int increment, Environment::SessionFlags sessionFlags)
1362 {
1363  Open(db, user, pwd, poolType, minSize, maxSize, increment, sessionFlags);
1364 }
1365 
1366 inline void Pool::Open(const ostring& db, const ostring& user, const ostring& pwd, Pool::PoolType poolType,
1367  unsigned int minSize, unsigned int maxSize, unsigned int increment, Environment::SessionFlags sessionFlags)
1368 {
1369  Release();
1370 
1371  Acquire(Check(OCI_PoolCreate(db.c_str(), user.c_str(), pwd.c_str(), poolType, sessionFlags.GetValues(),
1372  minSize, maxSize, increment)), reinterpret_cast<HandleFreeFunc>(OCI_PoolFree), nullptr, Environment::GetEnvironmentHandle());
1373 }
1374 
1375 inline void Pool::Close()
1376 {
1377  Release();
1378 }
1379 
1380 inline Connection Pool::GetConnection(const ostring& sessionTag)
1381 {
1382  return Connection(Check( OCI_PoolGetConnection(*this, sessionTag.c_str())), GetHandle());
1383 }
1384 
1385 inline unsigned int Pool::GetTimeout() const
1386 {
1387  return Check( OCI_PoolGetTimeout(*this));
1388 }
1389 
1390 inline void Pool::SetTimeout(unsigned int value)
1391 {
1392  Check( OCI_PoolSetTimeout(*this, value));
1393 }
1394 
1395 inline bool Pool::GetNoWait() const
1396 {
1397  return (Check( OCI_PoolGetNoWait(*this)) == TRUE);
1398 }
1399 
1400 inline void Pool::SetNoWait(bool value)
1401 {
1402  Check( OCI_PoolSetNoWait(*this, value));
1403 }
1404 
1405 inline unsigned int Pool::GetBusyConnectionsCount() const
1406 {
1407  return Check( OCI_PoolGetBusyCount(*this));
1408 }
1409 
1410 inline unsigned int Pool::GetOpenedConnectionsCount() const
1411 {
1412  return Check( OCI_PoolGetOpenedCount(*this));
1413 }
1414 
1415 inline unsigned int Pool::GetMinSize() const
1416 {
1417  return Check( OCI_PoolGetMin(*this));
1418 }
1419 
1420 inline unsigned int Pool::GetMaxSize() const
1421 {
1422  return Check( OCI_PoolGetMax(*this));
1423 }
1424 
1425 inline unsigned int Pool::GetIncrement() const
1426 {
1427  return Check( OCI_PoolGetIncrement(*this));
1428 }
1429 
1430 inline unsigned int Pool::GetStatementCacheSize() const
1431 {
1432  return Check( OCI_PoolGetStatementCacheSize(*this));
1433 }
1434 
1435 inline void Pool::SetStatementCacheSize(unsigned int value)
1436 {
1437  Check( OCI_PoolSetStatementCacheSize(*this, value));
1438 }
1439 
1440 /* --------------------------------------------------------------------------------------------- *
1441  * Connection
1442  * --------------------------------------------------------------------------------------------- */
1443 
1445 {
1446 
1447 }
1448 
1449 inline Connection::Connection(const ostring& db, const ostring& user, const ostring& pwd, Environment::SessionFlags sessionFlags)
1450 {
1451  Open(db, user, pwd, sessionFlags);
1452 }
1453 
1454 inline Connection::Connection(OCI_Connection *con, Handle *parent)
1455 {
1456  Acquire(con, reinterpret_cast<HandleFreeFunc>(parent ? OCI_ConnectionFree : nullptr), nullptr, parent);
1457 }
1458 
1459 inline void Connection::Open(const ostring& db, const ostring& user, const ostring& pwd, Environment::SessionFlags sessionFlags)
1460 {
1461  Acquire(Check(OCI_ConnectionCreate(db.c_str(), user.c_str(), pwd.c_str(), sessionFlags.GetValues())),
1462  reinterpret_cast<HandleFreeFunc>(OCI_ConnectionFree), nullptr, Environment::GetEnvironmentHandle());
1463 }
1464 
1465 inline void Connection::Close()
1466 {
1467  Release();
1468 }
1469 
1470 inline void Connection::Commit()
1471 {
1472  Check(OCI_Commit(*this));
1473 }
1474 
1476 {
1477  Check(OCI_Rollback(*this));
1478 }
1479 
1480 inline void Connection::Break()
1481 {
1482  Check(OCI_Break(*this));
1483 }
1484 
1485 inline void Connection::SetAutoCommit(bool enabled)
1486 {
1487  Check(OCI_SetAutoCommit(*this, enabled));
1488 }
1489 
1490 inline bool Connection::GetAutoCommit() const
1491 {
1492  return (Check(OCI_GetAutoCommit(*this)) == TRUE);
1493 }
1494 
1495 inline bool Connection::IsServerAlive() const
1496 {
1497  return (Check(OCI_IsConnected(*this)) == TRUE);
1498 }
1499 
1500 inline bool Connection::PingServer() const
1501 {
1502  return( Check(OCI_Ping(*this)) == TRUE);
1503 }
1504 
1505 inline ostring Connection::GetConnectionString() const
1506 {
1507  return MakeString(Check(OCI_GetDatabase(*this)));
1508 }
1509 
1510 inline ostring Connection::GetUserName() const
1511 {
1512  return MakeString(Check(OCI_GetUserName(*this)));
1513 }
1514 
1515 inline ostring Connection::GetPassword() const
1516 {
1517  return MakeString(Check(OCI_GetPassword(*this)));
1518 }
1519 
1521 {
1522  return OracleVersion(static_cast<OracleVersion::Type>(Check(OCI_GetVersionConnection(*this))));
1523 }
1524 
1525 inline ostring Connection::GetServerVersion() const
1526 {
1527  return MakeString(Check( OCI_GetVersionServer(*this)));
1528 }
1529 
1530 inline unsigned int Connection::GetServerMajorVersion() const
1531 {
1532  return Check(OCI_GetServerMajorVersion(*this));
1533 }
1534 
1535 inline unsigned int Connection::GetServerMinorVersion() const
1536 {
1537  return Check(OCI_GetServerMinorVersion(*this));
1538 }
1539 
1540 inline unsigned int Connection::GetServerRevisionVersion() const
1541 {
1542  return Check(OCI_GetServerRevisionVersion(*this));
1543 }
1544 
1545 inline void Connection::ChangePassword(const ostring& newPwd)
1546 {
1547  Check(OCI_SetPassword(*this, newPwd.c_str()));
1548 }
1549 
1550 inline ostring Connection::GetSessionTag() const
1551 {
1552  return MakeString(Check(OCI_GetSessionTag(*this)));
1553 }
1554 
1555 inline void Connection::SetSessionTag(const ostring& tag)
1556 {
1557  Check(OCI_SetSessionTag(*this, tag.c_str()));
1558 }
1559 
1561 {
1562  return Transaction(Check(OCI_GetTransaction(*this)));
1563 }
1564 
1565 inline void Connection::SetTransaction(const Transaction &transaction)
1566 {
1567  Check(OCI_SetTransaction(*this, transaction));
1568 }
1569 
1570 inline bool Connection::SetFormat(FormatType formatType, const ostring& format)
1571 {
1572  return Check(OCI_SetFormat(*this, formatType, format.c_str()) == TRUE);
1573 }
1574 
1575 inline ostring Connection::GetFormat(FormatType formatType)
1576 {
1577  return MakeString(Check(OCI_GetFormat(*this, formatType)));
1578 }
1579 
1580 inline void Connection::EnableServerOutput(unsigned int bufsize, unsigned int arrsize, unsigned int lnsize)
1581 {
1582  Check(OCI_ServerEnableOutput(*this, bufsize, arrsize, lnsize));
1583 }
1584 
1586 {
1588 }
1589 
1590 inline bool Connection::GetServerOutput(ostring &line) const
1591 {
1592  const otext * str = Check(OCI_ServerGetOutput(*this));
1593 
1594  line = MakeString(str);
1595 
1596  return (str != nullptr);
1597 }
1598 
1599 inline void Connection::GetServerOutput(std::vector<ostring> &lines) const
1600 {
1601  const otext * str = Check(OCI_ServerGetOutput(*this));
1602 
1603  while (str)
1604  {
1605  lines.push_back(str);
1606  str = Check(OCI_ServerGetOutput(*this));
1607  }
1608 }
1609 
1610 inline void Connection::SetTrace(SessionTrace trace, const ostring& value)
1611 {
1612  Check(OCI_SetTrace(*this, trace, value.c_str()));
1613 }
1614 
1615 inline ostring Connection::GetTrace(SessionTrace trace) const
1616 {
1617  return MakeString(Check(OCI_GetTrace(*this, trace)));
1618 }
1619 
1620 inline ostring Connection::GetDatabase() const
1621 {
1622  return MakeString(Check(OCI_GetDBName(*this)));
1623 }
1624 
1625 inline ostring Connection::GetInstance() const
1626 {
1627  return Check(OCI_GetInstanceName(*this));
1628 }
1629 
1630 inline ostring Connection::GetService() const
1631 {
1632  return MakeString(Check(OCI_GetServiceName(*this)));
1633 }
1634 
1635 inline ostring Connection::GetServer() const
1636 {
1637  return Check(OCI_GetServerName(*this));
1638 }
1639 
1640 inline ostring Connection::GetDomain() const
1641 {
1642  return MakeString(Check(OCI_GetDomainName(*this)));
1643 }
1644 
1645 inline Timestamp Connection::GetInstanceStartTime() const
1646 {
1647  return Timestamp(Check(OCI_GetInstanceStartTime(*this)), GetHandle());
1648 }
1649 
1650 inline unsigned int Connection::GetStatementCacheSize() const
1651 {
1652  return Check(OCI_GetStatementCacheSize(*this));
1653 }
1654 
1655 inline void Connection::SetStatementCacheSize(unsigned int value)
1656 {
1657  Check(OCI_SetStatementCacheSize(*this, value));
1658 }
1659 
1660 inline unsigned int Connection::GetDefaultLobPrefetchSize() const
1661 {
1662  return Check(OCI_GetDefaultLobPrefetchSize(*this));
1663 }
1664 
1665 inline void Connection::SetDefaultLobPrefetchSize(unsigned int value)
1666 {
1667  Check(OCI_SetDefaultLobPrefetchSize(*this, value));
1668 }
1669 
1670 inline unsigned int Connection::GetMaxCursors() const
1671 {
1672  return Check(OCI_GetMaxCursors(*this));
1673 }
1674 
1675 inline bool Connection::IsTAFCapable() const
1676 {
1677  return (Check(OCI_IsTAFCapable(*this)) == TRUE);
1678 }
1679 
1680 inline void Connection::SetTAFHandler(TAFHandlerProc handler)
1681 {
1682  Check(OCI_SetTAFHandler(*this, static_cast<POCI_TAF_HANDLER>(handler != nullptr ? Environment::TAFHandler : nullptr)));
1683 
1684  Environment::SetUserCallback<Connection::TAFHandlerProc>(static_cast<OCI_Connection*>(*this), handler);
1685 }
1686 
1688 {
1689  return Check(OCI_GetUserData(*this));
1690 }
1691 
1693 {
1694  Check(OCI_SetUserData(*this, value));
1695 }
1696 
1697 inline unsigned int Connection::GetTimeout(TimeoutType timeout)
1698 {
1699  return Check(OCI_GetTimeout(*this, timeout));
1700 }
1701 
1702 inline void Connection::SetTimeout(TimeoutType timeout, unsigned int value)
1703 {
1704  Check(OCI_SetTimeout(*this, timeout, value));
1705 }
1706 
1707 /* --------------------------------------------------------------------------------------------- *
1708  * Transaction
1709  * --------------------------------------------------------------------------------------------- */
1710 
1711 inline Transaction::Transaction(const Connection &connection, unsigned int timeout, TransactionFlags flags, OCI_XID *pxid)
1712 {
1713  Acquire(Check(OCI_TransactionCreate(connection, timeout, flags.GetValues(), pxid)), reinterpret_cast<HandleFreeFunc>(OCI_TransactionFree), nullptr, nullptr);
1714 }
1715 
1717 {
1718  Acquire(trans, nullptr, nullptr, nullptr);
1719 }
1720 
1722 {
1723  Check(OCI_TransactionPrepare(*this));
1724 }
1725 
1726 inline void Transaction::Start()
1727 {
1728  Check(OCI_TransactionStart(*this));
1729 }
1730 
1731 inline void Transaction::Stop()
1732 {
1733  Check(OCI_TransactionStop(*this));
1734 }
1735 
1736 inline void Transaction::Resume()
1737 {
1738  Check(OCI_TransactionResume(*this));
1739 }
1740 
1741 inline void Transaction::Forget()
1742 {
1743  Check(OCI_TransactionForget(*this));
1744 }
1745 
1747 {
1748  return TransactionFlags(static_cast<TransactionFlags::Type>(Check(OCI_TransactionGetMode(*this))));
1749 }
1750 
1751 inline unsigned int Transaction::GetTimeout() const
1752 {
1753  return Check(OCI_TransactionGetTimeout(*this));
1754 }
1755 
1756 /* --------------------------------------------------------------------------------------------- *
1757 * Number
1758 * --------------------------------------------------------------------------------------------- */
1759 
1760 inline Number::Number(bool create)
1761 {
1762  if (create)
1763  {
1764  Allocate();
1765  }
1766 }
1767 
1768 inline Number::Number(OCI_Number *pNumber, Handle *parent)
1769 {
1770  Acquire(pNumber, nullptr, nullptr, parent);
1771 }
1772 
1773 inline Number::Number(const ostring& str, const ostring& format)
1774 {
1775  Allocate();
1776 
1777  FromString(str, format);
1778 }
1779 
1780 inline Number::Number(const otext* str, const otext* format)
1781 {
1782  Allocate();
1783 
1784  FromString(str, format);
1785 }
1786 
1787 inline void Number::Allocate()
1788 {
1789  Acquire(Check(OCI_NumberCreate(nullptr)), reinterpret_cast<HandleFreeFunc>(OCI_NumberFree), nullptr, nullptr);
1790 }
1791 
1792 inline void Number::FromString(const ostring& str, const ostring& format) const
1793 {
1794  Check(OCI_NumberFromText(*this, str.c_str(), format.size() > 0 ? format.c_str() : Environment::GetFormat(FormatNumeric).c_str()));
1795 }
1796 
1797 inline ostring Number::ToString(const ostring& format) const
1798 {
1799  if (!IsNull())
1800  {
1801  size_t size = OCI_SIZE_BUFFER;
1802 
1803  ManagedBuffer<otext> buffer(size + 1);
1804 
1805  Check(OCI_NumberToText(*this, format.c_str(), static_cast<int>(size), buffer));
1806 
1807  return MakeString(static_cast<const otext *>(buffer));
1808  }
1809 
1810  return OCI_STRING_NULL;
1811 }
1812 
1813 inline ostring Number::ToString() const
1814 {
1815  return ToString(Environment::GetFormat(FormatNumeric));
1816 }
1817 
1818 inline Number Number::Clone() const
1819 {
1820  Number result;
1821 
1822  result.Allocate();
1823 
1824  Check(OCI_NumberAssign(result, *this));
1825 
1826  return result;
1827 }
1828 
1829 inline int Number::Compare(const Number& other) const
1830 {
1831  return Check(OCI_NumberCompare(*this, other));
1832 }
1833 
1834 template<class T>
1835 T Number::GetValue() const
1836 {
1837  T value;
1838 
1840 
1841  return value;
1842 }
1843 
1844 template<class T>
1845 Number& Number::SetValue(const T &value)
1846 {
1847  if (IsNull())
1848  {
1849  Allocate();
1850  }
1851 
1852  Check(OCI_NumberSetValue(*this, NumericTypeResolver<T>::Value, reinterpret_cast<void*>(const_cast<T*>(&value))));
1853 
1854  return *this;
1855 }
1856 
1857 template<class T>
1858 void Number::Add(const T &value)
1859 {
1860  Check(OCI_NumberAdd(*this, NumericTypeResolver<T>::Value, reinterpret_cast<void*>(const_cast<T*>(&value))));
1861 }
1862 
1863 template<class T>
1864 void Number::Sub(const T &value)
1865 {
1866  Check(OCI_NumberSub(*this, NumericTypeResolver<T>::Value, reinterpret_cast<void*>(const_cast<T*>(&value))));
1867 }
1868 
1869 template<class T>
1870 void Number::Multiply(const T &value)
1871 {
1872  Check(OCI_NumberMultiply(*this, NumericTypeResolver<T>::Value, reinterpret_cast<void*>(const_cast<T*>(&value))));
1873 }
1874 
1875 template<class T>
1876 void Number::Divide(const T &value)
1877 {
1878  Check(OCI_NumberDivide(*this, NumericTypeResolver<T>::Value, reinterpret_cast<void*>(const_cast<T*>(&value))));
1879 }
1880 
1881 inline Number& Number::operator = (OCI_Number * &lhs)
1882 {
1883  Acquire(lhs, reinterpret_cast<HandleFreeFunc>(OCI_NumberFree), nullptr, nullptr);
1884  return *this;
1885 }
1886 
1887 template<class T>
1888 Number& Number::operator = (const T &lhs)
1889 {
1890  SetValue<T>(lhs);
1891  return *this;
1892 }
1893 
1894 template<class T>
1895 Number::operator T() const
1896 {
1897  return GetValue<T>();
1898 }
1899 
1900 template<class T>
1901 Number Number::operator + (const T &value)
1902 {
1903  Number result = Clone();
1904  result.Add(value);
1905  return result;
1906 }
1907 
1908 template<class T>
1909 Number Number::operator - (const T &value)
1910 {
1911  Number result = Clone();
1912  result.Sub(value);
1913  return result;
1914 }
1915 
1916 template<class T>
1917 Number Number::operator * (const T &value)
1918 {
1919  Number result = Clone();
1920  result.Multiply(value);
1921  return result;
1922 }
1923 
1924 template<class T>
1925 Number Number::operator / (const T &value)
1926 {
1927  Number result = Clone();
1928  result.Divide(value);
1929  return result;
1930 }
1931 
1932 template<class T>
1933 Number& Number::operator += (const T &value)
1934 {
1935  Add<T>(value);
1936  return *this;
1937 }
1938 
1939 template<class T>
1940 Number& Number::operator -= (const T &value)
1941 {
1942  Sub<T>(value);
1943  return *this;
1944 }
1945 
1946 template<class T>
1947 Number& Number::operator *= (const T &value)
1948 {
1949  Multiply<T>(value);
1950  return *this;
1951 }
1952 
1953 template<class T>
1954 Number& Number::operator /= (const T &value)
1955 {
1956  Divide<T>(value);
1957  return *this;
1958 }
1959 
1960 inline Number& Number::operator ++ ()
1961 {
1962  return *this += 1;
1963 }
1964 
1965 inline Number& Number::operator -- ()
1966 {
1967  return *this += 1;
1968 }
1969 
1970 inline Number Number::operator ++ (int)
1971 {
1972  return *this + 1;
1973 }
1974 
1975 inline Number Number::operator -- (int)
1976 {
1977  return *this - 1;
1978 }
1979 
1980 inline bool Number::operator == (const Number& other) const
1981 {
1982  return Compare(other) == 0;
1983 }
1984 
1985 inline bool Number::operator != (const Number& other) const
1986 {
1987  return !(*this == other);
1988 }
1989 
1990 inline bool Number::operator > (const Number& other) const
1991 {
1992  return Compare(other) > 0;
1993 }
1994 
1995 inline bool Number::operator < (const Number& other) const
1996 {
1997  return Compare(other) < 0;
1998 }
1999 
2000 inline bool Number::operator >= (const Number& other) const
2001 {
2002  int res = Compare(other);
2003 
2004  return res == 0 || res < 0;
2005 }
2006 
2007 inline bool Number::operator <= (const Number& other) const
2008 {
2009  int res = Compare(other);
2010 
2011  return res == 0 || res > 0;
2012 }
2013 
2014 /* --------------------------------------------------------------------------------------------- *
2015  * Date
2016  * --------------------------------------------------------------------------------------------- */
2017 
2018 inline Date::Date(bool create)
2019 {
2020  if (create)
2021  {
2022  Allocate();
2023  }
2024 }
2025 
2026 inline Date::Date(const ostring& str, const ostring& format)
2027 {
2028  Allocate();
2029 
2030  FromString(str, format);
2031 }
2032 
2033 inline Date::Date(const otext* str, const otext* format)
2034 {
2035  Allocate();
2036 
2037  FromString(str, format);
2038 }
2039 
2040 inline Date::Date(OCI_Date *pDate, Handle *parent)
2041 {
2042  Acquire(pDate, nullptr, nullptr, parent);
2043 }
2044 
2045 inline void Date::Allocate()
2046 {
2047  Acquire(Check(OCI_DateCreate(nullptr)), reinterpret_cast<HandleFreeFunc>(OCI_DateFree), nullptr, nullptr);
2048 }
2049 
2050 inline Date Date::SysDate()
2051 {
2052  Date result;
2053 
2054  result.Allocate();
2055 
2056  Check(OCI_DateSysDate(result));
2057 
2058  return result;
2059 }
2060 
2061 inline Date Date::Clone() const
2062 {
2063  Date result;
2064 
2065  result.Allocate();
2066 
2067  Check(OCI_DateAssign(result, *this));
2068 
2069  return result;
2070 }
2071 
2072 inline int Date::Compare(const Date& other) const
2073 {
2074  return Check(OCI_DateCompare(*this, other));
2075 }
2076 
2077 inline bool Date::IsValid() const
2078 {
2079  return (Check(OCI_DateCheck(*this)) == 0);
2080 }
2081 
2082 inline int Date::GetYear() const
2083 {
2084  int year = 0, month = 0, day = 0;
2085 
2086  GetDate(year, month, day);
2087 
2088  return year;
2089 }
2090 
2091 inline void Date::SetYear(int value)
2092 {
2093  int year = 0, month = 0, day = 0;
2094 
2095  GetDate(year, month, day);
2096  SetDate(value, month, day);
2097 }
2098 
2099 inline int Date::GetMonth() const
2100 {
2101  int year = 0, month = 0, day = 0;
2102 
2103  GetDate(year, month, day);
2104 
2105  return month;
2106 }
2107 
2108 inline void Date::SetMonth(int value)
2109 {
2110  int year = 0, month = 0, day = 0;
2111 
2112  GetDate(year, month, day);
2113  SetDate(year, value, day);
2114 }
2115 
2116 inline int Date::GetDay() const
2117 {
2118  int year = 0, month = 0, day = 0;
2119 
2120  GetDate(year, month, day);
2121 
2122  return day;
2123 }
2124 
2125 inline void Date::SetDay(int value)
2126 {
2127  int year = 0, month = 0, day = 0;
2128 
2129  GetDate(year, month, day);
2130  SetDate(year, month, value);
2131 }
2132 
2133 inline int Date::GetHours() const
2134 {
2135  int hour = 0, minutes = 0, seconds = 0;
2136 
2137  GetTime(hour, minutes, seconds);
2138 
2139  return hour;
2140 }
2141 
2142 inline void Date::SetHours(int value)
2143 {
2144  int hour = 0, minutes = 0, seconds = 0;
2145 
2146  GetTime(hour, minutes, seconds);
2147  SetTime(value, minutes, seconds);
2148 }
2149 
2150 inline int Date::GetMinutes() const
2151 {
2152  int hour = 0, minutes = 0, seconds = 0;
2153 
2154  GetTime(hour, minutes, seconds);
2155 
2156  return minutes;
2157 }
2158 
2159 inline void Date::SetMinutes(int value)
2160 {
2161  int hour = 0, minutes = 0, seconds = 0;
2162 
2163  GetTime(hour, minutes, seconds);
2164  SetTime(hour, value, seconds);
2165 }
2166 
2167 inline int Date::GetSeconds() const
2168 {
2169  int hour = 0, minutes = 0, seconds = 0;
2170 
2171  GetTime(hour, minutes, seconds);
2172 
2173  return seconds;
2174 }
2175 
2176 inline void Date::SetSeconds(int value)
2177 {
2178  int hour = 0, minutes = 0, seconds = 0;
2179 
2180  GetTime(hour, minutes, seconds);
2181  SetTime(hour, minutes, value);
2182 }
2183 
2184 inline int Date::DaysBetween(const Date& other) const
2185 {
2186  return Check(OCI_DateDaysBetween(*this, other));
2187 }
2188 
2189 inline void Date::SetDate(int year, int month, int day)
2190 {
2191  Check(OCI_DateSetDate(*this, year, month, day));
2192 }
2193 
2194 inline void Date::SetTime(int hour, int min, int sec)
2195 {
2196  Check(OCI_DateSetTime(*this, hour, min , sec));
2197 }
2198 
2199 inline void Date::SetDateTime(int year, int month, int day, int hour, int min, int sec)
2200 {
2201  Check(OCI_DateSetDateTime(*this, year, month, day, hour, min , sec));
2202 }
2203 
2204 inline void Date::GetDate(int &year, int &month, int &day) const
2205 {
2206  Check(OCI_DateGetDate(*this, &year, &month, &day));
2207 }
2208 
2209 inline void Date::GetTime(int &hour, int &min, int &sec) const
2210 {
2211  Check(OCI_DateGetTime(*this, &hour, &min , &sec));
2212 }
2213 
2214 inline void Date::GetDateTime(int &year, int &month, int &day, int &hour, int &min, int &sec) const
2215 {
2216  Check(OCI_DateGetDateTime(*this, &year, &month, &day, &hour, &min , &sec));
2217 }
2218 
2219 inline void Date::AddDays(int days)
2220 {
2221  Check(OCI_DateAddDays(*this, days));
2222 }
2223 
2224 inline void Date::AddMonths(int months)
2225 {
2226  OCI_DateAddMonths(*this, months);
2227 }
2228 
2229 inline Date Date::NextDay(const ostring& day) const
2230 {
2231  Date result = Clone();
2232 
2233  Check(OCI_DateNextDay(result, day.c_str()));
2234 
2235  return result;
2236 }
2237 
2238 inline Date Date::LastDay() const
2239 {
2240  Date result = Clone();
2241 
2242  Check(OCI_DateLastDay(result));
2243 
2244  return result;
2245 }
2246 
2247 inline void Date::ChangeTimeZone(const ostring& tzSrc, const ostring& tzDst)
2248 {
2249  Check(OCI_DateZoneToZone(*this, tzSrc.c_str(), tzDst.c_str()));
2250 }
2251 
2252 inline void Date::FromString(const ostring& str, const ostring& format)
2253 {
2254  Check(OCI_DateFromText(*this, str.c_str(), format.size() > 0 ? format.c_str() : Environment::GetFormat(FormatDate).c_str()));
2255 }
2256 
2257 inline ostring Date::ToString(const ostring& format) const
2258 {
2259  if (!IsNull())
2260  {
2261  size_t size = OCI_SIZE_BUFFER;
2262 
2263  ManagedBuffer<otext> buffer(size + 1);
2264 
2265  Check(OCI_DateToText(*this, format.c_str(), static_cast<int>(size), buffer));
2266 
2267  return MakeString(static_cast<const otext *>(buffer));
2268  }
2269 
2270  return OCI_STRING_NULL;
2271 }
2272 
2273 inline ostring Date::ToString() const
2274 {
2275  return ToString(Environment::GetFormat(FormatDate));
2276 }
2277 
2278 inline Date& Date::operator ++ ()
2279 {
2280  return *this += 1;
2281 }
2282 
2283 inline Date Date::operator ++ (int)
2284 {
2285  Date result = Clone();
2286 
2287  *this += 1;
2288 
2289  return result;
2290 }
2291 
2292 inline Date& Date::operator -- ()
2293 {
2294  return *this -= 1;
2295 }
2296 
2297 inline Date Date::operator -- (int)
2298 {
2299  Date result = Clone();
2300 
2301  *this -= 1;
2302 
2303  return result;
2304 }
2305 
2306 inline Date Date::operator + (int value) const
2307 {
2308  Date result = Clone();
2309  return result += value;
2310 }
2311 
2312 inline Date Date::operator - (int value) const
2313 {
2314  Date result = Clone();
2315  return result -= value;
2316 }
2317 
2318 inline Date& Date::operator += (int value)
2319 {
2320  AddDays(value);
2321  return *this;
2322 }
2323 
2324 inline Date& Date::operator -= (int value)
2325 {
2326  AddDays(-value);
2327  return *this;
2328 }
2329 
2330 inline bool Date::operator == (const Date& other) const
2331 {
2332  return Compare(other) == 0;
2333 }
2334 
2335 inline bool Date::operator != (const Date& other) const
2336 {
2337  return !(*this == other);
2338 }
2339 
2340 inline bool Date::operator > (const Date& other) const
2341 {
2342  return Compare(other) > 0;
2343 }
2344 
2345 inline bool Date::operator < (const Date& other) const
2346 {
2347  return Compare(other) < 0;
2348 }
2349 
2350 inline bool Date::operator >= (const Date& other) const
2351 {
2352  int res = Compare(other);
2353 
2354  return res == 0 || res > 0;
2355 }
2356 
2357 inline bool Date::operator <= (const Date& other) const
2358 {
2359  int res = Compare(other);
2360 
2361  return res == 0 || res < 0;
2362 }
2363 
2364 /* --------------------------------------------------------------------------------------------- *
2365  * Interval
2366  * --------------------------------------------------------------------------------------------- */
2367 
2369 {
2370 }
2371 
2373 {
2374  Acquire(Check(OCI_IntervalCreate(nullptr, type)), reinterpret_cast<HandleFreeFunc>(OCI_IntervalFree), nullptr, nullptr);
2375 }
2376 
2377 inline Interval::Interval(IntervalType type, const ostring& data)
2378 {
2379  Acquire(Check(OCI_IntervalCreate(nullptr, type)), reinterpret_cast<HandleFreeFunc>(OCI_IntervalFree), nullptr, nullptr);
2380 
2381  FromString(data);
2382 }
2383 
2384 inline Interval::Interval(OCI_Interval *pInterval, Handle *parent)
2385 {
2386  Acquire(pInterval, nullptr, nullptr, parent);
2387 }
2388 
2389 inline Interval Interval::Clone() const
2390 {
2391  Interval result(GetType());
2392 
2393  Check(OCI_IntervalAssign(result, *this));
2394 
2395  return result;
2396 }
2397 
2398 inline int Interval::Compare(const Interval& other) const
2399 {
2400  return Check(OCI_IntervalCompare(*this, other));
2401 }
2402 
2404 {
2405  return IntervalType(static_cast<IntervalType::Type>(Check(OCI_IntervalGetType(*this))));
2406 }
2407 
2408 inline bool Interval::IsValid() const
2409 {
2410  return (Check(OCI_IntervalCheck(*this)) == 0);
2411 }
2412 
2413 inline int Interval::GetYear() const
2414 {
2415  int year = 0, month = 0;
2416 
2417  GetYearMonth(year, month);
2418 
2419  return year;
2420 }
2421 
2422 inline void Interval::SetYear(int value)
2423 {
2424  int year = 0, month = 0;
2425 
2426  GetYearMonth(year, month);
2427  SetYearMonth(value, month);
2428 }
2429 
2430 inline int Interval::GetMonth() const
2431 {
2432  int year = 0, month = 0;
2433 
2434  GetYearMonth(year, month);
2435 
2436  return month;
2437 }
2438 
2439 inline void Interval::SetMonth(int value)
2440 {
2441  int year = 0, month = 0;
2442 
2443  GetYearMonth(year, month);
2444  SetYearMonth(year, value);
2445 }
2446 
2447 inline int Interval::GetDay() const
2448 {
2449  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2450 
2451  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2452 
2453  return day;
2454 }
2455 
2456 inline void Interval::SetDay(int value)
2457 {
2458  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2459 
2460  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2461  SetDaySecond(value, hour, minutes, seconds, milliseconds);
2462 }
2463 
2464 inline int Interval::GetHours() const
2465 {
2466  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2467 
2468  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2469 
2470  return hour;
2471 }
2472 
2473 inline void Interval::SetHours(int value)
2474 {
2475  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2476 
2477  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2478  SetDaySecond(day, value, minutes, seconds, milliseconds);
2479 }
2480 
2481 inline int Interval::GetMinutes() const
2482 {
2483  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2484 
2485  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2486 
2487  return minutes;
2488 }
2489 
2490 inline void Interval::SetMinutes(int value)
2491 {
2492  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2493 
2494  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2495  SetDaySecond(day, hour, value, seconds, milliseconds);
2496 }
2497 
2498 inline int Interval::GetSeconds() const
2499 {
2500  int day, hour, minutes, seconds, milliseconds;
2501 
2502  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2503 
2504  return seconds;
2505 }
2506 
2507 inline void Interval::SetSeconds(int value)
2508 {
2509  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2510 
2511  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2512  SetDaySecond(day, hour, minutes, value, milliseconds);
2513 }
2514 
2515 inline int Interval::GetMilliSeconds() const
2516 {
2517  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2518 
2519  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2520 
2521  return milliseconds;
2522 }
2523 
2524 inline void Interval::SetMilliSeconds(int value)
2525 {
2526  int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2527 
2528  GetDaySecond(day, hour, minutes, seconds, milliseconds);
2529  SetDaySecond(day, hour, minutes, seconds, value);
2530 }
2531 
2532 inline void Interval::GetDaySecond(int &day, int &hour, int &min, int &sec, int &fsec) const
2533 {
2534  Check(OCI_IntervalGetDaySecond(*this, &day, &hour, &min, &sec, &fsec));
2535 }
2536 
2537 inline void Interval::SetDaySecond(int day, int hour, int min, int sec, int fsec)
2538 {
2539  Check(OCI_IntervalSetDaySecond(*this, day, hour, min, sec, fsec));
2540 }
2541 
2542 inline void Interval::GetYearMonth(int &year, int &month) const
2543 {
2544  Check(OCI_IntervalGetYearMonth(*this, &year, &month));
2545 }
2546 inline void Interval::SetYearMonth(int year, int month)
2547 {
2548  Check(OCI_IntervalSetYearMonth(*this, year, month));
2549 }
2550 
2551 inline void Interval::UpdateTimeZone(const ostring& timeZone)
2552 {
2553  Check(OCI_IntervalFromTimeZone(*this, timeZone.c_str()));
2554 }
2555 
2556 inline void Interval::FromString(const ostring& data)
2557 {
2558  Check(OCI_IntervalFromText(*this, data.c_str()));
2559 }
2560 
2561 inline ostring Interval::ToString(int leadingPrecision, int fractionPrecision) const
2562 {
2563  if (!IsNull())
2564  {
2565  size_t size = OCI_SIZE_BUFFER;
2566 
2567  ManagedBuffer<otext> buffer(size + 1);
2568 
2569  Check(OCI_IntervalToText(*this, leadingPrecision, fractionPrecision, static_cast<int>(size), buffer));
2570 
2571  return MakeString(static_cast<const otext *>(buffer));
2572  }
2573 
2574  return OCI_STRING_NULL;
2575 }
2576 
2577 inline ostring Interval::ToString() const
2578 {
2579  return ToString(OCI_STRING_DEFAULT_PREC, OCI_STRING_DEFAULT_PREC);
2580 }
2581 
2582 inline Interval Interval::operator + (const Interval& other) const
2583 {
2584  Interval result = Clone();
2585  return result += other;
2586 }
2587 
2588 inline Interval Interval::operator - (const Interval& other) const
2589 {
2590  Interval result = Clone();
2591  return result -= other;
2592 }
2593 
2594 inline Interval& Interval::operator += (const Interval& other)
2595 {
2596  Check(OCI_IntervalAdd(*this, other));
2597  return *this;
2598 }
2599 
2600 inline Interval& Interval::operator -= (const Interval& other)
2601 {
2602  Check(OCI_IntervalSubtract(*this, other));
2603  return *this;
2604 }
2605 
2606 inline bool Interval::operator == (const Interval& other) const
2607 {
2608  return Compare(other) == 0;
2609 }
2610 
2611 inline bool Interval::operator != (const Interval& other) const
2612 {
2613  return (!(*this == other));
2614 }
2615 
2616 inline bool Interval::operator > (const Interval& other) const
2617 {
2618  return (Compare(other) > 0);
2619 }
2620 
2621 inline bool Interval::operator < (const Interval& other) const
2622 {
2623  return (Compare(other) < 0);
2624 }
2625 
2626 inline bool Interval::operator >= (const Interval& other) const
2627 {
2628  int res = Compare(other);
2629 
2630  return (res == 0 || res < 0);
2631 }
2632 
2633 inline bool Interval::operator <= (const Interval& other) const
2634 {
2635  int res = Compare(other);
2636 
2637  return (res == 0 || res > 0);
2638 }
2639 
2640 /* --------------------------------------------------------------------------------------------- *
2641  * Timestamp
2642  * --------------------------------------------------------------------------------------------- */
2643 
2645 {
2646 }
2647 
2649 {
2650  Acquire(Check(OCI_TimestampCreate(nullptr, type)), reinterpret_cast<HandleFreeFunc>(OCI_TimestampFree), nullptr, nullptr);
2651 }
2652 
2653 inline Timestamp::Timestamp(TimestampType type, const ostring& data, const ostring& format)
2654 {
2655  Acquire(Check(OCI_TimestampCreate(nullptr, type)), reinterpret_cast<HandleFreeFunc>(OCI_TimestampFree), nullptr, nullptr);
2656  FromString(data, format);
2657 }
2658 
2659 inline Timestamp::Timestamp(OCI_Timestamp *pTimestamp, Handle *parent)
2660 {
2661  Acquire(pTimestamp, nullptr, nullptr, parent);
2662 }
2663 
2664 inline Timestamp Timestamp::Clone() const
2665 {
2666  Timestamp result(GetType());
2667 
2668  Check(OCI_TimestampAssign(result, *this));
2669 
2670  return result;
2671 }
2672 
2673 inline int Timestamp::Compare(const Timestamp& other) const
2674 {
2675  return Check(OCI_TimestampCompare(*this, other));
2676 }
2677 
2679 {
2680  return TimestampType(static_cast<TimestampType::Type>(Check(OCI_TimestampGetType(*this))));
2681 }
2682 
2683 inline void Timestamp::SetDateTime(int year, int month, int day, int hour, int min, int sec, int fsec, const ostring& timeZone)
2684 {
2685  Check(OCI_TimestampConstruct(*this, year, month, day, hour, min,sec, fsec, timeZone.c_str()));
2686 }
2687 
2688 inline void Timestamp::Convert(const Timestamp& other)
2689 {
2690  Check(OCI_TimestampConvert(*this, other));
2691 }
2692 
2693 inline bool Timestamp::IsValid() const
2694 {
2695  return (Check(OCI_TimestampCheck(*this)) == 0);
2696 }
2697 
2698 inline int Timestamp::GetYear() const
2699 {
2700  int year, month, day;
2701 
2702  GetDate(year, month, day);
2703 
2704  return year;
2705 }
2706 
2707 inline void Timestamp::SetYear(int value)
2708 {
2709  int year, month, day;
2710 
2711  GetDate(year, month, day);
2712  SetDate(value, month, day);
2713 }
2714 
2715 inline int Timestamp::GetMonth() const
2716 {
2717  int year, month, day;
2718 
2719  GetDate(year, month, day);
2720 
2721  return month;
2722 }
2723 
2724 inline void Timestamp::SetMonth(int value)
2725 {
2726  int year, month, day;
2727 
2728  GetDate(year, month, day);
2729  SetDate(year, value, day);
2730 }
2731 
2732 inline int Timestamp::GetDay() const
2733 {
2734  int year, month, day;
2735 
2736  GetDate(year, month, day);
2737 
2738  return day;
2739 }
2740 
2741 inline void Timestamp::SetDay(int value)
2742 {
2743  int year, month, day;
2744 
2745  GetDate(year, month, day);
2746  SetDate(year, month, value);
2747 }
2748 
2749 inline int Timestamp::GetHours() const
2750 {
2751  int hour, minutes, seconds, milliseconds;
2752 
2753  GetTime(hour, minutes, seconds, milliseconds);
2754 
2755  return hour;
2756 }
2757 
2758 inline void Timestamp::SetHours(int value)
2759 {
2760  int hour, minutes, seconds, milliseconds;
2761 
2762  GetTime(hour, minutes, seconds, milliseconds);
2763  SetTime(value, minutes, seconds, milliseconds);
2764 }
2765 
2766 inline int Timestamp::GetMinutes() const
2767 {
2768  int hour, minutes, seconds, milliseconds;
2769 
2770  GetTime(hour, minutes, seconds, milliseconds);
2771 
2772  return minutes;
2773 }
2774 
2775 inline void Timestamp::SetMinutes(int value)
2776 {
2777  int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2778 
2779  GetTime(hour, minutes, seconds, milliseconds);
2780  SetTime(hour, value, seconds, milliseconds);
2781 }
2782 
2783 inline int Timestamp::GetSeconds() const
2784 {
2785  int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2786 
2787  GetTime(hour, minutes, seconds, milliseconds);
2788 
2789  return seconds;
2790 }
2791 
2792 inline void Timestamp::SetSeconds(int value)
2793 {
2794  int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2795 
2796  GetTime(hour, minutes, seconds, milliseconds);
2797  SetTime(hour, minutes, value, milliseconds);
2798 }
2799 
2800 inline int Timestamp::GetMilliSeconds() const
2801 {
2802  int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2803 
2804  GetTime(hour, minutes, seconds, milliseconds);
2805 
2806  return milliseconds;
2807 }
2808 
2809 inline void Timestamp::SetMilliSeconds(int value)
2810 {
2811  int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2812 
2813  GetTime(hour, minutes, seconds, milliseconds);
2814  SetTime(hour, minutes, seconds, value);
2815 }
2816 
2817 inline void Timestamp::GetDate(int &year, int &month, int &day) const
2818 {
2819  Check(OCI_TimestampGetDate(*this, &year, &month, &day));
2820 }
2821 
2822 inline void Timestamp::GetTime(int &hour, int &min, int &sec, int &fsec) const
2823 {
2824  Check(OCI_TimestampGetTime(*this, &hour, &min, &sec, &fsec));
2825 }
2826 
2827 inline void Timestamp::GetDateTime(int &year, int &month, int &day, int &hour, int &min, int &sec, int &fsec) const
2828 {
2829  Check(OCI_TimestampGetDateTime(*this, &year, &month, &day, &hour, &min, &sec, &fsec));
2830 }
2831 
2832 inline void Timestamp::SetDate(int year, int month, int day)
2833 {
2834  int tmpYear = 0, tmpMonth = 0, tempDay = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2835 
2836  GetDateTime(tmpYear, tmpMonth, tempDay, hour, minutes, seconds, milliseconds);
2837  SetDateTime(year, month, day, hour, minutes, seconds, milliseconds);
2838 }
2839 
2840 inline void Timestamp::SetTime(int hour, int min, int sec, int fsec)
2841 {
2842  int year = 0, month = 0, day = 0, tmpHour = 0, tmpMinutes = 0, tmpSeconds = 0, tmpMilliseconds = 0;
2843 
2844  GetDateTime(year, month, day, tmpHour, tmpMinutes, tmpSeconds, tmpMilliseconds);
2845  SetDateTime(year, month, day, hour, min, sec, fsec);
2846 }
2847 
2848 inline void Timestamp::SetTimeZone(const ostring& timeZone)
2849 {
2850  if (GetType() == WithTimeZone)
2851  {
2852  int year = 0, month = 0, day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
2853 
2854  GetDateTime(year, month, day, hour, minutes, seconds, milliseconds);
2855  SetDateTime(year, month, day, hour, minutes, seconds, milliseconds, timeZone);
2856  }
2857 }
2858 
2859 inline ostring Timestamp::GetTimeZone() const
2860 {
2861  if (GetType() != NoTimeZone)
2862  {
2863  size_t size = OCI_SIZE_BUFFER;
2864 
2865  ManagedBuffer<otext> buffer(size + 1);
2866 
2867  Check(OCI_TimestampGetTimeZoneName(*this, static_cast<int>(size), buffer) == TRUE);
2868 
2869  return MakeString(static_cast<const otext *>(buffer));
2870  }
2871 
2872  return ostring();
2873 }
2874 
2875 inline void Timestamp::GetTimeZoneOffset(int &hour, int &min) const
2876 {
2877  Check(OCI_TimestampGetTimeZoneOffset(*this, &hour, &min));
2878 }
2879 
2880 inline void Timestamp::Substract(const Timestamp &lsh, const Timestamp &rsh, Interval& result)
2881 {
2882  Check(OCI_TimestampSubtract(lsh, rsh, result));
2883 }
2884 
2886 {
2887  Timestamp result(type);
2888 
2890 
2891  return result;
2892 }
2893 
2894 inline void Timestamp::FromString(const ostring& data, const ostring& format)
2895 {
2896  Check(OCI_TimestampFromText(*this, data.c_str(), format.size() > 0 ? format.c_str() : Environment::GetFormat(FormatTimestamp).c_str()));
2897 }
2898 
2899 inline ostring Timestamp::ToString(const ostring& format, int precision = OCI_STRING_DEFAULT_PREC) const
2900 {
2901  if (!IsNull())
2902  {
2903  size_t size = OCI_SIZE_BUFFER;
2904 
2905  ManagedBuffer<otext> buffer(size + 1);
2906 
2907  Check(OCI_TimestampToText(*this, format.c_str(), static_cast<int>(size), buffer, precision));
2908 
2909  return MakeString(static_cast<const otext *>(buffer));
2910  }
2911 
2912  return OCI_STRING_NULL;
2913 }
2914 
2915 inline ostring Timestamp::ToString() const
2916 {
2917  return ToString(Environment::GetFormat(FormatTimestamp), OCI_STRING_DEFAULT_PREC);
2918 }
2919 
2920 inline Timestamp& Timestamp::operator ++ ()
2921 {
2922  return *this += 1;
2923 }
2924 
2925 inline Timestamp Timestamp::operator ++ (int)
2926 {
2927  Timestamp result = Clone();
2928 
2929  *this += 1;
2930 
2931  return result;
2932 }
2933 
2934 inline Timestamp& Timestamp::operator -- ()
2935 {
2936  return *this -= 1;
2937 }
2938 
2939 inline Timestamp Timestamp::operator -- (int)
2940 {
2941  Timestamp result = Clone();
2942 
2943  *this -= 1;
2944 
2945  return result;
2946 }
2947 
2948 inline Timestamp Timestamp::operator + (int value) const
2949 {
2950  Timestamp result = Clone();
2951  Interval interval(Interval::DaySecond);
2952  interval.SetDay(1);
2953  return result += value;
2954 }
2955 
2956 inline Timestamp Timestamp::operator - (int value) const
2957 {
2958  Timestamp result = Clone();
2959  Interval interval(Interval::DaySecond);
2960  interval.SetDay(1);
2961  return result -= value;
2962 }
2963 
2964 inline Interval Timestamp::operator - (const Timestamp& other)
2965 {
2966  Interval interval(Interval::DaySecond);
2967  Check(OCI_TimestampSubtract(*this, other, interval));
2968  return interval;
2969 }
2970 
2971 inline Timestamp Timestamp::operator + (const Interval& other) const
2972 {
2973  Timestamp result = Clone();
2974  return result += other;
2975 }
2976 
2977 inline Timestamp Timestamp::operator - (const Interval& other) const
2978 {
2979  Timestamp result = Clone();
2980  return result -= other;
2981 }
2982 
2983 inline Timestamp& Timestamp::operator += (const Interval& other)
2984 {
2985  Check(OCI_TimestampIntervalAdd(*this, other));
2986  return *this;
2987 }
2988 
2989 inline Timestamp& Timestamp::operator -= (const Interval& other)
2990 {
2991  Check(OCI_TimestampIntervalSub(*this, other));
2992  return *this;
2993 }
2994 
2995 inline Timestamp& Timestamp::operator += (int value)
2996 {
2997  Interval interval(Interval::DaySecond);
2998  interval.SetDay(value);
2999  return *this += interval;
3000 }
3001 
3002 inline Timestamp& Timestamp::operator -= (int value)
3003 {
3004  Interval interval(Interval::DaySecond);
3005  interval.SetDay(value);
3006  return *this -= interval;
3007 }
3008 
3009 inline bool Timestamp::operator == (const Timestamp& other) const
3010 {
3011  return Compare(other) == 0;
3012 }
3013 
3014 inline bool Timestamp::operator != (const Timestamp& other) const
3015 {
3016  return (!(*this == other));
3017 }
3018 
3019 inline bool Timestamp::operator > (const Timestamp& other) const
3020 {
3021  return (Compare(other) > 0);
3022 }
3023 
3024 inline bool Timestamp::operator < (const Timestamp& other) const
3025 {
3026  return (Compare(other) < 0);
3027 }
3028 
3029 inline bool Timestamp::operator >= (const Timestamp& other) const
3030 {
3031  int res = Compare(other);
3032 
3033  return (res == 0 || res < 0);
3034 }
3035 
3036 inline bool Timestamp::operator <= (const Timestamp& other) const
3037 {
3038  int res = Compare(other);
3039 
3040  return (res == 0 || res > 0);
3041 }
3042 
3043 /* --------------------------------------------------------------------------------------------- *
3044  * Lob
3045  * --------------------------------------------------------------------------------------------- */
3046 
3047 template<class T, int U>
3049 {
3050 }
3051 
3052 template<class T, int U>
3053 Lob<T, U>::Lob(const Connection &connection)
3054 {
3055  Acquire(Check(OCI_LobCreate(connection, U)), reinterpret_cast<HandleFreeFunc>(OCI_LobFree), nullptr, connection.GetHandle());
3056 }
3057 
3058 template<class T, int U>
3059 Lob<T, U>::Lob(OCI_Lob *pLob, Handle *parent)
3060 {
3061  Acquire(pLob, nullptr, nullptr, parent);
3062 }
3063 
3064 template<>
3065 inline ostring Lob<ostring, LobCharacter>::Read(unsigned int length)
3066 {
3067  ManagedBuffer<otext> buffer(Environment::GetCharMaxSize() * (length + 1));
3068 
3069  unsigned int charCount = length;
3070  unsigned int byteCount = 0;
3071 
3072  if (Check(OCI_LobRead2(*this, static_cast<AnyPointer>(buffer), &charCount, &byteCount)))
3073  {
3074  length = byteCount / sizeof(otext);
3075  }
3076 
3077  return MakeString(static_cast<const otext *>(buffer), static_cast<int>(length));
3078 }
3079 
3080 template<>
3081 inline ostring Lob<ostring, LobNationalCharacter>::Read(unsigned int length)
3082 {
3083  ManagedBuffer<otext> buffer(Environment::GetCharMaxSize() * (length + 1));
3084 
3085  unsigned int charCount = length;
3086  unsigned int byteCount = 0;
3087 
3088  if (Check(OCI_LobRead2(*this, static_cast<AnyPointer>(buffer), &charCount, &byteCount)))
3089  {
3090  length = byteCount / sizeof(otext);
3091  }
3092 
3093  return MakeString(static_cast<const otext *>(buffer), static_cast<int>(length));
3094 
3095 }
3096 
3097 template<>
3098 inline Raw Lob<Raw, LobBinary>::Read(unsigned int length)
3099 {
3100  ManagedBuffer<unsigned char> buffer(length + 1);
3101 
3102  length = Check(OCI_LobRead(*this, static_cast<AnyPointer>(buffer), length));
3103 
3104  return MakeRaw(buffer, length);
3105 }
3106 
3107 template<class T, int U>
3108 unsigned int Lob<T, U>::Write(const T& content)
3109 {
3110  unsigned int res = 0;
3111 
3112  if (content.size() > 0)
3113  {
3114  unsigned int charCount = 0;
3115  unsigned int byteCount = static_cast<unsigned int>(content.size() * sizeof(typename T::value_type));
3116  AnyPointer buffer = static_cast<AnyPointer>(const_cast<typename T::value_type *>(&content[0]));
3117 
3118  if (Check(OCI_LobWrite2(*this, buffer, &charCount, &byteCount)))
3119  {
3120  res = U == LobBinary ? byteCount : charCount;
3121  }
3122  }
3123 
3124  return res;
3125 }
3126 
3127 template<class T, int U>
3128 void Lob<T, U>::Append(const Lob& other)
3129 {
3130  Check(OCI_LobAppendLob(*this, other));
3131 }
3132 
3133 template<class T, int U>
3134 unsigned int Lob<T, U>::Append(const T& content)
3135 {
3136  unsigned int res = 0;
3137 
3138  if (content.size() > 0)
3139  {
3140  Check(OCI_LobAppend(*this, static_cast<AnyPointer>(const_cast<typename T::value_type *>(&content[0])), static_cast<unsigned int>(content.size())));
3141  }
3142 
3143  return res;
3144 }
3145 
3146 template<class T, int U>
3147 bool Lob<T, U>::Seek(SeekMode seekMode, big_uint offset)
3148 {
3149  return (Check(OCI_LobSeek(*this, offset, seekMode)) == TRUE);
3150 }
3151 
3152 template<class T, int U>
3154 {
3155  Lob result(GetConnection());
3156 
3157  Check(OCI_LobAssign(result, *this));
3158 
3159  return result;
3160 }
3161 
3162 template<class T, int U>
3163 bool Lob<T, U>::Equals(const Lob &other) const
3164 {
3165  return (Check(OCI_LobIsEqual(*this, other)) == TRUE);
3166 }
3167 
3168 template<class T, int U>
3170 {
3171  return LobType(static_cast<LobType::Type>(Check(OCI_LobGetType(*this))));
3172 }
3173 
3174 template<class T, int U>
3175 big_uint Lob<T, U>::GetOffset() const
3176 {
3177  return Check(OCI_LobGetOffset(*this));
3178 }
3179 
3180 template<class T, int U>
3181 big_uint Lob<T, U>::GetLength() const
3182 {
3183  return Check(OCI_LobGetLength(*this));
3184 }
3185 
3186 template<class T, int U>
3187 big_uint Lob<T, U>::GetMaxSize() const
3188 {
3189  return Check(OCI_LobGetMaxSize(*this));
3190 }
3191 
3192 template<class T, int U>
3193 big_uint Lob<T, U>::GetChunkSize() const
3194 {
3195  return Check(OCI_LobGetChunkSize(*this));
3196 }
3197 
3198 template<class T, int U>
3200 {
3201  return Connection(Check(OCI_LobGetConnection(*this)), nullptr);
3202 }
3203 
3204 template<class T, int U>
3205 void Lob<T, U>::Truncate(big_uint length)
3206 {
3207  Check(OCI_LobTruncate(*this, length));
3208 }
3209 
3210 template<class T, int U>
3211 big_uint Lob<T, U>::Erase(big_uint offset, big_uint length)
3212 {
3213  return Check(OCI_LobErase(*this, offset, length));
3214 }
3215 
3216 template<class T, int U>
3217 void Lob<T, U>::Copy(Lob &dest, big_uint offset, big_uint offsetDest, big_uint size) const
3218 {
3219  Check(OCI_LobCopy(dest, *this, offsetDest, offset, size));
3220 }
3221 
3222 template<class T, int U>
3224 {
3225  return (Check(OCI_LobIsTemporary(*this)) == TRUE);
3226 }
3227 
3228 template<class T, int U>
3230 {
3231  return (Check(OCI_LobIsRemote(*this)) == TRUE);
3232 }
3233 
3234 template<class T, int U>
3236 {
3237  Check(OCI_LobOpen(*this, mode));
3238 }
3239 
3240 template<class T, int U>
3242 {
3243  Check(OCI_LobFlush(*this));
3244 }
3245 
3246 template<class T, int U>
3248 {
3249  Check(OCI_LobClose(*this));
3250 }
3251 
3252 template<class T, int U>
3254 {
3255  Check(OCI_LobEnableBuffering(*this, value));
3256 }
3257 
3258 template<class T, int U>
3260 {
3261  Append(other);
3262  return *this;
3263 }
3264 
3265 template<class T, int U>
3266 bool Lob<T, U>::operator == (const Lob<T, U>& other) const
3267 {
3268  return Equals(other);
3269 }
3270 
3271 template<class T, int U>
3272 bool Lob<T, U>::operator != (const Lob<T, U>& other) const
3273 {
3274  return !(*this == other);
3275 }
3276 
3277 /* --------------------------------------------------------------------------------------------- *
3278  * File
3279  * --------------------------------------------------------------------------------------------- */
3280 
3281 inline File::File()
3282 {
3283 }
3284 
3285 inline File::File(const Connection &connection)
3286 {
3287  Acquire(Check(OCI_FileCreate(connection, OCI_BFILE)), reinterpret_cast<HandleFreeFunc>(OCI_FileFree), nullptr, connection.GetHandle());
3288 }
3289 
3290 inline File::File(const Connection &connection, const ostring& directory, const ostring& name)
3291 {
3292  Acquire(Check(OCI_FileCreate(connection, OCI_BFILE)), reinterpret_cast<HandleFreeFunc>(OCI_FileFree), nullptr, connection.GetHandle());
3293 
3294  SetInfos(directory, name);
3295 }
3296 
3297 inline File::File(OCI_File *pFile, Handle *parent)
3298 {
3299  Acquire(pFile, nullptr, nullptr, parent);
3300 }
3301 
3302 inline Raw File::Read(unsigned int size)
3303 {
3304  ManagedBuffer<unsigned char> buffer(size + 1);
3305 
3306  size = Check(OCI_FileRead(*this, static_cast<AnyPointer>(buffer), size));
3307 
3308  return MakeRaw(buffer, size);
3309 }
3310 
3311 inline bool File::Seek(SeekMode seekMode, big_uint offset)
3312 {
3313  return (Check(OCI_FileSeek(*this, offset, seekMode)) == TRUE);
3314 }
3315 
3316 inline File File::Clone() const
3317 {
3318  File result(GetConnection());
3319 
3320  Check(OCI_FileAssign(result, *this));
3321 
3322  return result;
3323 }
3324 
3325 inline bool File::Equals(const File &other) const
3326 {
3327  return (Check(OCI_FileIsEqual(*this, other)) == TRUE);
3328 }
3329 
3330 inline big_uint File::GetOffset() const
3331 {
3332  return Check(OCI_FileGetOffset(*this));
3333 }
3334 
3335 inline big_uint File::GetLength() const
3336 {
3337  return Check(OCI_FileGetSize(*this));
3338 }
3339 
3341 {
3342  return Connection(Check(OCI_FileGetConnection(*this)), nullptr);
3343 }
3344 
3345 inline bool File::Exists() const
3346 {
3347  return (Check(OCI_FileExists(*this)) == TRUE);
3348 }
3349 
3350 inline void File::SetInfos(const ostring& directory, const ostring& name)
3351 {
3352  Check(OCI_FileSetName(*this, directory.c_str(), name.c_str()));
3353 }
3354 
3355 inline ostring File::GetName() const
3356 {
3357  return MakeString(Check(OCI_FileGetName(*this)));
3358 }
3359 
3360 inline ostring File::GetDirectory() const
3361 {
3362  return MakeString(Check(OCI_FileGetDirectory(*this)));
3363 }
3364 
3365 inline void File::Open()
3366 {
3367  Check(OCI_FileOpen(*this));
3368 }
3369 
3370 inline bool File::IsOpened() const
3371 {
3372  return (Check(OCI_FileIsOpen(*this)) == TRUE);
3373 }
3374 
3375 inline void File::Close()
3376 {
3377  Check(OCI_FileClose(*this));
3378 }
3379 
3380 inline bool File::operator == (const File& other) const
3381 {
3382  return Equals(other);
3383 }
3384 
3385 inline bool File::operator != (const File& other) const
3386 {
3387  return (!(*this == other));
3388 }
3389 
3390 /* --------------------------------------------------------------------------------------------- *
3391  * TypeInfo
3392  * --------------------------------------------------------------------------------------------- */
3393 
3394 inline TypeInfo::TypeInfo(const Connection &connection, const ostring& name, TypeInfoType type)
3395 {
3396  Acquire(Check(OCI_TypeInfoGet(connection, name.c_str(), type)), static_cast<HandleFreeFunc>(nullptr), nullptr, connection.GetHandle());
3397 }
3398 
3399 inline TypeInfo::TypeInfo(OCI_TypeInfo *pTypeInfo)
3400 {
3401  Acquire(pTypeInfo, nullptr, nullptr, nullptr);
3402 }
3403 
3405 {
3406  return TypeInfoType(static_cast<TypeInfoType::Type>(Check(OCI_TypeInfoGetType(*this))));
3407 }
3408 
3409 inline ostring TypeInfo::GetName() const
3410 {
3411  return Check(OCI_TypeInfoGetName(*this));
3412 }
3413 
3415 {
3416  return Connection(Check(OCI_TypeInfoGetConnection(*this)), nullptr);
3417 }
3418 
3419 inline unsigned int TypeInfo::GetColumnCount() const
3420 {
3421  return Check(OCI_TypeInfoGetColumnCount(*this));
3422 }
3423 
3424 inline Column TypeInfo::GetColumn(unsigned int index) const
3425 {
3426  return Column(Check(OCI_TypeInfoGetColumn(*this, index)), GetHandle());
3427 }
3428 
3429 inline boolean TypeInfo::IsFinalType() const
3430 {
3431  return (Check(OCI_TypeInfoIsFinalType(*this)) == TRUE);
3432 }
3433 
3435 {
3436  return TypeInfo(Check(OCI_TypeInfoGetSuperType(*this)));
3437 }
3438 
3439 /* --------------------------------------------------------------------------------------------- *
3440  * Object
3441  * --------------------------------------------------------------------------------------------- */
3442 
3444 {
3445 }
3446 
3447 inline Object::Object(const TypeInfo &typeInfo)
3448 {
3449  Connection connection = typeInfo.GetConnection();
3450  Acquire(Check(OCI_ObjectCreate(connection, typeInfo)), reinterpret_cast<HandleFreeFunc>(OCI_ObjectFree), nullptr, connection.GetHandle());
3451 }
3452 
3453 inline Object::Object(OCI_Object *pObject, Handle *parent)
3454 {
3455  Acquire(pObject, nullptr, nullptr, parent);
3456 }
3457 
3458 inline Object Object::Clone() const
3459 {
3460  Object result(GetTypeInfo());
3461 
3462  Check(OCI_ObjectAssign(result, *this));
3463 
3464  return result;
3465 }
3466 
3467 inline bool Object::IsAttributeNull(const ostring& name) const
3468 {
3469  return (Check(OCI_ObjectIsNull(*this, name.c_str())) == TRUE);
3470 }
3471 
3472 inline void Object::SetAttributeNull(const ostring& name)
3473 {
3474  Check(OCI_ObjectSetNull(*this, name.c_str()));
3475 }
3476 
3478 {
3479  return TypeInfo(Check(OCI_ObjectGetTypeInfo(*this)));
3480 }
3481 
3482 inline Reference Object::GetReference() const
3483 {
3484  TypeInfo typeInfo = GetTypeInfo();
3485  Connection connection = typeInfo.GetConnection();
3486 
3487  OCI_Ref *pRef = OCI_RefCreate(connection, typeInfo);
3488 
3489  Check(OCI_ObjectGetSelfRef(*this, pRef));
3490 
3491  return Reference(pRef, GetHandle());
3492 }
3493 
3495 {
3496  return ObjectType(static_cast<ObjectType::Type>(Check(OCI_ObjectGetType(*this))));
3497 }
3498 
3499 template<>
3500 inline bool Object::Get<bool>(const ostring& name) const
3501 {
3502  return (Check(OCI_ObjectGetBoolean(*this, name.c_str())) == TRUE);
3503 }
3504 
3505 template<>
3506 inline short Object::Get<short>(const ostring& name) const
3507 {
3508  return Check(OCI_ObjectGetShort(*this, name.c_str()));
3509 }
3510 
3511 template<>
3512 inline unsigned short Object::Get<unsigned short>(const ostring& name) const
3513 {
3514  return Check(OCI_ObjectGetUnsignedShort(*this, name.c_str()));
3515 }
3516 
3517 template<>
3518 inline int Object::Get<int>(const ostring& name) const
3519 {
3520  return Check(OCI_ObjectGetInt(*this, name.c_str()));
3521 }
3522 
3523 template<>
3524 inline unsigned int Object::Get<unsigned int>(const ostring& name) const
3525 {
3526  return Check(OCI_ObjectGetUnsignedInt(*this, name.c_str()));
3527 }
3528 
3529 template<>
3530 inline big_int Object::Get<big_int>(const ostring& name) const
3531 {
3532  return Check(OCI_ObjectGetBigInt(*this, name.c_str()));
3533 }
3534 
3535 template<>
3536 inline big_uint Object::Get<big_uint>(const ostring& name) const
3537 {
3538  return Check(OCI_ObjectGetUnsignedBigInt(*this, name.c_str()));
3539 }
3540 
3541 template<>
3542 inline float Object::Get<float>(const ostring& name) const
3543 {
3544  return Check(OCI_ObjectGetFloat(*this, name.c_str()));
3545 }
3546 
3547 template<>
3548 inline double Object::Get<double>(const ostring& name) const
3549 {
3550  return Check(OCI_ObjectGetDouble(*this, name.c_str()));
3551 }
3552 
3553 template<>
3554 inline Number Object::Get<Number>(const ostring& name) const
3555 {
3556  return Number(Check(OCI_ObjectGetNumber(*this, name.c_str())), GetHandle());
3557 }
3558 
3559 template<>
3560 inline ostring Object::Get<ostring>(const ostring& name) const
3561 {
3562  return MakeString(Check(OCI_ObjectGetString(*this,name.c_str())));
3563 }
3564 
3565 template<>
3566 inline Date Object::Get<Date>(const ostring& name) const
3567 {
3568  return Date(Check(OCI_ObjectGetDate(*this,name.c_str())), GetHandle());
3569 }
3570 
3571 template<>
3572 inline Timestamp Object::Get<Timestamp>(const ostring& name) const
3573 {
3574  return Timestamp(Check(OCI_ObjectGetTimestamp(*this,name.c_str())), GetHandle());
3575 }
3576 
3577 template<>
3578 inline Interval Object::Get<Interval>(const ostring& name) const
3579 {
3580  return Interval(Check(OCI_ObjectGetInterval(*this,name.c_str())), GetHandle());
3581 }
3582 
3583 template<>
3584 inline Object Object::Get<Object>(const ostring& name) const
3585 {
3586  return Object(Check(OCI_ObjectGetObject(*this,name.c_str())), GetHandle());
3587 }
3588 
3589 template<>
3590 inline Reference Object::Get<Reference>(const ostring& name) const
3591 {
3592  return Reference(Check(OCI_ObjectGetRef(*this,name.c_str())), GetHandle());
3593 }
3594 
3595 template<>
3596 inline Clob Object::Get<Clob>(const ostring& name) const
3597 {
3598  return Clob(Check(OCI_ObjectGetLob(*this,name.c_str())), GetHandle());
3599 }
3600 
3601 template<>
3602 inline NClob Object::Get<NClob>(const ostring& name) const
3603 {
3604  return NClob(Check(OCI_ObjectGetLob(*this, name.c_str())), GetHandle());
3605 }
3606 
3607 template<>
3608 inline Blob Object::Get<Blob>(const ostring& name) const
3609 {
3610  return Blob(Check(OCI_ObjectGetLob(*this,name.c_str())), GetHandle());
3611 }
3612 
3613 template<>
3614 inline File Object::Get<File>(const ostring& name) const
3615 {
3616  return File(Check(OCI_ObjectGetFile(*this,name.c_str())), GetHandle());
3617 }
3618 
3619 template<>
3620 inline Raw Object::Get<Raw>(const ostring& name) const
3621 {
3622  unsigned int size = Check(OCI_ObjectGetRawSize(*this, name.c_str()));
3623 
3624  ManagedBuffer<unsigned char> buffer(size + 1);
3625 
3626  size = static_cast<unsigned int>(Check(OCI_ObjectGetRaw(*this, name.c_str(), static_cast<AnyPointer>(buffer), size)));
3627 
3628  return MakeRaw(buffer, size);
3629 }
3630 
3631 template<class T>
3632 T Object::Get(const ostring& name) const
3633 {
3634  return T(Check(OCI_ObjectGetColl(*this, name.c_str())), GetHandle());
3635 }
3636 
3637 template<>
3638 inline void Object::Set<bool>(const ostring& name, const bool &value)
3639 {
3640  Check(OCI_ObjectSetBoolean(*this, name.c_str(), static_cast<boolean>(value)));
3641 }
3642 
3643 template<>
3644 inline void Object::Set<short>(const ostring& name, const short &value)
3645 {
3646  Check(OCI_ObjectSetShort(*this, name.c_str(), value));
3647 }
3648 
3649 template<>
3650 inline void Object::Set<unsigned short>(const ostring& name, const unsigned short &value)
3651 {
3652  Check(OCI_ObjectSetUnsignedShort(*this, name.c_str(), value));
3653 }
3654 
3655 template<>
3656 inline void Object::Set<int>(const ostring& name, const int &value)
3657 {
3658  Check(OCI_ObjectSetInt(*this, name.c_str(), value));
3659 }
3660 
3661 template<>
3662 inline void Object::Set<unsigned int>(const ostring& name, const unsigned int &value)
3663 {
3664  Check(OCI_ObjectSetUnsignedInt(*this, name.c_str(), value));
3665 }
3666 
3667 template<>
3668 inline void Object::Set<big_int>(const ostring& name, const big_int &value)
3669 {
3670  Check(OCI_ObjectSetBigInt(*this, name.c_str(), value));
3671 }
3672 
3673 template<>
3674 inline void Object::Set<big_uint>(const ostring& name, const big_uint &value)
3675 {
3676  Check(OCI_ObjectSetUnsignedBigInt(*this, name.c_str(), value));
3677 }
3678 
3679 template<>
3680 inline void Object::Set<float>(const ostring& name, const float &value)
3681 {
3682  Check(OCI_ObjectSetFloat(*this, name.c_str(), value));
3683 }
3684 
3685 template<>
3686 inline void Object::Set<double>(const ostring& name, const double &value)
3687 {
3688  Check(OCI_ObjectSetDouble(*this, name.c_str(), value));
3689 }
3690 
3691 template<>
3692 inline void Object::Set<Number>(const ostring& name, const Number &value)
3693 {
3694  Check(OCI_ObjectSetNumber(*this, name.c_str(), value));
3695 }
3696 
3697 template<>
3698 inline void Object::Set<ostring>(const ostring& name, const ostring &value)
3699 {
3700  Check(OCI_ObjectSetString(*this, name.c_str(), value.c_str()));
3701 }
3702 
3703 template<>
3704 inline void Object::Set<Date>(const ostring& name, const Date &value)
3705 {
3706  Check(OCI_ObjectSetDate(*this, name.c_str(), value));
3707 }
3708 
3709 template<>
3710 inline void Object::Set<Timestamp>(const ostring& name, const Timestamp &value)
3711 {
3712  Check(OCI_ObjectSetTimestamp(*this, name.c_str(), value));
3713 }
3714 
3715 template<>
3716 inline void Object::Set<Interval>(const ostring& name, const Interval &value)
3717 {
3718  Check(OCI_ObjectSetInterval(*this, name.c_str(), value));
3719 }
3720 
3721 template<>
3722 inline void Object::Set<Object>(const ostring& name, const Object &value)
3723 {
3724  Check(OCI_ObjectSetObject(*this, name.c_str(), value));
3725 }
3726 
3727 template<>
3728 inline void Object::Set<Reference>(const ostring& name, const Reference &value)
3729 {
3730  Check(OCI_ObjectSetRef(*this, name.c_str(), value));
3731 }
3732 
3733 template<>
3734 inline void Object::Set<Clob>(const ostring& name, const Clob &value)
3735 {
3736  Check(OCI_ObjectSetLob(*this, name.c_str(), value));
3737 }
3738 
3739 template<>
3740 inline void Object::Set<NClob>(const ostring& name, const NClob &value)
3741 {
3742  Check(OCI_ObjectSetLob(*this, name.c_str(), value));
3743 }
3744 
3745 template<>
3746 inline void Object::Set<Blob>(const ostring& name, const Blob &value)
3747 {
3748  Check(OCI_ObjectSetLob(*this, name.c_str(), value));
3749 }
3750 
3751 template<>
3752 inline void Object::Set<File>(const ostring& name, const File &value)
3753 {
3754  Check(OCI_ObjectSetFile(*this, name.c_str(), value));
3755 }
3756 
3757 template<>
3758 inline void Object::Set<Raw>(const ostring& name, const Raw &value)
3759 {
3760  if (value.size() > 0)
3761  {
3762  Check(OCI_ObjectSetRaw(*this, name.c_str(), static_cast<AnyPointer>(const_cast<Raw::value_type *>(&value[0])), static_cast<unsigned int>(value.size())));
3763  }
3764  else
3765  {
3766  Check(OCI_ObjectSetRaw(*this, name.c_str(), nullptr, 0));
3767  }
3768 }
3769 
3770 template<class T>
3771 void Object::Set(const ostring& name, const T &value)
3772 {
3773  Check(OCI_ObjectSetColl(*this, name.c_str(), value));
3774 }
3775 
3776 inline ostring Object::ToString() const
3777 {
3778  if (!IsNull())
3779  {
3780  unsigned int len = 0;
3781 
3782  Check(OCI_ObjectToText(*this, &len, nullptr));
3783 
3784  ManagedBuffer<otext> buffer(len + 1);
3785 
3786  Check(OCI_ObjectToText(*this, &len, buffer));
3787 
3788  return MakeString(static_cast<const otext *>(buffer), static_cast<int>(len));
3789  }
3790 
3791  return OCI_STRING_NULL;
3792 }
3793 
3794 /* --------------------------------------------------------------------------------------------- *
3795  * Reference
3796  * --------------------------------------------------------------------------------------------- */
3797 
3799 {
3800 }
3801 
3802 inline Reference::Reference(const TypeInfo &typeInfo)
3803 {
3804  Connection connection = typeInfo.GetConnection();
3805  Acquire(Check(OCI_RefCreate(connection, typeInfo)), reinterpret_cast<HandleFreeFunc>(OCI_RefFree), nullptr, connection.GetHandle());
3806 }
3807 
3808 inline Reference::Reference(OCI_Ref *pRef, Handle *parent)
3809 {
3810  Acquire(pRef, nullptr, nullptr, parent);
3811 }
3812 
3814 {
3815  return TypeInfo(Check(OCI_RefGetTypeInfo(*this)));
3816 }
3817 
3818 inline Object Reference::GetObject() const
3819 {
3820  return Object(Check(OCI_RefGetObject(*this)), GetHandle());
3821 }
3822 
3823 inline Reference Reference::Clone() const
3824 {
3825  Reference result(GetTypeInfo());
3826 
3827  Check(OCI_RefAssign(result, *this));
3828 
3829  return result;
3830 }
3831 
3832 inline bool Reference::IsReferenceNull() const
3833 {
3834  return (Check(OCI_RefIsNull(*this)) == TRUE);
3835 }
3836 
3838 {
3839  Check(OCI_RefSetNull(*this));
3840 }
3841 
3842 inline ostring Reference::ToString() const
3843 {
3844  if (!IsNull())
3845  {
3846  unsigned int size = Check(OCI_RefGetHexSize(*this));
3847 
3848  ManagedBuffer<otext> buffer(size + 1);
3849 
3850  Check(OCI_RefToText(*this, size, buffer));
3851 
3852  return MakeString(static_cast<const otext *>(buffer), static_cast<int>(size));
3853  }
3854 
3855  return OCI_STRING_NULL;
3856 }
3857 
3858 /* --------------------------------------------------------------------------------------------- *
3859  * Collection
3860  * --------------------------------------------------------------------------------------------- */
3861 
3862 template<class T>
3864 {
3865 }
3866 
3867 template<class T>
3869 {
3870  Acquire(Check(OCI_CollCreate(typeInfo)), reinterpret_cast<HandleFreeFunc>(OCI_CollFree), nullptr, typeInfo.GetConnection().GetHandle());
3871 }
3872 
3873 template<class T>
3874 Collection<T>::Collection(OCI_Coll *pColl, Handle *parent)
3875 {
3876  Acquire(pColl, nullptr, nullptr, parent);
3877 }
3878 
3879 template<class T>
3881 {
3882  Collection<T> result(GetTypeInfo());
3883 
3884  Check(OCI_CollAssign(result, *this));
3885 
3886  return result;
3887 }
3888 
3889 template<class T>
3891 {
3892  return TypeInfo(Check(OCI_CollGetTypeInfo(*this)));
3893 }
3894 
3895 template<class T>
3897 {
3898  return CollectionType(Check(OCI_CollGetType(*this)));
3899 }
3900 
3901 template<class T>
3902 unsigned int Collection<T>::GetMax() const
3903 {
3904  return Check(OCI_CollGetMax(*this));
3905 }
3906 
3907 template<class T>
3908 unsigned int Collection<T>::GetSize() const
3909 
3910 {
3911  return Check(OCI_CollGetSize(*this));
3912 }
3913 
3914 template<class T>
3915 unsigned int Collection<T>::GetCount() const
3916 
3917 {
3918  return Check(OCI_CollGetCount(*this));
3919 }
3920 
3921 template<class T>
3922 void Collection<T>::Truncate(unsigned int size)
3923 {
3924  Check(OCI_CollTrim(*this, size));
3925 }
3926 
3927 template<class T>
3929 {
3930  Check(OCI_CollClear(*this));
3931 }
3932 
3933 template<class T>
3934 bool Collection<T>::IsElementNull(unsigned int index) const
3935 {
3936  return (Check(OCI_ElemIsNull(Check(OCI_CollGetElem(*this, index)))) == TRUE);
3937 }
3938 
3939 template<class T>
3940 void Collection<T>::SetElementNull(unsigned int index)
3941 {
3942  Check(OCI_ElemSetNull(Check(OCI_CollGetElem(*this, index))));
3943 }
3944 
3945 template<class T>
3946 bool Collection<T>::Delete(unsigned int index) const
3947 {
3948  return (Check(OCI_CollDeleteElem(*this, index)) == TRUE);
3949 }
3950 
3951 template<class T>
3953 {
3954  return iterator(this, 1);
3955 }
3956 
3957 template<class T>
3959 {
3960  return const_iterator(const_cast<Collection*>(this), 1);
3961 }
3962 
3963 template<class T>
3965 {
3966  return iterator(const_cast<Collection*>(this), GetCount() + 1);
3967 }
3968 
3969 template<class T>
3971 {
3972  return const_iterator(const_cast<Collection*>(this), GetCount() + 1);
3973 }
3974 
3975 template<class T>
3976 T Collection<T>::Get(unsigned int index) const
3977 {
3978  return GetElem(Check(OCI_CollGetElem(*this, index)), GetHandle());
3979 }
3980 
3981 template<class T>
3982 void Collection<T>::Set(unsigned int index, const T &data)
3983 {
3984  OCI_Elem * elem = Check(OCI_CollGetElem(*this, index));
3985 
3986  SetElem(elem, data);
3987 
3988  Check(OCI_CollSetElem(*this, index, elem));
3989 }
3990 
3991 template<class T>
3992 void Collection<T>::Append(const T &value)
3993 {
3995 
3996  SetElem(elem, value);
3997 
3998  Check(OCI_CollAppend(*this, elem));
3999  Check(OCI_ElemFree(elem));
4000 }
4001 
4002 template<>
4003 inline bool Collection<bool>::GetElem(OCI_Elem *elem, Handle *parent)
4004 {
4005  ARG_NOT_USED(parent);
4006 
4007  return (Check(OCI_ElemGetBoolean(elem)) == TRUE);
4008 }
4009 
4010 template<>
4011 inline short Collection<short>::GetElem(OCI_Elem *elem, Handle *parent)
4012 {
4013  ARG_NOT_USED(parent);
4014 
4015  return Check(OCI_ElemGetShort(elem));
4016 }
4017 
4018 template<>
4019 inline unsigned short Collection<unsigned short>::GetElem(OCI_Elem *elem, Handle *parent)
4020 {
4021  ARG_NOT_USED(parent);
4022 
4023  return Check(OCI_ElemGetUnsignedShort(elem));
4024 }
4025 
4026 template<>
4027 inline int Collection<int>::GetElem(OCI_Elem *elem, Handle *parent)
4028 {
4029  ARG_NOT_USED(parent);
4030 
4031  return Check(OCI_ElemGetInt(elem));
4032 }
4033 
4034 template<>
4035 inline unsigned int Collection<unsigned int>::GetElem(OCI_Elem *elem, Handle *parent)
4036 {
4037  ARG_NOT_USED(parent);
4038 
4039  return Check(OCI_ElemGetUnsignedInt(elem));
4040 }
4041 
4042 template<>
4043 inline big_int Collection<big_int>::GetElem(OCI_Elem *elem, Handle *parent)
4044 {
4045  ARG_NOT_USED(parent);
4046 
4047  return Check(OCI_ElemGetBigInt(elem));
4048 }
4049 
4050 template<>
4051 inline big_uint Collection<big_uint>::GetElem(OCI_Elem *elem, Handle *parent)
4052 {
4053  ARG_NOT_USED(parent);
4054 
4055  return Check(OCI_ElemGetUnsignedBigInt(elem));
4056 }
4057 
4058 template<>
4059 inline float Collection<float>::GetElem(OCI_Elem *elem, Handle *parent)
4060 {
4061  ARG_NOT_USED(parent);
4062 
4063  return Check(OCI_ElemGetFloat(elem));
4064 }
4065 
4066 template<>
4067 inline double Collection<double>::GetElem(OCI_Elem *elem, Handle *parent)
4068 {
4069  ARG_NOT_USED(parent);
4070 
4071  return Check(OCI_ElemGetDouble(elem));
4072 }
4073 
4074 template<>
4075 inline Number Collection<Number>::GetElem(OCI_Elem *elem, Handle *parent)
4076 {
4077  return Number(Check(OCI_ElemGetNumber(elem)), parent);
4078 }
4079 
4080 template<>
4081 inline ostring Collection<ostring>::GetElem(OCI_Elem *elem, Handle *parent)
4082 {
4083  ARG_NOT_USED(parent);
4084 
4085  return MakeString(Check(OCI_ElemGetString(elem)));
4086 }
4087 
4088 template<>
4089 inline Raw Collection<Raw>::GetElem(OCI_Elem *elem, Handle *parent)
4090 {
4091  ARG_NOT_USED(parent);
4092 
4093  unsigned int size = Check(OCI_ElemGetRawSize(elem));
4094 
4095  ManagedBuffer<unsigned char> buffer(size + 1);
4096 
4097  size = Check(OCI_ElemGetRaw(elem, static_cast<AnyPointer>(buffer), size));
4098 
4099  return MakeRaw(buffer, size);
4100 }
4101 
4102 template<>
4103 inline Date Collection<Date>::GetElem(OCI_Elem *elem, Handle *parent)
4104 {
4105  return Date(Check(OCI_ElemGetDate(elem)), parent);
4106 }
4107 
4108 template<>
4109 inline Timestamp Collection<Timestamp>::GetElem(OCI_Elem *elem, Handle *parent)
4110 {
4111  return Timestamp(Check(OCI_ElemGetTimestamp(elem)), parent);
4112 }
4113 
4114 template<>
4115 inline Interval Collection<Interval>::GetElem(OCI_Elem *elem, Handle *parent)
4116 {
4117  return Interval(Check(OCI_ElemGetInterval(elem)), parent);
4118 }
4119 
4120 template<>
4121 inline Object Collection<Object>::GetElem(OCI_Elem *elem, Handle *parent)
4122 {
4123  return Object(Check(OCI_ElemGetObject(elem)), parent);
4124 }
4125 
4126 template<>
4127 inline Reference Collection<Reference>::GetElem(OCI_Elem *elem, Handle *parent)
4128 {
4129  return Reference(Check(OCI_ElemGetRef(elem)), parent);
4130 }
4131 
4132 template<>
4133 inline Clob Collection<Clob>::GetElem(OCI_Elem *elem, Handle *parent)
4134 {
4135  return Clob(Check(OCI_ElemGetLob(elem)), parent);
4136 }
4137 
4138 template<>
4139 inline NClob Collection<NClob>::GetElem(OCI_Elem *elem, Handle *parent)
4140 {
4141  return NClob(Check(OCI_ElemGetLob(elem)), parent);
4142 }
4143 template<>
4144 inline Blob Collection<Blob>::GetElem(OCI_Elem *elem, Handle *parent)
4145 {
4146  return Blob(Check(OCI_ElemGetLob(elem)), parent);
4147 }
4148 
4149 template<>
4150 inline File Collection<File>::GetElem(OCI_Elem *elem, Handle *parent)
4151 {
4152  return File(Check(OCI_ElemGetFile(elem)), parent);
4153 }
4154 
4155 template<class T>
4156  T Collection<T>::GetElem(OCI_Elem *elem, Handle *parent)
4157 {
4158  return T(Check(OCI_ElemGetColl(elem)), parent);
4159 }
4160 
4161 template<>
4162 inline void Collection<bool>::SetElem(OCI_Elem *elem, const bool &value)
4163 {
4164  Check(OCI_ElemSetBoolean(elem, static_cast<boolean>(value)));
4165 }
4166 
4167 template<>
4168 inline void Collection<short>::SetElem(OCI_Elem *elem, const short &value)
4169 {
4170  Check(OCI_ElemSetShort(elem, value));
4171 }
4172 
4173 template<>
4174 inline void Collection<unsigned short>::SetElem(OCI_Elem *elem, const unsigned short &value)
4175 {
4176  Check(OCI_ElemSetUnsignedShort(elem, value));
4177 }
4178 
4179 template<>
4180 inline void Collection<int>::SetElem(OCI_Elem *elem, const int &value)
4181 {
4182  Check(OCI_ElemSetInt(elem, value));
4183 }
4184 
4185 template<>
4186 inline void Collection<unsigned int>::SetElem(OCI_Elem *elem, const unsigned int &value)
4187 {
4188  Check(OCI_ElemSetUnsignedInt(elem, value));
4189 }
4190 
4191 template<>
4192 inline void Collection<big_int>::SetElem(OCI_Elem *elem, const big_int &value)
4193 {
4194  Check(OCI_ElemSetBigInt(elem, value));
4195 }
4196 
4197 template<>
4198 inline void Collection<big_uint>::SetElem(OCI_Elem *elem, const big_uint &value)
4199 {
4200  Check(OCI_ElemSetUnsignedBigInt(elem, value));
4201 }
4202 
4203 template<>
4204 inline void Collection<float>::SetElem(OCI_Elem *elem, const float &value)
4205 {
4206  Check(OCI_ElemSetFloat(elem, value));
4207 }
4208 
4209 template<>
4210 inline void Collection<double>::SetElem(OCI_Elem *elem, const double &value)
4211 {
4212  Check(OCI_ElemSetDouble(elem, value));
4213 }
4214 
4215 template<>
4216 inline void Collection<Number>::SetElem(OCI_Elem *elem, const Number &value)
4217 {
4218  Check(OCI_ElemSetNumber(elem, value));
4219 }
4220 
4221 template<>
4222 inline void Collection<ostring>::SetElem(OCI_Elem *elem, const ostring& value)
4223 {
4224  Check(OCI_ElemSetString(elem, value.c_str()));
4225 }
4226 
4227 template<>
4228 inline void Collection<Raw>::SetElem(OCI_Elem *elem, const Raw &value)
4229 {
4230  if (value.size() > 0)
4231  {
4232  Check(OCI_ElemSetRaw(elem, static_cast<AnyPointer>(const_cast<Raw::value_type *>(&value[0])), static_cast<unsigned int>(value.size())));
4233  }
4234  else
4235  {
4236  Check(OCI_ElemSetRaw(elem, nullptr, 0));
4237  }
4238 }
4239 
4240 template<>
4241 inline void Collection<Date>::SetElem(OCI_Elem *elem, const Date &value)
4242 {
4243  Check(OCI_ElemSetDate(elem, value));
4244 }
4245 
4246 template<>
4247 inline void Collection<Timestamp>::SetElem(OCI_Elem *elem, const Timestamp &value)
4248 {
4249  Check(OCI_ElemSetTimestamp(elem, value));
4250 }
4251 
4252 template<>
4253 inline void Collection<Interval>::SetElem(OCI_Elem *elem, const Interval &value)
4254 {
4255  Check(OCI_ElemSetInterval(elem, value));
4256 }
4257 
4258 template<>
4259 inline void Collection<Object>::SetElem(OCI_Elem *elem, const Object &value)
4260 {
4261  Check(OCI_ElemSetObject(elem, value));
4262 }
4263 
4264 template<>
4265 inline void Collection<Reference>::SetElem(OCI_Elem *elem, const Reference &value)
4266 {
4267  Check(OCI_ElemSetRef(elem, value));
4268 }
4269 
4270 template<>
4271 inline void Collection<Clob>::SetElem(OCI_Elem *elem, const Clob &value)
4272 {
4273  Check(OCI_ElemSetLob(elem, value));
4274 }
4275 
4276 template<>
4277 inline void Collection<NClob>::SetElem(OCI_Elem *elem, const NClob &value)
4278 {
4279  Check(OCI_ElemSetLob(elem, value));
4280 }
4281 
4282 template<>
4283 inline void Collection<Blob>::SetElem(OCI_Elem *elem, const Blob &value)
4284 {
4285  Check(OCI_ElemSetLob(elem, value));
4286 }
4287 
4288 template<>
4289 inline void Collection<File>::SetElem(OCI_Elem *elem, const File &value)
4290 {
4291  Check(OCI_ElemSetFile(elem, value));
4292 }
4293 
4294 template<class T>
4295 void Collection<T>::SetElem(OCI_Elem *elem, const T &value)
4296 {
4297  Check(OCI_ElemSetColl(elem, value));
4298 }
4299 
4300 template<class T>
4302 {
4303  if (!IsNull())
4304  {
4305  unsigned int len = 0;
4306 
4307  Check(OCI_CollToText(*this, &len, nullptr));
4308 
4309  ManagedBuffer<otext> buffer(len + 1);
4310 
4311  Check(OCI_CollToText(*this, &len, buffer));
4312 
4313  return MakeString(static_cast<const otext *>(buffer), static_cast<int>(len));
4314  }
4315 
4316  return OCI_STRING_NULL;
4317 }
4318 
4319 template<class T>
4321 {
4322  return CollectionElement<T>(this, index);
4323 }
4324 
4325 template<class T>
4326 const CollectionElement<T> Collection<T>::operator [] (unsigned int index) const
4327 {
4328  return CollectionElement<T>(this, index);
4329 }
4330 
4331 template<class T>
4333 {
4334 
4335 }
4336 
4337 template<class T>
4338 CollectionIterator<T>::CollectionIterator(CollectionType *collection, unsigned int pos) : _elem(collection, pos)
4339 {
4340 
4341 }
4342 
4343 template<class T>
4344 CollectionIterator<T>::CollectionIterator(const CollectionIterator& other) : _elem(other._elem)
4345 {
4346 
4347 }
4348 
4349 template<class T>
4351 {
4352  _elem._pos = other._elem._pos;
4353  _elem._coll = other._elem._coll;
4354 
4355  return *this;
4356 }
4357 
4358 template<class T>
4360 {
4361  _elem._pos += static_cast<unsigned int>(value);
4362  return *this;
4363 }
4364 
4365 template<class T>
4367 {
4368  _elem._pos -= static_cast<unsigned int>(value);
4369  return *this;
4370 }
4371 
4372 template<class T>
4374 {
4375  return _elem;
4376 }
4377 
4378 template<class T>
4380 {
4381  return &_elem;
4382 }
4383 
4384 template<class T>
4386 {
4387  --_elem._pos;
4388  return *this;
4389 }
4390 
4391 template<class T>
4393 {
4394  ++*(const_cast<unsigned int*>(&_elem._pos));
4395  return *this;
4396 }
4397 
4398 template<class T>
4400 {
4401  CollectionIterator res(_elem._coll, _elem._pos);
4402  ++(*this);
4403  return res;
4404 }
4405 
4406 template<class T>
4408 {
4409  CollectionIterator res(_elem);
4410  --(*this);
4411  return res;
4412 }
4413 
4414 template<class T>
4416 {
4417  return CollectionIterator(_elem._coll, _elem._pos + static_cast<unsigned int>(value));
4418 }
4419 
4420 template<class T>
4422 {
4423  return CollectionIterator(_elem._coll, _elem._pos - static_cast<unsigned int>(value));
4424 }
4425 
4426 template<class T>
4427 typename CollectionIterator<T>::difference_type CollectionIterator<T>::operator - (const CollectionIterator &value)
4428 {
4429  return static_cast<difference_type>(_elem._pos - value._elem._pos);
4430 }
4431 
4432 template<class T>
4434 {
4435  return _elem._pos == other._elem._pos && (static_cast<OCI_Coll *>(*_elem._coll)) == (static_cast<OCI_Coll *>(*other._elem._coll));
4436 }
4437 
4438 template<class T>
4440 {
4441  return !(*this == other);
4442 }
4443 
4444 template<class T>
4446 {
4447  return _elem._pos > other._elem._pos;
4448 }
4449 
4450 template<class T>
4452 {
4453  return _elem._pos < other._elem._pos;
4454 }
4455 
4456 template<class T>
4458 {
4459  return _elem._pos >= other._elem._pos;
4460 }
4461 
4462 template<class T>
4464 {
4465  return _elem._pos <= other._elem._pos;
4466 }
4467 
4468 template<class T>
4469 CollectionElement<T>::CollectionElement() : _coll(nullptr), _pos(0)
4470 {
4471 
4472 }
4473 
4474 template<class T>
4475 CollectionElement<T>::CollectionElement(CollectionType *coll, unsigned int pos) : _coll(coll), _pos(pos)
4476 {
4477 
4478 }
4479 
4480 template<class T>
4482 {
4483  return _coll->Get(_pos);
4484 }
4485 
4486 template<class T>
4488 {
4489  _coll->Set(_pos, value);
4490  return *this;
4491 }
4492 
4493 template<class T>
4495 {
4496  _coll->Set(_pos, static_cast<T>(other));
4497  return *this;
4498 }
4499 
4500 template<class T>
4501 bool CollectionElement<T>::IsNull() const
4502 {
4503  return _coll->IsElementNull(_pos);
4504 }
4505 
4506 template<class T>
4508 {
4509  _coll->SetElementNull(_pos);
4510 }
4511 
4512 /* --------------------------------------------------------------------------------------------- *
4513  * Long
4514  * --------------------------------------------------------------------------------------------- */
4515 
4516 template<class T, int U>
4518 {
4519 }
4520 
4521 template<class T, int U>
4522 Long<T, U>::Long(const Statement &statement)
4523 {
4524  Acquire(Check(OCI_LongCreate(statement, U)), reinterpret_cast<HandleFreeFunc>(OCI_LongFree), nullptr, statement.GetHandle());
4525 }
4526 
4527 template<class T, int U>
4528 Long<T, U>::Long(OCI_Long *pLong, Handle* parent)
4529 {
4530  Acquire(pLong, nullptr, nullptr, parent);
4531 }
4532 
4533 template<class T, int U>
4534 unsigned int Long<T, U>::Write(const T& content)
4535 {
4536  unsigned int res = 0;
4537 
4538  if (content.size() > 0)
4539  {
4540  res = Check(OCI_LongWrite(*this, static_cast<AnyPointer>(const_cast<typename T::value_type *>(&content[0])), static_cast<unsigned int>(content.size())));
4541  }
4542 
4543  return res;
4544 }
4545 
4546 template<class T, int U>
4547 unsigned int Long<T, U>::GetLength() const
4548 {
4549  return Check(OCI_LongGetSize(*this));
4550 }
4551 
4552 template<>
4553 inline ostring Long<ostring, LongCharacter>::GetContent() const
4554 {
4555  return MakeString(static_cast<const otext *>(Check(OCI_LongGetBuffer(*this))));
4556 }
4557 
4558 template<>
4559 inline Raw Long<Raw, LongBinary>::GetContent() const
4560 {
4561  return MakeRaw(Check(OCI_LongGetBuffer(*this)), GetLength());
4562 }
4563 
4564 /* --------------------------------------------------------------------------------------------- *
4565  * BindObject
4566  * --------------------------------------------------------------------------------------------- */
4567 
4568 inline BindObject::BindObject(const Statement &statement, const ostring& name, unsigned int mode) : _pStatement(statement), _name(name), _mode(mode)
4569 {
4570 }
4571 
4572 inline BindObject::~BindObject()
4573 {
4574 }
4575 
4576 inline ostring BindObject::GetName() const
4577 {
4578  return _name;
4579 }
4580 
4581 inline Statement BindObject::GetStatement() const
4582 {
4583  return Statement(_pStatement);
4584 }
4585 
4586 inline unsigned int BindObject::GetMode() const
4587 {
4588  return _mode;
4589 }
4590 
4591 /* --------------------------------------------------------------------------------------------- *
4592  * BindArray
4593  * --------------------------------------------------------------------------------------------- */
4594 
4595 inline BindArray::BindArray(const Statement &statement, const ostring& name, unsigned int mode) : BindObject(statement, name, mode), _object(nullptr)
4596 {
4597 
4598 }
4599 
4600 template<class T>
4601 void BindArray::SetVector(std::vector<T> & vector, unsigned int elemSize)
4602 {
4603  _object = new BindArrayObject<T>(GetStatement(), GetName(), vector, GetMode(), elemSize);
4604 }
4605 
4606 inline BindArray::~BindArray()
4607 {
4608  delete _object;
4609 }
4610 
4611 template<class T>
4612 typename BindResolver<T>::OutputType * BindArray::GetData() const
4613 {
4614  return static_cast<typename BindResolver<T>::OutputType *>(*(dynamic_cast< BindArrayObject<T> * > (_object)));
4615 }
4616 
4617 inline void BindArray::SetInData()
4618 {
4619  if (GetMode() & OCI_BDM_IN)
4620  {
4621  _object->SetInData();
4622  }
4623 }
4624 
4625 inline void BindArray::SetOutData()
4626 {
4627  if (GetMode() & OCI_BDM_OUT)
4628  {
4629  _object->SetOutData();
4630  }
4631 }
4632 
4633 template<class T>
4634 BindArray::BindArrayObject<T>::BindArrayObject(const Statement &statement, const ostring& name, ObjectVector &vector, unsigned int mode, unsigned int elemSize)
4635  : _pStatement(statement), _name(name), _vector(vector), _data(nullptr), _mode(mode), _elemCount(statement.GetBindArraySize()), _elemSize(elemSize)
4636 {
4637  AllocData();
4638 }
4639 
4640 template<class T>
4641 BindArray::BindArrayObject<T>::~BindArrayObject()
4642 {
4643  FreeData();
4644 }
4645 
4646 template<class T>
4647 void BindArray::BindArrayObject<T>::AllocData()
4648 {
4649  _data = new NativeType[_elemCount];
4650 
4651  memset(_data, 0, sizeof(NativeType) * _elemCount);
4652 }
4653 
4654 template<>
4655 inline void BindArray::BindArrayObject<ostring>::AllocData()
4656 {
4657  _data = new otext[_elemSize * _elemCount];
4658 
4659  memset(_data, 0, _elemSize * _elemCount * sizeof(otext));
4660 }
4661 
4662 template<>
4663 inline void BindArray::BindArrayObject<Raw> ::AllocData()
4664 {
4665  _data = new unsigned char[_elemSize * _elemCount];
4666 
4667  memset(_data, 0, _elemSize * _elemCount * sizeof(unsigned char));
4668 }
4669 
4670 template<class T>
4671 void BindArray::BindArrayObject<T>::FreeData() const
4672 {
4673  delete [] _data ;
4674 }
4675 
4676 template<class T>
4677 void BindArray::BindArrayObject<T>::SetInData()
4678 {
4679  typename ObjectVector::iterator it, it_end;
4680 
4681  unsigned int index = 0;
4682  unsigned int currElemCount = Check(OCI_BindArrayGetSize(_pStatement));
4683 
4684  for (it = _vector.begin(), it_end = _vector.end(); it != it_end && index < _elemCount && index < currElemCount; ++it, ++index)
4685  {
4686  _data[index] = static_cast<NativeType>(*it);
4687  }
4688 }
4689 
4690 template<>
4691 inline void BindArray::BindArrayObject<ostring>::SetInData()
4692 {
4693  std::vector<ostring>::iterator it, it_end;
4694 
4695  unsigned int index = 0;
4696  unsigned int currElemCount = Check(OCI_BindArrayGetSize(_pStatement));
4697 
4698  for (it = _vector.begin(), it_end = _vector.end(); it != it_end && index < _elemCount && index < currElemCount; ++it, ++index)
4699  {
4700  const ostring & value = *it;
4701 
4702  memcpy( _data + (_elemSize * index), value.c_str(), (value.size() + 1) * sizeof(otext));
4703  }
4704 }
4705 
4706 template<>
4707 inline void BindArray::BindArrayObject<Raw>::SetInData()
4708 {
4709  std::vector<Raw>::iterator it, it_end;
4710 
4711  unsigned int index = 0;
4712  unsigned int currElemCount = Check(OCI_BindArrayGetSize(_pStatement));
4713 
4714  for (it = _vector.begin(), it_end = _vector.end(); it != it_end && index < _elemCount && index < currElemCount; ++it, ++index)
4715  {
4716  Raw & value = *it;
4717 
4718  if (value.size() > 0)
4719  {
4720  memcpy(_data + (_elemSize * index), &value[0], value.size());
4721  }
4722 
4723  OCI_BindSetDataSizeAtPos(OCI_GetBind2(_pStatement, GetName().c_str()), index + 1, static_cast<unsigned int>(value.size()));
4724  }
4725 }
4726 
4727 template<class T>
4728 void BindArray::BindArrayObject<T>::SetOutData()
4729 {
4730  typename ObjectVector::iterator it, it_end;
4731 
4732  unsigned int index = 0;
4733  unsigned int currElemCount = Check(OCI_BindArrayGetSize(_pStatement));
4734 
4735  for (it = _vector.begin(), it_end = _vector.end(); it != it_end && index < _elemCount && index < currElemCount; ++it, ++index)
4736  {
4737  T& object = *it;
4738 
4739  object = static_cast<NativeType>(_data[index]);
4740  }
4741 }
4742 
4743 template<>
4744 inline void BindArray::BindArrayObject<Raw>::SetOutData()
4745 {
4746  std::vector<Raw>::iterator it, it_end;
4747 
4748  OCI_Bind *pBind = Check(OCI_GetBind2(_pStatement, GetName().c_str()));
4749 
4750  unsigned int index = 0;
4751  unsigned int currElemCount = Check(OCI_BindArrayGetSize(_pStatement));
4752 
4753  for (it = _vector.begin(), it_end = _vector.end(); it != it_end && index < _elemCount && index < currElemCount; ++it, ++index)
4754  {
4755  unsigned char *currData = _data + (_elemSize * index);
4756 
4757  (*it).assign(currData, currData + Check(OCI_BindGetDataSizeAtPos(pBind, index + 1)));
4758  }
4759 }
4760 
4761 template<class T>
4762 ostring BindArray::BindArrayObject<T>::GetName()
4763 {
4764  return _name;
4765 }
4766 
4767 template<class T>
4768 BindArray::BindArrayObject<T>::operator ObjectVector & () const
4769 {
4770  return _vector;
4771 }
4772 
4773 template<class T>
4774 BindArray::BindArrayObject<T>::operator NativeType * () const
4775 {
4776  return _data;
4777 }
4778 
4779 /* --------------------------------------------------------------------------------------------- *
4780  * BindObjectAdaptor
4781  * --------------------------------------------------------------------------------------------- */
4782 
4783 template<class T>
4784 void BindObjectAdaptor<T>::SetInData()
4785 {
4786  if (GetMode() & OCI_BDM_IN)
4787  {
4788  size_t size = _object.size();
4789 
4790  if (size > _size)
4791  {
4792  size = _size;
4793  }
4794 
4795  if (size > 0)
4796  {
4797  memcpy(_data, &_object[0], size * sizeof(NativeType));
4798  }
4799 
4800  _data[size] = 0;
4801  }
4802 }
4803 
4804 template<class T>
4805 void BindObjectAdaptor<T>::SetOutData()
4806 {
4807  if (GetMode() & OCI_BDM_OUT)
4808  {
4809  size_t size = Check(OCI_BindGetDataSize(Check(OCI_GetBind2(_pStatement, _name.c_str()))));
4810 
4811  _object.assign(_data, _data + size);
4812  }
4813 }
4814 
4815 template<class T>
4816 BindObjectAdaptor<T>::BindObjectAdaptor(const Statement &statement, const ostring& name, unsigned int mode, ObjectType &object, unsigned int size) :
4817  BindObject(statement, name, mode),
4818  _object(object),
4819  _data(new NativeType[size + 1]),
4820  _size(size)
4821 {
4822  memset(_data, 0, _size * sizeof(NativeType));
4823 }
4824 
4825 template<class T>
4826 BindObjectAdaptor<T>::~BindObjectAdaptor()
4827 {
4828  delete [] _data;
4829 }
4830 
4831 template<class T>
4832 BindObjectAdaptor<T>::operator NativeType *() const
4833 {
4834  return _data;
4835 }
4836 
4837 /* --------------------------------------------------------------------------------------------- *
4838  * BindTypeAdaptor
4839  * --------------------------------------------------------------------------------------------- */
4840 
4841 template<class T>
4842 void BindTypeAdaptor<T>::SetInData()
4843 {
4844  if (GetMode() & OCI_BDM_IN)
4845  {
4846  *_data = static_cast<NativeType>(_object);
4847  }
4848 }
4849 
4850 template<class T>
4851 void BindTypeAdaptor<T>::SetOutData()
4852 {
4853  if (GetMode() & OCI_BDM_OUT)
4854  {
4855  _object = static_cast<T>(*_data);
4856  }
4857 }
4858 
4859 template<class T>
4860 BindTypeAdaptor<T>::BindTypeAdaptor(const Statement &statement, const ostring& name, unsigned int mode, ObjectType &object) :
4861 BindObject(statement, name, mode),
4862 _object(object),
4863 _data(new NativeType)
4864 {
4865 
4866 }
4867 
4868 template<class T>
4869 BindTypeAdaptor<T>::~BindTypeAdaptor()
4870 {
4871  delete _data;
4872 }
4873 
4874 template<class T>
4875 BindTypeAdaptor<T>::operator NativeType *() const
4876 {
4877  return _data;
4878 }
4879 
4880 template<>
4881 inline void BindTypeAdaptor<bool>::SetInData()
4882 {
4883  if (GetMode() & OCI_BDM_IN)
4884  {
4885  *_data = (_object == true);
4886  }
4887 }
4888 
4889 template<>
4890 inline void BindTypeAdaptor<bool>::SetOutData()
4891 {
4892  if (GetMode() & OCI_BDM_OUT)
4893  {
4894  _object = (*_data == TRUE);
4895  }
4896 }
4897 
4898 /* --------------------------------------------------------------------------------------------- *
4899  * BindsHolder
4900  * --------------------------------------------------------------------------------------------- */
4901 
4902 inline BindsHolder::BindsHolder(const Statement &statement) : _bindObjects(), _pStatement(statement)
4903 {
4904 
4905 }
4906 
4907 inline BindsHolder::~BindsHolder()
4908 {
4909  Clear();
4910 }
4911 
4912 inline void BindsHolder::Clear()
4913 {
4914  std::vector<BindObject *>::iterator it, it_end;
4915 
4916  for(it = _bindObjects.begin(), it_end = _bindObjects.end(); it != it_end; ++it)
4917  {
4918  delete (*it);
4919  }
4920 
4921  _bindObjects.clear();
4922 }
4923 
4924 inline void BindsHolder::AddBindObject(BindObject *bindObject)
4925 {
4926  if (Check(OCI_IsRebindingAllowed(_pStatement)))
4927  {
4928  std::vector<BindObject *>::iterator it, it_end;
4929 
4930  for(it = _bindObjects.begin(), it_end = _bindObjects.end(); it != it_end; ++it)
4931  {
4932  if ((*it)->GetName() == bindObject->GetName())
4933  {
4934  _bindObjects.erase(it);
4935  break;
4936  }
4937  }
4938  }
4939 
4940  _bindObjects.push_back(bindObject);
4941 }
4942 
4943 inline void BindsHolder::SetOutData()
4944 {
4945  std::vector<BindObject *>::iterator it, it_end;
4946 
4947  for(it = _bindObjects.begin(), it_end = _bindObjects.end(); it != it_end; ++it)
4948  {
4949  (*it)->SetOutData();
4950  }
4951 }
4952 
4953 inline void BindsHolder::SetInData()
4954 {
4955  std::vector<BindObject *>::iterator it, it_end;
4956 
4957  for(it = _bindObjects.begin(), it_end = _bindObjects.end(); it != it_end; ++it)
4958  {
4959  (*it)->SetInData();
4960  }
4961 }
4962 
4963 /* --------------------------------------------------------------------------------------------- *
4964  * Bind
4965  * --------------------------------------------------------------------------------------------- */
4966 
4967 inline BindInfo::BindInfo(OCI_Bind *pBind, Handle *parent)
4968 {
4969  Acquire(pBind, nullptr, nullptr, parent);
4970 }
4971 
4972 inline ostring BindInfo::GetName() const
4973 {
4974  return MakeString(Check(OCI_BindGetName(*this)));
4975 }
4976 
4978 {
4979  return DataType(static_cast<DataType::Type>(Check(OCI_BindGetType(*this))));
4980 }
4981 
4982 inline unsigned int BindInfo::GetSubType() const
4983 {
4984  return Check(OCI_BindGetSubtype(*this));
4985 }
4986 
4987 inline unsigned int BindInfo::GetDataCount() const
4988 {
4989  return Check(OCI_BindGetDataCount(*this));
4990 }
4991 
4992 inline Statement BindInfo::GetStatement() const
4993 {
4994  return Statement(Check(OCI_BindGetStatement(*this)));
4995 }
4996 
4997 inline void BindInfo::SetDataNull(bool value, unsigned int index)
4998 {
4999  if (value)
5000  {
5001  Check(OCI_BindSetNullAtPos(*this, index));
5002  }
5003  else
5004  {
5005  Check(OCI_BindSetNotNullAtPos(*this, index));
5006  }
5007 }
5008 
5009 inline bool BindInfo::IsDataNull(unsigned int index) const
5010 {
5011  return (Check(OCI_BindIsNullAtPos(*this, index)) == TRUE);
5012 }
5013 
5015 {
5016  Check(OCI_BindSetCharsetForm(*this, value));
5017 }
5018 
5020 {
5021  return BindDirection(static_cast<BindDirection::Type>(Check(OCI_BindGetDirection(*this))));
5022 }
5023 
5024 /* --------------------------------------------------------------------------------------------- *
5025  * Statement
5026  * --------------------------------------------------------------------------------------------- */
5027 
5029 {
5030 }
5031 
5032 inline Statement::Statement(const Connection &connection)
5033 {
5034  Acquire(Check(OCI_StatementCreate(connection)), reinterpret_cast<HandleFreeFunc>(OCI_StatementFree), OnFreeSmartHandle, connection.GetHandle());
5035 }
5036 
5037 inline Statement::Statement(OCI_Statement *stmt, Handle *parent)
5038 {
5039  Acquire(stmt, reinterpret_cast<HandleFreeFunc>(parent ? OCI_StatementFree : nullptr), OnFreeSmartHandle, parent);
5040 }
5041 
5043 {
5044  return Connection(Check(OCI_StatementGetConnection(*this)), nullptr);
5045 }
5046 
5047 inline void Statement::Describe(const ostring& sql)
5048 {
5049  ClearBinds();
5050  ReleaseResultsets();
5051  Check(OCI_Describe(*this, sql.c_str()));
5052 }
5053 
5054 inline void Statement::Parse(const ostring& sql)
5055 {
5056  ClearBinds();
5057  ReleaseResultsets();
5058  Check(OCI_Parse(*this, sql.c_str()));
5059 }
5060 
5061 inline void Statement::Prepare(const ostring& sql)
5062 {
5063  ClearBinds();
5064  ReleaseResultsets();
5065  Check(OCI_Prepare(*this, sql.c_str()));
5066 }
5067 
5069 {
5070  ReleaseResultsets();
5071  SetInData();
5072  Check(OCI_Execute(*this));
5073  SetOutData();
5074 }
5075 
5076 template<class T>
5077 unsigned int Statement::ExecutePrepared(T callback)
5078 {
5079  ExecutePrepared();
5080 
5081  return Fetch(callback);
5082 }
5083 
5084 template<class T, class U>
5085 unsigned int Statement::ExecutePrepared(T callback, U adapter)
5086 {
5087  ExecutePrepared();
5088 
5089  return Fetch(callback, adapter);
5090 }
5091 
5092 inline void Statement::Execute(const ostring& sql)
5093 {
5094  ClearBinds();
5095  ReleaseResultsets();
5096  Check(OCI_ExecuteStmt(*this, sql.c_str()));
5097 }
5098 
5099 template<class T>
5100 unsigned int Statement::Execute(const ostring& sql, T callback)
5101 {
5102  Execute(sql);
5103 
5104  return Fetch(callback);
5105 }
5106 
5107 template<class T, class U>
5108 unsigned int Statement::Execute(const ostring& sql, T callback, U adapter)
5109 {
5110  Execute(sql);
5111 
5112  return Fetch(callback, adapter);
5113 }
5114 
5115 template<typename T>
5116 unsigned int Statement::Fetch(T callback)
5117 {
5118  unsigned int res = 0;
5119 
5120  Resultset rs = GetResultset();
5121 
5122  while (rs)
5123  {
5124  res += rs.ForEach(callback);
5125  rs = GetNextResultset();
5126  }
5127 
5128  return res;
5129 }
5130 
5131 template<class T, class U>
5132 unsigned int Statement::Fetch(T callback, U adapter)
5133 {
5134  unsigned int res = 0;
5135 
5136  Resultset rs = GetResultset();
5137 
5138  while (rs)
5139  {
5140  res += rs.ForEach(callback, adapter);
5141  rs = GetNextResultset();
5142  }
5143 
5144  return res;
5145 }
5146 
5147 inline unsigned int Statement::GetAffectedRows() const
5148 {
5149  return Check(OCI_GetAffectedRows(*this));
5150 }
5151 
5152 inline ostring Statement::GetSql() const
5153 {
5154  return MakeString(Check(OCI_GetSql(*this)));
5155 }
5156 
5157 inline ostring Statement::GetSqlIdentifier() const
5158 {
5159  return MakeString(Check(OCI_GetSqlIdentifier(*this)));
5160 }
5161 
5163 {
5164  return Resultset(Check(OCI_GetResultset(*this)), GetHandle());
5165 }
5166 
5168 {
5169  return Resultset(Check(OCI_GetNextResultset(*this)), GetHandle());
5170 }
5171 
5172 inline void Statement::SetBindArraySize(unsigned int size)
5173 {
5174  Check(OCI_BindArraySetSize(*this, size));
5175 }
5176 
5177 inline unsigned int Statement::GetBindArraySize() const
5178 {
5179  return Check(OCI_BindArrayGetSize(*this));
5180 }
5181 
5182 inline void Statement::AllowRebinding(bool value)
5183 {
5184  Check(OCI_AllowRebinding(*this, value));
5185 }
5186 
5188 {
5189  return (Check(OCI_IsRebindingAllowed(*this)) == TRUE);
5190 }
5191 
5192 inline unsigned int Statement::GetBindIndex(const ostring& name) const
5193 {
5194  return Check(OCI_GetBindIndex(*this, name.c_str()));
5195 }
5196 
5197 inline unsigned int Statement::GetBindCount() const
5198 {
5199  return Check(OCI_GetBindCount(*this));
5200 }
5201 
5202 inline BindInfo Statement::GetBind(unsigned int index) const
5203 {
5204  return BindInfo(Check(OCI_GetBind(*this, index)), GetHandle());
5205 }
5206 
5207 inline BindInfo Statement::GetBind(const ostring& name) const
5208 {
5209  return BindInfo(Check(OCI_GetBind2(*this, name.c_str())), GetHandle());
5210 }
5211 
5212 template<typename M, class T>
5213 void Statement::Bind1(M &method, const ostring& name, T& value, BindInfo::BindDirection mode)
5214 {
5215  Check(method(*this, name.c_str(), &value));
5216  SetLastBindMode(mode);
5217 }
5218 
5219 template<typename M, class T>
5220 void Statement::Bind2(M &method, const ostring& name, T& value, BindInfo::BindDirection mode)
5221 {
5222  Check(method(*this, name.c_str(), static_cast<typename BindResolver<T>::OutputType>(value)));
5223  SetLastBindMode(mode);
5224 }
5225 
5226 template<typename M, class T>
5227 void Statement::BindVector1(M &method, const ostring& name, std::vector<T> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5228 {
5229  BindArray * bnd = new BindArray(*this, name, mode);
5230  bnd->SetVector<T>(values, sizeof(typename BindResolver<T>::OutputType));
5231 
5232  boolean res = method(*this, name.c_str(), bnd->GetData<T>(), GetArraysize(type, values));
5233 
5234  if (res)
5235  {
5236  BindsHolder *bindsHolder = GetBindsHolder(true);
5237  bindsHolder->AddBindObject(bnd);
5238  SetLastBindMode(mode);
5239  }
5240  else
5241  {
5242  delete bnd;
5243  }
5244 
5245  Check(res);
5246 }
5247 
5248 template<typename M, class T, class U>
5249 void Statement::BindVector2(M &method, const ostring& name, std::vector<T> &values, BindInfo::BindDirection mode, U subType, BindInfo::VectorType type)
5250 {
5251  BindArray * bnd = new BindArray(*this, name, mode);
5252  bnd->SetVector<T>(values, sizeof(typename BindResolver<T>::OutputType));
5253 
5254  boolean res = method(*this, name.c_str(), bnd->GetData<T>(), subType, GetArraysize(type, values));
5255 
5256  if (res)
5257  {
5258  BindsHolder *bindsHolder = GetBindsHolder(true);
5259  bindsHolder->AddBindObject(bnd);
5260  SetLastBindMode(mode);
5261  }
5262  else
5263  {
5264  delete bnd;
5265  }
5266 
5267  Check(res);
5268 }
5269 
5270 template<class T>
5271 unsigned int Statement::GetArraysize(BindInfo::VectorType type, std::vector<T> &values)
5272 {
5273  return type == BindInfo::AsPlSqlTable ? static_cast<unsigned int>(values.size()) : 0;
5274 }
5275 
5276 template<>
5277 inline void Statement::Bind<bool>(const ostring& name, bool &value, BindInfo::BindDirection mode)
5278 {
5279  BindTypeAdaptor<bool> * bnd = new BindTypeAdaptor<bool>(*this, name, mode, value);
5280 
5281  boolean res = OCI_BindBoolean(*this, name.c_str(), static_cast<boolean *>(*bnd));
5282 
5283  if (res)
5284  {
5285  BindsHolder *bindsHolder = GetBindsHolder(true);
5286  bindsHolder->AddBindObject(bnd);
5287  SetLastBindMode(mode);
5288  }
5289  else
5290  {
5291  delete bnd;
5292  }
5293 
5294  Check(res);
5295 }
5296 
5297 template<>
5298 inline void Statement::Bind<short>(const ostring& name, short &value, BindInfo::BindDirection mode)
5299 {
5300  Bind1(OCI_BindShort, name, value, mode);
5301 }
5302 
5303 template<>
5304 inline void Statement::Bind<unsigned short>(const ostring& name, unsigned short &value, BindInfo::BindDirection mode)
5305 {
5306  Bind1(OCI_BindUnsignedShort, name, value, mode);
5307 }
5308 
5309 template<>
5310 inline void Statement::Bind<int>(const ostring& name, int &value, BindInfo::BindDirection mode)
5311 {
5312  Bind1(OCI_BindInt, name, value, mode);
5313 }
5314 
5315 template<>
5316 inline void Statement::Bind<unsigned int>(const ostring& name, unsigned int &value, BindInfo::BindDirection mode)
5317 {
5318  Bind1(OCI_BindUnsignedInt, name, value, mode);
5319 }
5320 
5321 template<>
5322 inline void Statement::Bind<big_int>(const ostring& name, big_int &value, BindInfo::BindDirection mode)
5323 {
5324  Bind1(OCI_BindBigInt, name, value, mode);
5325 }
5326 
5327 template<>
5328 inline void Statement::Bind<big_uint>(const ostring& name, big_uint &value, BindInfo::BindDirection mode)
5329 {
5330  Bind1(OCI_BindUnsignedBigInt, name, value, mode);
5331 }
5332 
5333 template<>
5334 inline void Statement::Bind<float>(const ostring& name, float &value, BindInfo::BindDirection mode)
5335 {
5336  Bind1(OCI_BindFloat, name, value, mode);
5337 }
5338 
5339 template<>
5340 inline void Statement::Bind<double>(const ostring& name, double &value, BindInfo::BindDirection mode)
5341 {
5342  Bind1(OCI_BindDouble, name, value, mode);
5343 }
5344 
5345 template<>
5346 inline void Statement::Bind<Number>(const ostring& name, Number &value, BindInfo::BindDirection mode)
5347 {
5348  Bind2(OCI_BindNumber, name, value, mode);
5349 }
5350 
5351 template<>
5352 inline void Statement::Bind<Date>(const ostring& name, Date &value, BindInfo::BindDirection mode)
5353 {
5354  Bind2(OCI_BindDate, name, value, mode);
5355 }
5356 
5357 template<>
5358 inline void Statement::Bind<Timestamp>(const ostring& name, Timestamp &value, BindInfo::BindDirection mode)
5359 {
5360  Bind2(OCI_BindTimestamp, name, value, mode);
5361 }
5362 
5363 template<>
5364 inline void Statement::Bind<Interval>(const ostring& name, Interval &value, BindInfo::BindDirection mode)
5365 {
5366  Bind2(OCI_BindInterval, name, value, mode);
5367 }
5368 
5369 template<>
5370 inline void Statement::Bind<Clob>(const ostring& name, Clob &value, BindInfo::BindDirection mode)
5371 {
5372  Bind2(OCI_BindLob, name, value, mode);
5373 }
5374 
5375 template<>
5376 inline void Statement::Bind<NClob>(const ostring& name, NClob &value, BindInfo::BindDirection mode)
5377 {
5378  Bind2(OCI_BindLob, name, value, mode);
5379 }
5380 
5381 template<>
5382 inline void Statement::Bind<Blob>(const ostring& name, Blob &value, BindInfo::BindDirection mode)
5383 {
5384  Bind2(OCI_BindLob, name, value, mode);
5385 }
5386 
5387 template<>
5388 inline void Statement::Bind<File>(const ostring& name, File &value, BindInfo::BindDirection mode)
5389 {
5390  Bind2(OCI_BindFile, name, value, mode);
5391 }
5392 
5393 template<>
5394 inline void Statement::Bind<Object>(const ostring& name, Object &value, BindInfo::BindDirection mode)
5395 {
5396  Bind2(OCI_BindObject, name, value, mode);
5397 }
5398 
5399 template<>
5400 inline void Statement::Bind<Reference>(const ostring& name, Reference &value, BindInfo::BindDirection mode)
5401 {
5402  Bind2(OCI_BindRef, name, value, mode);
5403 }
5404 
5405 template<>
5406 inline void Statement::Bind<Statement>(const ostring& name, Statement &value, BindInfo::BindDirection mode)
5407 {
5408  Bind2(OCI_BindStatement, name, value, mode);
5409 }
5410 
5411 template<>
5412 inline void Statement::Bind<Clong, unsigned int>(const ostring& name, Clong &value, unsigned int maxSize, BindInfo::BindDirection mode)
5413 {
5414  Check(OCI_BindLong(*this, name.c_str(), value, maxSize));
5415  SetLastBindMode(mode);
5416 }
5417 
5418 template<>
5419 inline void Statement::Bind<Clong, int>(const ostring& name, Clong &value, int maxSize, BindInfo::BindDirection mode)
5420 {
5421  Bind<Clong, unsigned int>(name, value, static_cast<unsigned int>(maxSize), mode);
5422 }
5423 
5424 template<>
5425 inline void Statement::Bind<Blong, unsigned int>(const ostring& name, Blong &value, unsigned int maxSize, BindInfo::BindDirection mode)
5426 {
5427  Check(OCI_BindLong(*this, name.c_str(), value, maxSize));
5428  SetLastBindMode(mode);
5429 }
5430 
5431 template<>
5432 inline void Statement::Bind<Blong, int>(const ostring& name, Blong &value, int maxSize, BindInfo::BindDirection mode)
5433 {
5434  Bind<Blong, unsigned int>(name, value, static_cast<unsigned int>(maxSize), mode);
5435 }
5436 
5437 template<>
5438 inline void Statement::Bind<ostring, unsigned int>(const ostring& name, ostring &value, unsigned int maxSize, BindInfo::BindDirection mode)
5439 {
5440  if (maxSize == 0)
5441  {
5442  maxSize = static_cast<unsigned int>(value.size());
5443  }
5444 
5445  value.reserve(maxSize);
5446 
5447  BindObjectAdaptor<ostring> * bnd = new BindObjectAdaptor<ostring>(*this, name, mode, value, maxSize + 1);
5448 
5449  boolean res = OCI_BindString(*this, name.c_str(), static_cast<otext *>(*bnd), maxSize);
5450 
5451  if (res)
5452  {
5453  BindsHolder *bindsHolder = GetBindsHolder(true);
5454  bindsHolder->AddBindObject(bnd);
5455  SetLastBindMode(mode);
5456  }
5457  else
5458  {
5459  delete bnd;
5460  }
5461 
5462  Check(res);
5463 }
5464 
5465 template<>
5466 inline void Statement::Bind<ostring, int>(const ostring& name, ostring &value, int maxSize, BindInfo::BindDirection mode)
5467 {
5468  Bind<ostring, unsigned int>(name, value, static_cast<unsigned int>(maxSize), mode);
5469 }
5470 
5471 template<>
5472 inline void Statement::Bind<Raw, unsigned int>(const ostring& name, Raw &value, unsigned int maxSize, BindInfo::BindDirection mode)
5473 {
5474  if (maxSize == 0)
5475  {
5476  maxSize = static_cast<unsigned int>(value.size());
5477  }
5478 
5479  value.reserve(maxSize);
5480 
5481  BindObjectAdaptor<Raw> * bnd = new BindObjectAdaptor<Raw>(*this, name, mode, value, maxSize);
5482 
5483  boolean res = OCI_BindRaw(*this, name.c_str(), static_cast<unsigned char *>(*bnd), maxSize);
5484 
5485  if (res)
5486  {
5487  BindsHolder *bindsHolder = GetBindsHolder(true);
5488  bindsHolder->AddBindObject(bnd);
5489  SetLastBindMode(mode);
5490  }
5491  else
5492  {
5493  delete bnd;
5494  }
5495 
5496  Check(res);
5497 }
5498 
5499 template<>
5500 inline void Statement::Bind<Raw, int>(const ostring& name, Raw &value, int maxSize, BindInfo::BindDirection mode)
5501 {
5502  Bind<Raw, unsigned int>(name, value, static_cast<unsigned int>(maxSize), mode);
5503 }
5504 
5505 template<>
5506 inline void Statement::Bind<short>(const ostring& name, std::vector<short> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5507 {
5508  BindVector1(OCI_BindArrayOfShorts, name, values, mode, type);
5509 }
5510 
5511 template<>
5512 inline void Statement::Bind<unsigned short>(const ostring& name, std::vector<unsigned short> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5513 {
5514  BindVector1(OCI_BindArrayOfUnsignedShorts, name, values, mode, type);
5515 }
5516 
5517 template<>
5518 inline void Statement::Bind<int>(const ostring& name, std::vector<int> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5519 {
5520  BindVector1(OCI_BindArrayOfInts, name, values, mode, type);
5521 }
5522 
5523 template<>
5524 inline void Statement::Bind<unsigned int>(const ostring& name, std::vector<unsigned int> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5525 {
5526  BindVector1(OCI_BindArrayOfUnsignedInts, name, values, mode, type);
5527 }
5528 
5529 template<>
5530 inline void Statement::Bind<big_int>(const ostring& name, std::vector<big_int> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5531 {
5532  BindVector1(OCI_BindArrayOfBigInts, name, values, mode, type);
5533 }
5534 
5535 template<>
5536 inline void Statement::Bind<big_uint>(const ostring& name, std::vector<big_uint> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5537 {
5538  BindVector1(OCI_BindArrayOfUnsignedBigInts, name, values, mode, type);
5539 }
5540 
5541 template<>
5542 inline void Statement::Bind<float>(const ostring& name, std::vector<float> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5543 {
5544  BindVector1(OCI_BindArrayOfFloats, name, values, mode, type);
5545 }
5546 
5547 template<>
5548 inline void Statement::Bind<double>(const ostring& name, std::vector<double> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5549 {
5550  BindVector1(OCI_BindArrayOfDoubles, name, values, mode, type);
5551 }
5552 
5553 template<>
5554 inline void Statement::Bind<Date>(const ostring& name, std::vector<Date> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5555 {
5556  BindVector1(OCI_BindArrayOfDates, name, values, mode, type);
5557 }
5558 
5559 template<>
5560 inline void Statement::Bind<Number>(const ostring& name, std::vector<Number> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5561 {
5562  BindVector1(OCI_BindArrayOfNumbers, name, values, mode, type);
5563 }
5564 
5565 template<class T>
5566 void Statement::Bind(const ostring& name, Collection<T> &value, BindInfo::BindDirection mode)
5567 {
5568  Check(OCI_BindColl(*this, name.c_str(), value));
5569  SetLastBindMode(mode);
5570 }
5571 
5572 template<>
5573 inline void Statement::Bind<Timestamp, Timestamp::TimestampTypeValues>(const ostring& name, std::vector<Timestamp> &values, Timestamp::TimestampTypeValues subType, BindInfo::BindDirection mode, BindInfo::VectorType type)
5574 {
5575  BindVector2(OCI_BindArrayOfTimestamps, name, values, mode, subType, type);
5576 }
5577 
5578 template<>
5579 inline void Statement::Bind<Timestamp, Timestamp::TimestampType>(const ostring& name, std::vector<Timestamp> &values, Timestamp::TimestampType subType, BindInfo::BindDirection mode, BindInfo::VectorType type)
5580 {
5581  Bind<Timestamp, Timestamp::TimestampTypeValues>(name, values, subType.GetValue(), mode, type);
5582 }
5583 
5584 template<>
5585 inline void Statement::Bind<Interval, Interval::IntervalTypeValues>(const ostring& name, std::vector<Interval> &values, Interval::IntervalTypeValues subType, BindInfo::BindDirection mode, BindInfo::VectorType type)
5586 {
5587  BindVector2(OCI_BindArrayOfIntervals, name, values, mode, subType, type);
5588 }
5589 
5590 template<>
5591 inline void Statement::Bind<Interval, Interval::IntervalType>(const ostring& name, std::vector<Interval> &values, Interval::IntervalType subType, BindInfo::BindDirection mode, BindInfo::VectorType type)
5592 {
5593  Bind<Interval, Interval::IntervalTypeValues>(name, values, subType.GetValue(), mode, type);
5594 }
5595 
5596 template<>
5597 inline void Statement::Bind<Clob>(const ostring& name, std::vector<Clob> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5598 {
5599  BindVector2(OCI_BindArrayOfLobs, name, values, mode, static_cast<unsigned int>(OCI_CLOB), type);
5600 }
5601 
5602 template<>
5603 inline void Statement::Bind<NClob>(const ostring& name, std::vector<NClob> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5604 {
5605  BindVector2(OCI_BindArrayOfLobs, name, values, mode, static_cast<unsigned int>(OCI_NCLOB), type);
5606 }
5607 
5608 template<>
5609 inline void Statement::Bind<Blob>(const ostring& name, std::vector<Blob> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5610 {
5611  BindVector2(OCI_BindArrayOfLobs, name, values, mode, static_cast<unsigned int>(OCI_BLOB), type);
5612 }
5613 
5614 template<>
5615 inline void Statement::Bind<File>(const ostring& name, std::vector<File> &values, BindInfo::BindDirection mode, BindInfo::VectorType type)
5616 {
5617  BindVector2(OCI_BindArrayOfFiles, name, values, mode, static_cast<unsigned int>(OCI_BFILE), type);
5618 }
5619 
5620 template<>
5621 inline void Statement::Bind<Object>(const ostring& name, std::vector<Object> &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type)
5622 {
5623  BindVector2(OCI_BindArrayOfObjects, name, values, mode, static_cast<OCI_TypeInfo *>(typeInfo), type);
5624 }
5625 
5626 template<>
5627 inline void Statement::Bind<Reference>(const ostring& name, std::vector<Reference> &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type)
5628 {
5629  BindVector2(OCI_BindArrayOfRefs, name, values, mode, static_cast<OCI_TypeInfo *>(typeInfo), type);
5630 }
5631 
5632 template<class T>
5633 void Statement::Bind(const ostring& name, std::vector<Collection<T> > &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type)
5634 {
5635  BindVector2(OCI_BindArrayOfColls, name, values, mode, static_cast<OCI_TypeInfo *>(typeInfo), type);
5636 }
5637 
5638 template<>
5639 inline void Statement::Bind<ostring, unsigned int>(const ostring& name, std::vector<ostring> &values, unsigned int maxSize, BindInfo::BindDirection mode, BindInfo::VectorType type)
5640 {
5641  BindArray * bnd = new BindArray(*this, name, mode);
5642  bnd->SetVector<ostring>(values, maxSize+1);
5643 
5644  boolean res = OCI_BindArrayOfStrings(*this, name.c_str(), bnd->GetData<ostring>(), maxSize, GetArraysize(type, values));
5645 
5646  if (res)
5647  {
5648  BindsHolder *bindsHolder = GetBindsHolder(true);
5649  bindsHolder->AddBindObject(bnd);
5650  SetLastBindMode(mode);
5651  }
5652  else
5653  {
5654  delete bnd;
5655  }
5656 
5657  Check(res);
5658 }
5659 
5660 template<>
5661 inline void Statement::Bind<ostring, int>(const ostring& name, std::vector<ostring> &values, int maxSize, BindInfo::BindDirection mode, BindInfo::VectorType type)
5662 {
5663  Bind<ostring, unsigned int>(name, values, static_cast<unsigned int>(maxSize), mode, type);
5664 }
5665 
5666 template<>
5667 inline void Statement::Bind<Raw, unsigned int>(const ostring& name, std::vector<Raw> &values, unsigned int maxSize, BindInfo::BindDirection mode, BindInfo::VectorType type)
5668 {
5669  BindArray * bnd = new BindArray(*this, name, mode);
5670  bnd->SetVector<Raw>(values, maxSize);
5671 
5672  boolean res = OCI_BindArrayOfRaws(*this, name.c_str(), bnd->GetData<Raw>(), maxSize, GetArraysize(type, values));
5673 
5674  if (res)
5675  {
5676  BindsHolder *bindsHolder = GetBindsHolder(true);
5677  bindsHolder->AddBindObject(bnd);
5678  SetLastBindMode(mode);
5679  }
5680  else
5681  {
5682  delete bnd;
5683  }
5684 
5685  Check(res);
5686 }
5687 
5688 template<class T>
5689 void Statement::Bind(const ostring& name, std::vector<T> &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type)
5690 {
5691  BindVector2(OCI_BindArrayOfColls, name, values, mode, static_cast<OCI_TypeInfo *>(typeInfo), GetArraysize(type, values));
5692 }
5693 
5694 template<>
5695 inline void Statement::Register<unsigned short>(const ostring& name)
5696 {
5697  Check(OCI_RegisterUnsignedShort(*this, name.c_str()));
5698 }
5699 
5700 template<>
5701 inline void Statement::Register<short>(const ostring& name)
5702 {
5703  Check(OCI_RegisterShort(*this, name.c_str()));
5704 }
5705 
5706 template<>
5707 inline void Statement::Register<unsigned int>(const ostring& name)
5708 {
5709  Check(OCI_RegisterUnsignedInt(*this, name.c_str()));
5710 }
5711 
5712 template<>
5713 inline void Statement::Register<int>(const ostring& name)
5714 {
5715  Check(OCI_RegisterInt(*this, name.c_str()));
5716 }
5717 
5718 template<>
5719 inline void Statement::Register<big_uint>(const ostring& name)
5720 {
5721  Check(OCI_RegisterUnsignedBigInt(*this, name.c_str()));
5722 }
5723 
5724 template<>
5725 inline void Statement::Register<big_int>(const ostring& name)
5726 {
5727  Check(OCI_RegisterBigInt(*this, name.c_str()));
5728 }
5729 
5730 template<>
5731 inline void Statement::Register<float>(const ostring& name)
5732 {
5733  Check(OCI_RegisterFloat(*this, name.c_str()));
5734 }
5735 
5736 template<>
5737 inline void Statement::Register<double>(const ostring& name)
5738 {
5739  Check(OCI_RegisterDouble(*this, name.c_str()));
5740 }
5741 
5742 template<>
5743 inline void Statement::Register<Number>(const ostring& name)
5744 {
5745  Check(OCI_RegisterNumber(*this, name.c_str()));
5746 }
5747 
5748 template<>
5749 inline void Statement::Register<Date>(const ostring& name)
5750 {
5751  Check(OCI_RegisterDate(*this, name.c_str()));
5752 }
5753 
5754 template<>
5755 inline void Statement::Register<Timestamp, Timestamp::TimestampTypeValues>(const ostring& name, Timestamp::TimestampTypeValues type)
5756 {
5757  Check(OCI_RegisterTimestamp(*this, name.c_str(), type));
5758 }
5759 
5760 template<>
5761 inline void Statement::Register<Timestamp, Timestamp::TimestampType>(const ostring& name, Timestamp::TimestampType type)
5762 {
5763  Register<Timestamp, Timestamp::TimestampTypeValues>(name, type.GetValue());
5764 }
5765 
5766 template<>
5767 inline void Statement::Register<Interval, Interval::IntervalTypeValues>(const ostring& name, Interval::IntervalTypeValues type)
5768 {
5769  Check(OCI_RegisterInterval(*this, name.c_str(), type));
5770 }
5771 
5772 template<>
5773 inline void Statement::Register<Interval, Interval::IntervalType>(const ostring& name, Interval::IntervalType type)
5774 {
5775  Register<Interval, Interval::IntervalTypeValues>(name, type.GetValue());
5776 }
5777 
5778 template<>
5779 inline void Statement::Register<Clob>(const ostring& name)
5780 {
5781  Check(OCI_RegisterLob(*this, name.c_str(), OCI_CLOB));
5782 }
5783 
5784 template<>
5785 inline void Statement::Register<NClob>(const ostring& name)
5786 {
5787  Check(OCI_RegisterLob(*this, name.c_str(), OCI_NCLOB));
5788 }
5789 
5790 template<>
5791 inline void Statement::Register<Blob>(const ostring& name)
5792 {
5793  Check(OCI_RegisterLob(*this, name.c_str(), OCI_BLOB));
5794 }
5795 
5796 template<>
5797 inline void Statement::Register<File>(const ostring& name)
5798 {
5799  Check(OCI_RegisterFile(*this, name.c_str(), OCI_BFILE));
5800 }
5801 
5802 template<>
5803 inline void Statement::Register<Object, TypeInfo>(const ostring& name, TypeInfo& typeInfo)
5804 {
5805  Check(OCI_RegisterObject(*this, name.c_str(), typeInfo));
5806 }
5807 
5808 template<>
5809 inline void Statement::Register<Reference, TypeInfo>(const ostring& name, TypeInfo& typeInfo)
5810 {
5811  Check(OCI_RegisterRef(*this, name.c_str(), typeInfo));
5812 }
5813 
5814 template<>
5815 inline void Statement::Register<ostring, unsigned int>(const ostring& name, unsigned int len)
5816 {
5817  Check(OCI_RegisterString(*this, name.c_str(), len));
5818 }
5819 
5820 template<>
5821 inline void Statement::Register<ostring, int>(const ostring& name, int len)
5822 {
5823  Register<ostring, unsigned int>(name, static_cast<unsigned int>(len));
5824 }
5825 
5826 template<>
5827 inline void Statement::Register<Raw, unsigned int>(const ostring& name, unsigned int len)
5828 {
5829  Check(OCI_RegisterRaw(*this, name.c_str(), len));
5830 }
5831 
5832 template<>
5833 inline void Statement::Register<Raw, int>(const ostring& name, int len)
5834 {
5835  Register<Raw, unsigned int>(name, static_cast<unsigned int>(len));
5836 }
5837 
5839 {
5840  return StatementType(static_cast<StatementType::Type>(Check(OCI_GetStatementType(*this))));
5841 }
5842 
5843 inline unsigned int Statement::GetSqlErrorPos() const
5844 {
5845  return Check(OCI_GetSqlErrorPos(*this));
5846 }
5847 
5849 {
5850  Check(OCI_SetFetchMode(*this, value));
5851 }
5852 
5854 {
5855  return FetchMode(static_cast<FetchMode::Type>(Check(OCI_GetFetchMode(*this))));
5856 }
5857 
5859 {
5860  Check(OCI_SetBindMode(*this, value));
5861 }
5862 
5864 {
5865  return BindMode(static_cast<BindMode::Type>(Check(OCI_GetBindMode(*this))));
5866 }
5867 
5868 inline void Statement::SetFetchSize(unsigned int value)
5869 {
5870  Check(OCI_SetFetchSize(*this, value));
5871 }
5872 
5873 inline unsigned int Statement::GetFetchSize() const
5874 {
5875  return Check(OCI_GetFetchSize(*this));
5876 }
5877 
5878 inline void Statement::SetPrefetchSize(unsigned int value)
5879 {
5880  Check(OCI_SetPrefetchSize(*this, value));
5881 }
5882 
5883 inline unsigned int Statement::GetPrefetchSize() const
5884 {
5885  return Check(OCI_GetPrefetchSize(*this));
5886 }
5887 
5888 inline void Statement::SetPrefetchMemory(unsigned int value)
5889 {
5890  Check(OCI_SetPrefetchMemory(*this, value));
5891 }
5892 
5893 inline unsigned int Statement::GetPrefetchMemory() const
5894 {
5895  return Check(OCI_GetPrefetchMemory(*this));
5896 }
5897 
5898 inline void Statement::SetLongMaxSize(unsigned int value)
5899 {
5900  Check(OCI_SetLongMaxSize(*this, value));
5901 }
5902 
5903 inline unsigned int Statement::GetLongMaxSize() const
5904 {
5905  return Check(OCI_GetLongMaxSize(*this));
5906 }
5907 
5909 {
5910  Check(OCI_SetLongMode(*this, value));
5911 }
5912 
5914 {
5915  return LongMode(static_cast<LongMode::Type>(Check(OCI_GetLongMode(*this))));
5916 }
5917 
5918 inline unsigned int Statement::GetSQLCommand() const
5919 {
5920  return Check(OCI_GetSQLCommand(*this));
5921 }
5922 
5923 inline ostring Statement::GetSQLVerb() const
5924 {
5925  return MakeString(Check(OCI_GetSQLVerb(*this)));
5926 }
5927 
5928 inline void Statement::GetBatchErrors(std::vector<Exception> &exceptions)
5929 {
5930  exceptions.clear();
5931 
5932  OCI_Error *err = Check(OCI_GetBatchError(*this));
5933 
5934  while (err)
5935  {
5936  exceptions.push_back(Exception(err));
5937 
5938  err = Check(OCI_GetBatchError(*this));
5939  }
5940 }
5941 
5942 inline void Statement::ClearBinds() const
5943 {
5944  BindsHolder *bindsHolder = GetBindsHolder(false);
5945 
5946  if (bindsHolder)
5947  {
5948  bindsHolder->Clear();
5949  }
5950 }
5951 
5952 inline void Statement::SetOutData() const
5953 {
5954  BindsHolder *bindsHolder = GetBindsHolder(false);
5955 
5956  if (bindsHolder)
5957  {
5958  bindsHolder->SetOutData();
5959  }
5960 }
5961 
5962 inline void Statement::SetInData() const
5963 {
5964  BindsHolder *bindsHolder = GetBindsHolder(false);
5965 
5966  if (bindsHolder)
5967  {
5968  bindsHolder->SetInData();
5969  }
5970 }
5971 
5972 inline void Statement::ReleaseResultsets() const
5973 {
5974  if (_smartHandle)
5975  {
5976  Handle *handle = nullptr;
5977 
5978  while (_smartHandle->GetChildren().FindIf(IsResultsetHandle, handle))
5979  {
5980  if (handle)
5981  {
5982  handle->DetachFromHolders();
5983 
5984  delete handle;
5985 
5986  handle = nullptr;
5987  }
5988  }
5989  }
5990 }
5991 
5992 inline bool Statement::IsResultsetHandle(Handle *handle)
5993 {
5994  Resultset::SmartHandle *smartHandle = dynamic_cast<Resultset::SmartHandle *>(handle);
5995 
5996  return smartHandle != nullptr;
5997 }
5998 
5999 inline void Statement::OnFreeSmartHandle(SmartHandle *smartHandle)
6000 {
6001  if (smartHandle)
6002  {
6003  BindsHolder *bindsHolder = static_cast<BindsHolder *>(smartHandle->GetExtraInfos());
6004 
6005  smartHandle->SetExtraInfos(nullptr);
6006 
6007  delete bindsHolder;
6008  }
6009 }
6010 
6011 inline void Statement::SetLastBindMode(BindInfo::BindDirection mode)
6012 {
6014 }
6015 
6016 inline BindsHolder * Statement::GetBindsHolder(bool create) const
6017 {
6018  BindsHolder * bindsHolder = static_cast<BindsHolder *>(_smartHandle->GetExtraInfos());
6019 
6020  if (bindsHolder == nullptr && create)
6021  {
6022  bindsHolder = new BindsHolder(*this);
6023  _smartHandle->SetExtraInfos(bindsHolder);
6024  }
6025 
6026  return bindsHolder;
6027 }
6028 
6029 /* --------------------------------------------------------------------------------------------- *
6030  * Resultset
6031  * --------------------------------------------------------------------------------------------- */
6032 
6033 inline Resultset::Resultset(OCI_Resultset *resultset, Handle *parent)
6034 {
6035  Acquire(resultset, nullptr, nullptr, parent);
6036 }
6037 
6038 inline bool Resultset::Next()
6039 {
6040  return (Check(OCI_FetchNext(*this)) == TRUE);
6041 }
6042 
6043 inline bool Resultset::Prev()
6044 {
6045  return (Check(OCI_FetchPrev(*this)) == TRUE);
6046 }
6047 
6048 inline bool Resultset::First()
6049 {
6050  return (Check(OCI_FetchFirst(*this)) == TRUE);
6051 }
6052 
6053 inline bool Resultset::Last()
6054 {
6055  return (Check(OCI_FetchLast(*this)) == TRUE);
6056 }
6057 
6058 inline bool Resultset::Seek(SeekMode mode, int offset)
6059 {
6060  return (Check(OCI_FetchSeek(*this, mode, offset)) == TRUE);
6061 }
6062 
6063 inline unsigned int Resultset::GetCount() const
6064 {
6065  return Check(OCI_GetRowCount(*this));
6066 }
6067 
6068 inline unsigned int Resultset::GetCurrentRow() const
6069 {
6070  return Check(OCI_GetCurrentRow(*this));
6071 }
6072 
6073 inline unsigned int Resultset::GetColumnIndex(const ostring& name) const
6074 {
6075  return Check(OCI_GetColumnIndex(*this, name.c_str()));
6076 }
6077 
6078 inline unsigned int Resultset::GetColumnCount() const
6079 {
6080  return Check(OCI_GetColumnCount(*this));
6081 }
6082 
6083 inline Column Resultset::GetColumn(unsigned int index) const
6084 {
6085  return Column(Check(OCI_GetColumn(*this, index)), GetHandle());
6086 }
6087 
6088 inline Column Resultset::GetColumn(const ostring& name) const
6089 {
6090  return Column(Check(OCI_GetColumn2(*this, name.c_str())), GetHandle());
6091 }
6092 
6093 inline bool Resultset::IsColumnNull(unsigned int index) const
6094 {
6095  return (Check(OCI_IsNull(*this, index)) == TRUE);
6096 }
6097 
6098 inline bool Resultset::IsColumnNull(const ostring& name) const
6099 {
6100  return (Check(OCI_IsNull2(*this, name.c_str())) == TRUE);
6101 }
6102 
6103 inline Statement Resultset::GetStatement() const
6104 {
6105  return Statement( Check(OCI_ResultsetGetStatement(*this)), nullptr);
6106 }
6107 
6108 inline bool Resultset::operator ++ (int)
6109 {
6110  return Next();
6111 }
6112 
6113 inline bool Resultset::operator -- (int)
6114 {
6115  return Prev();
6116 }
6117 
6118 inline bool Resultset::operator += (int offset)
6119 {
6120  return Seek(SeekRelative, offset);
6121 }
6122 
6123 inline bool Resultset::operator -= (int offset)
6124 {
6125  return Seek(SeekRelative, -offset);
6126 }
6127 
6128 template<class T>
6129 void Resultset::Get(unsigned int index, T& value) const
6130 {
6131  value = Get<T>(index);
6132 }
6133 
6134 template<class T>
6135 void Resultset::Get(const ostring &name, T& value) const
6136 {
6137  value = Get<T>(name);
6138 }
6139 
6140 template<class T, class TAdapter>
6141 bool Resultset::Get(T& value, TAdapter adapter) const
6142 {
6143  return adapter(static_cast<const Resultset&>(*this), value);
6144 }
6145 
6146 template<class TCallback>
6147 unsigned int Resultset::ForEach(TCallback callback)
6148 {
6149  while (Next())
6150  {
6151  if (!callback(static_cast<const Resultset&>(*this)))
6152  {
6153  break;
6154  }
6155  }
6156 
6157  return GetCurrentRow();
6158 }
6159 
6160 template<class T, class U>
6161 unsigned int Resultset::ForEach(T callback, U adapter)
6162 {
6163  while (Next())
6164  {
6165  if (!callback(adapter(static_cast<const Resultset&>(*this))))
6166  {
6167  break;
6168  }
6169  }
6170 
6171  return GetCurrentRow();
6172 }
6173 
6174 template<>
6175 inline short Resultset::Get<short>(unsigned int index) const
6176 {
6177  return Check(OCI_GetShort(*this, index));
6178 }
6179 
6180 template<>
6181 inline short Resultset::Get<short>(const ostring& name) const
6182 {
6183  return Check(OCI_GetShort2(*this, name.c_str()));
6184 }
6185 
6186 template<>
6187 inline unsigned short Resultset::Get<unsigned short>(unsigned int index) const
6188 {
6189  return Check(OCI_GetUnsignedShort(*this, index));
6190 }
6191 
6192 template<>
6193 inline unsigned short Resultset::Get<unsigned short>(const ostring& name) const
6194 {
6195  return Check(OCI_GetUnsignedShort2(*this, name.c_str()));
6196 }
6197 
6198 template<>
6199 inline int Resultset::Get<int>(unsigned int index) const
6200 {
6201  return Check(OCI_GetInt(*this, index));
6202 }
6203 
6204 template<>
6205 inline int Resultset::Get<int>(const ostring& name) const
6206 {
6207  return Check(OCI_GetInt2(*this, name.c_str()));
6208 }
6209 
6210 template<>
6211 inline unsigned int Resultset::Get<unsigned int>(unsigned int index) const
6212 {
6213  return Check(OCI_GetUnsignedInt(*this, index));
6214 }
6215 
6216 template<>
6217 inline unsigned int Resultset::Get<unsigned int>(const ostring& name) const
6218 {
6219  return Check(OCI_GetUnsignedInt2(*this, name.c_str()));
6220 }
6221 
6222 template<>
6223 inline big_int Resultset::Get<big_int>(unsigned int index) const
6224 {
6225  return Check(OCI_GetBigInt(*this, index));
6226 }
6227 
6228 template<>
6229 inline big_int Resultset::Get<big_int>(const ostring& name) const
6230 {
6231  return Check(OCI_GetBigInt2(*this, name.c_str()));
6232 }
6233 
6234 template<>
6235 inline big_uint Resultset::Get<big_uint>(unsigned int index) const
6236 {
6237  return Check(OCI_GetUnsignedBigInt(*this, index));
6238 }
6239 
6240 template<>
6241 inline big_uint Resultset::Get<big_uint>(const ostring& name) const
6242 {
6243  return Check(OCI_GetUnsignedBigInt2(*this, name.c_str()));
6244 }
6245 
6246 template<>
6247 inline float Resultset::Get<float>(unsigned int index) const
6248 {
6249  return Check(OCI_GetFloat(*this, index));
6250 }
6251 
6252 template<>
6253 inline float Resultset::Get<float>(const ostring& name) const
6254 {
6255  return Check(OCI_GetFloat2(*this, name.c_str()));
6256 }
6257 
6258 template<>
6259 inline double Resultset::Get<double>(unsigned int index) const
6260 {
6261  return Check(OCI_GetDouble(*this, index));
6262 }
6263 
6264 template<>
6265 inline double Resultset::Get<double>(const ostring& name) const
6266 {
6267  return Check(OCI_GetDouble2(*this, name.c_str()));
6268 }
6269 
6270 template<>
6271 inline Number Resultset::Get<Number>(unsigned int index) const
6272 {
6273  return Number(Check(OCI_GetNumber(*this, index)), GetHandle());
6274 }
6275 
6276 template<>
6277 inline Number Resultset::Get<Number>(const ostring& name) const
6278 {
6279  return Number(Check(OCI_GetNumber2(*this, name.c_str())), GetHandle());
6280 }
6281 
6282 template<>
6283 inline ostring Resultset::Get<ostring>(unsigned int index) const
6284 {
6285  return MakeString(Check(OCI_GetString(*this, index)));
6286 }
6287 
6288 template<>
6289 inline ostring Resultset::Get<ostring>(const ostring& name) const
6290 {
6291  return MakeString(Check(OCI_GetString2(*this,name.c_str())));
6292 }
6293 
6294 template<>
6295 inline Raw Resultset::Get<Raw>(unsigned int index) const
6296 {
6297  unsigned int size = Check(OCI_GetDataLength(*this,index));
6298 
6299  ManagedBuffer<unsigned char> buffer(size + 1);
6300 
6301  size = Check(OCI_GetRaw(*this, index, static_cast<AnyPointer>(buffer), size));
6302 
6303  return MakeRaw(buffer, size);
6304 }
6305 
6306 template<>
6307 inline Raw Resultset::Get<Raw>(const ostring& name) const
6308 {
6309  unsigned int size = Check(OCI_GetDataLength(*this, Check(OCI_GetColumnIndex(*this, name.c_str()))));
6310 
6311  ManagedBuffer<unsigned char> buffer(size + 1);
6312 
6313  size = Check(OCI_GetRaw2(*this, name.c_str(), static_cast<AnyPointer>(buffer), size));
6314 
6315  return MakeRaw(buffer, size);
6316 }
6317 
6318 template<>
6319 inline Date Resultset::Get<Date>(unsigned int index) const
6320 {
6321  return Date(Check(OCI_GetDate(*this, index)), GetHandle());
6322 }
6323 
6324 template<>
6325 inline Date Resultset::Get<Date>(const ostring& name) const
6326 {
6327  return Date(Check(OCI_GetDate2(*this,name.c_str())), GetHandle());
6328 }
6329 
6330 template<>
6331 inline Timestamp Resultset::Get<Timestamp>(unsigned int index) const
6332 {
6333  return Timestamp(Check(OCI_GetTimestamp(*this, index)), GetHandle());
6334 }
6335 
6336 template<>
6337 inline Timestamp Resultset::Get<Timestamp>(const ostring& name) const
6338 {
6339  return Timestamp(Check(OCI_GetTimestamp2(*this,name.c_str())), GetHandle());
6340 }
6341 
6342 template<>
6343 inline Interval Resultset::Get<Interval>(unsigned int index) const
6344 {
6345  return Interval(Check(OCI_GetInterval(*this, index)), GetHandle());
6346 }
6347 
6348 template<>
6349 inline Interval Resultset::Get<Interval>(const ostring& name) const
6350 {
6351  return Interval(Check(OCI_GetInterval2(*this,name.c_str())), GetHandle());
6352 }
6353 
6354 template<>
6355 inline Object Resultset::Get<Object>(unsigned int index) const
6356 {
6357  return Object(Check(OCI_GetObject(*this, index)), GetHandle());
6358 }
6359 
6360 template<>
6361 inline Object Resultset::Get<Object>(const ostring& name) const
6362 {
6363  return Object(Check(OCI_GetObject2(*this,name.c_str())), GetHandle());
6364 }
6365 
6366 template<>
6367 inline Reference Resultset::Get<Reference>(unsigned int index) const
6368 {
6369  return Reference(Check(OCI_GetRef(*this, index)), GetHandle());
6370 }
6371 
6372 template<>
6373 inline Reference Resultset::Get<Reference>(const ostring& name) const
6374 {
6375  return Reference(Check(OCI_GetRef2(*this,name.c_str())), GetHandle());
6376 }
6377 
6378 template<>
6379 inline Statement Resultset::Get<Statement>(unsigned int index) const
6380 {
6381  return Statement(Check(OCI_GetStatement(*this, index)), GetHandle());
6382 }
6383 
6384 template<>
6385 inline Statement Resultset::Get<Statement>(const ostring& name) const
6386 {
6387  return Statement(Check(OCI_GetStatement2(*this,name.c_str())), GetHandle());
6388 }
6389 
6390 template<>
6391 inline Clob Resultset::Get<Clob>(unsigned int index) const
6392 {
6393  return Clob(Check(OCI_GetLob(*this, index)), GetHandle());
6394 }
6395 
6396 template<>
6397 inline Clob Resultset::Get<Clob>(const ostring& name) const
6398 {
6399  return Clob(Check(OCI_GetLob2(*this,name.c_str())), GetHandle());
6400 }
6401 
6402 template<>
6403 inline NClob Resultset::Get<NClob>(unsigned int index) const
6404 {
6405  return NClob(Check(OCI_GetLob(*this, index)), GetHandle());
6406 }
6407 
6408 template<>
6409 inline NClob Resultset::Get<NClob>(const ostring& name) const
6410 {
6411  return NClob(Check(OCI_GetLob2(*this, name.c_str())), GetHandle());
6412 }
6413 
6414 template<>
6415 inline Blob Resultset::Get<Blob>(unsigned int index) const
6416 {
6417  return Blob(Check(OCI_GetLob(*this, index)), GetHandle());
6418 }
6419 
6420 template<>
6421 inline Blob Resultset::Get<Blob>(const ostring& name) const
6422 {
6423  return Blob(Check(OCI_GetLob2(*this,name.c_str())), GetHandle());
6424 }
6425 
6426 template<>
6427 inline File Resultset::Get<File>(unsigned int index) const
6428 {
6429  return File(Check(OCI_GetFile(*this, index)), GetHandle());
6430 }
6431 
6432 template<>
6433 inline File Resultset::Get<File>(const ostring& name) const
6434 {
6435  return File(Check(OCI_GetFile2(*this,name.c_str())), GetHandle());
6436 }
6437 
6438 template<>
6439 inline Clong Resultset::Get<Clong>(unsigned int index) const
6440 {
6441  return Clong(Check(OCI_GetLong(*this, index)), GetHandle());
6442 }
6443 
6444 template<>
6445 inline Clong Resultset::Get<Clong>(const ostring& name) const
6446 {
6447  return Clong(Check(OCI_GetLong2(*this,name.c_str())), GetHandle());
6448 }
6449 
6450 template<>
6451 inline Blong Resultset::Get<Blong>(unsigned int index) const
6452 {
6453  return Blong(Check(OCI_GetLong(*this, index)), GetHandle());
6454 }
6455 
6456 template<>
6457 inline Blong Resultset::Get<Blong>(const ostring& name) const
6458 {
6459  return Blong(Check(OCI_GetLong2(*this,name.c_str())), GetHandle());
6460 }
6461 
6462 template<class T>
6463 T Resultset::Get(unsigned int index) const
6464 {
6465  return T(Check(OCI_GetColl(*this, index)), GetHandle());
6466 }
6467 
6468 template<class T>
6469 T Resultset::Get(const ostring& name) const
6470 {
6471  return T(Check(OCI_GetColl2(*this, name.c_str())), GetHandle());
6472 }
6473 
6474 /* --------------------------------------------------------------------------------------------- *
6475  * Column
6476  * --------------------------------------------------------------------------------------------- */
6477 
6478 inline Column::Column(OCI_Column *pColumn, Handle *parent)
6479 {
6480  Acquire(pColumn, nullptr, nullptr, parent);
6481 }
6482 
6483 inline ostring Column::GetName() const
6484 {
6485  return MakeString(Check(OCI_ColumnGetName(*this)));
6486 }
6487 
6488 inline ostring Column::GetSQLType() const
6489 {
6490  return MakeString(Check(OCI_ColumnGetSQLType(*this)));
6491 }
6492 
6493 inline ostring Column::GetFullSQLType() const
6494 {
6495  unsigned int size = OCI_SIZE_BUFFER;
6496 
6497  ManagedBuffer<otext> buffer(size + 1);
6498 
6499  Check(OCI_ColumnGetFullSQLType(*this, buffer, size));
6500 
6501  return MakeString(static_cast<const otext *>(buffer));
6502 }
6503 
6505 {
6506  return DataType(static_cast<DataType::Type>(Check(OCI_ColumnGetType(*this))));
6507 }
6508 
6509 inline unsigned int Column::GetSubType() const
6510 {
6511  return Check(OCI_ColumnGetSubType(*this));
6512 }
6513 
6515 {
6516  return CharsetForm(static_cast<CharsetForm::Type>(Check(OCI_ColumnGetCharsetForm(*this))));
6517 }
6518 
6520 {
6521  return CollationID(static_cast<CollationID::Type>(Check(OCI_ColumnGetCollationID(*this))));
6522 }
6523 
6524 inline unsigned int Column::GetSize() const
6525 {
6526  return Check(OCI_ColumnGetSize(*this));
6527 }
6528 
6529 inline int Column::GetScale() const
6530 {
6531  return Check(OCI_ColumnGetScale(*this));
6532 }
6533 
6534 inline int Column::GetPrecision() const
6535 {
6536  return Check(OCI_ColumnGetPrecision(*this));
6537 }
6538 
6540 {
6541  return Check(OCI_ColumnGetFractionalPrecision(*this));
6542 }
6543 
6545 {
6546  return Check(OCI_ColumnGetLeadingPrecision(*this));
6547 }
6548 
6550 {
6551  return PropertyFlags(static_cast<PropertyFlags::Type>(Check(OCI_ColumnGetPropertyFlags(*this))));
6552 }
6553 
6554 inline bool Column::IsNullable() const
6555 {
6556  return (Check(OCI_ColumnGetNullable(*this)) == TRUE);
6557 }
6558 
6559 inline bool Column::IsCharSemanticUsed() const
6560 {
6561  return (Check(OCI_ColumnGetCharUsed(*this)) == TRUE);
6562 }
6563 
6565 {
6566  return TypeInfo(Check(OCI_ColumnGetTypeInfo(*this)));
6567 }
6568 
6569 /* --------------------------------------------------------------------------------------------- *
6570  * Subscription
6571  * --------------------------------------------------------------------------------------------- */
6572 
6574 {
6575 
6576 }
6577 
6578 inline Subscription::Subscription(OCI_Subscription *pSubcription)
6579 {
6580  Acquire(pSubcription, nullptr, nullptr, nullptr);
6581 }
6582 
6583 inline void Subscription::Register(const Connection &connection, const ostring& name, ChangeTypes changeTypes, NotifyHandlerProc handler, unsigned int port, unsigned int timeout)
6584 {
6585  Acquire(Check(OCI_SubscriptionRegister(connection, name.c_str(), changeTypes.GetValues(),
6586  static_cast<POCI_NOTIFY> (handler != nullptr ? Environment::NotifyHandler : nullptr), port, timeout)),
6587  reinterpret_cast<HandleFreeFunc>(OCI_SubscriptionUnregister), nullptr, nullptr);
6588 
6589  Environment::SetUserCallback<Subscription::NotifyHandlerProc>(static_cast<OCI_Subscription*>(*this), handler);
6590 }
6591 
6593 {
6594  Environment::SetUserCallback<Subscription::NotifyHandlerProc>(static_cast<OCI_Subscription*>(*this), nullptr);
6595 
6596  Release();
6597 }
6598 
6599 inline void Subscription::Watch(const ostring& sql)
6600 {
6601  Statement st(GetConnection());
6602 
6603  st.Execute(sql);
6604 
6605  Check(OCI_SubscriptionAddStatement(*this, st));
6606 }
6607 
6608 inline ostring Subscription::GetName() const
6609 {
6610  return MakeString(Check(OCI_SubscriptionGetName(*this)));
6611 }
6612 
6613 inline unsigned int Subscription::GetTimeout() const
6614 {
6615  return Check(OCI_SubscriptionGetTimeout(*this));
6616 }
6617 
6618 inline unsigned int Subscription::GetPort() const
6619 {
6620  return Check(OCI_SubscriptionGetPort(*this));
6621 }
6622 
6624 {
6625  return Connection(Check(OCI_SubscriptionGetConnection(*this)), nullptr);
6626 }
6627 
6628 /* --------------------------------------------------------------------------------------------- *
6629  * Event
6630  * --------------------------------------------------------------------------------------------- */
6631 
6632 inline Event::Event(OCI_Event *pEvent)
6633 {
6634  Acquire(pEvent, nullptr, nullptr, nullptr);
6635 }
6636 
6638 {
6639  return EventType(static_cast<EventType::Type>(Check(OCI_EventGetType(*this))));
6640 }
6641 
6643 {
6644  return ObjectEvent(static_cast<ObjectEvent::Type>(Check(OCI_EventGetOperation(*this))));
6645 }
6646 
6647 inline ostring Event::GetDatabaseName() const
6648 {
6649  return MakeString(Check(OCI_EventGetDatabase(*this)));
6650 }
6651 
6652 inline ostring Event::GetObjectName() const
6653 {
6654  return MakeString(Check(OCI_EventGetObject(*this)));
6655 }
6656 
6657 inline ostring Event::GetRowID() const
6658 {
6659  return MakeString(Check(OCI_EventGetRowid(*this)));
6660 }
6661 
6663 {
6665 }
6666 
6667 /* --------------------------------------------------------------------------------------------- *
6668  * Agent
6669  * --------------------------------------------------------------------------------------------- */
6670 
6671 inline Agent::Agent(const Connection &connection, const ostring& name, const ostring& address)
6672 {
6673  Acquire(Check(OCI_AgentCreate(connection, name.c_str(), address.c_str())), reinterpret_cast<HandleFreeFunc>(OCI_AgentFree), nullptr, nullptr);
6674 }
6675 
6676 inline Agent::Agent(OCI_Agent *pAgent, Handle *parent)
6677 {
6678  Acquire(pAgent, nullptr, nullptr, parent);
6679 }
6680 
6681 inline ostring Agent::GetName() const
6682 {
6683  return MakeString(Check(OCI_AgentGetName(*this)));
6684 }
6685 
6686 inline void Agent::SetName(const ostring& value)
6687 {
6688  Check(OCI_AgentSetName(*this, value.c_str()));
6689 }
6690 
6691 inline ostring Agent::GetAddress() const
6692 {
6693  return MakeString(Check(OCI_AgentGetAddress(*this)));
6694 }
6695 
6696 inline void Agent::SetAddress(const ostring& value)
6697 {
6698  Check(OCI_AgentSetAddress(*this, value.c_str()));
6699 }
6700 
6701 /* --------------------------------------------------------------------------------------------- *
6702  * Message
6703  * --------------------------------------------------------------------------------------------- */
6704 
6705 inline Message::Message(const TypeInfo &typeInfo)
6706 {
6707  Acquire(Check(OCI_MsgCreate(typeInfo)), reinterpret_cast<HandleFreeFunc>(OCI_MsgFree), nullptr, nullptr);
6708 }
6709 
6710 inline Message::Message(OCI_Msg *pMessage, Handle *parent)
6711 {
6712  Acquire(pMessage, nullptr, nullptr, parent);
6713 }
6714 
6715 inline void Message::Reset()
6716 {
6717  Check(OCI_MsgReset(*this));
6718 }
6719 
6720 template<>
6721 inline Object Message::GetPayload<Object>()
6722 {
6723  return Object(Check(OCI_MsgGetObject(*this)), nullptr);
6724 }
6725 
6726 template<>
6727 inline void Message::SetPayload<Object>(const Object &value)
6728 {
6729  Check(OCI_MsgSetObject(*this, value));
6730 }
6731 
6732 template<>
6733 inline Raw Message::GetPayload<Raw>()
6734 {
6735  unsigned int size = 0;
6736 
6737  ManagedBuffer<unsigned char> buffer(size + 1);
6738 
6739  Check(OCI_MsgGetRaw(*this, static_cast<AnyPointer>(buffer), &size));
6740 
6741  return MakeRaw(buffer, size);
6742 }
6743 
6744 template<>
6745 inline void Message::SetPayload<Raw>(const Raw &value)
6746 {
6747  if (value.size() > 0)
6748  {
6749  Check(OCI_MsgSetRaw(*this, static_cast<AnyPointer>(const_cast<Raw::value_type *>(&value[0])), static_cast<unsigned int>(value.size())));
6750  }
6751  else
6752  {
6753  Check(OCI_MsgSetRaw(*this, nullptr, 0));
6754  }
6755 }
6756 
6757 inline Date Message::GetEnqueueTime() const
6758 {
6759  return Date(Check(OCI_MsgGetEnqueueTime(*this)), nullptr);
6760 }
6761 
6762 inline int Message::GetAttemptCount() const
6763 {
6764  return Check(OCI_MsgGetAttemptCount(*this));
6765 }
6766 
6768 {
6769  return MessageState(static_cast<MessageState::Type>(Check(OCI_MsgGetState(*this))));
6770 }
6771 
6772 inline Raw Message::GetID() const
6773 {
6774  unsigned int size = OCI_SIZE_BUFFER;
6775 
6776  ManagedBuffer<unsigned char> buffer(size + 1);
6777 
6778  Check(OCI_MsgGetID(*this, static_cast<AnyPointer>(buffer), &size));
6779 
6780  return MakeRaw(buffer, size);
6781 }
6782 
6783 inline int Message::GetExpiration() const
6784 {
6785  return Check(OCI_MsgGetExpiration(*this));
6786 }
6787 
6788 inline void Message::SetExpiration(int value)
6789 {
6790  Check(OCI_MsgSetExpiration(*this, value));
6791 }
6792 
6793 inline int Message::GetEnqueueDelay() const
6794 {
6795  return Check(OCI_MsgGetEnqueueDelay(*this));
6796 }
6797 
6798 inline void Message::SetEnqueueDelay(int value)
6799 {
6800  Check(OCI_MsgSetEnqueueDelay(*this, value));
6801 }
6802 
6803 inline int Message::GetPriority() const
6804 {
6805  return Check(OCI_MsgGetPriority(*this));
6806 }
6807 
6808 inline void Message::SetPriority(int value)
6809 {
6810  Check(OCI_MsgSetPriority(*this, value));
6811 }
6812 
6813 inline Raw Message::GetOriginalID() const
6814 {
6815  unsigned int size = OCI_SIZE_BUFFER;
6816 
6817  ManagedBuffer<unsigned char> buffer(size + 1);
6818 
6819  Check(OCI_MsgGetOriginalID(*this, static_cast<AnyPointer>(buffer), &size));
6820 
6821  return MakeRaw(buffer, size);
6822 }
6823 
6824 inline void Message::SetOriginalID(const Raw &value)
6825 {
6826  if (value.size() > 0)
6827  {
6828  Check(OCI_MsgSetOriginalID(*this, static_cast<AnyPointer>(const_cast<Raw::value_type *>(&value[0])), static_cast<unsigned int>(value.size())));
6829  }
6830  else
6831  {
6832  Check(OCI_MsgSetOriginalID(*this, nullptr, 0));
6833  }
6834 }
6835 
6836 inline ostring Message::GetCorrelation() const
6837 {
6838  return MakeString(Check(OCI_MsgGetCorrelation(*this)));
6839 }
6840 
6841 inline void Message::SetCorrelation(const ostring& value)
6842 {
6843  Check(OCI_MsgSetCorrelation(*this, value.c_str()));
6844 }
6845 
6846 inline ostring Message::GetExceptionQueue() const
6847 {
6848  return MakeString(Check(OCI_MsgGetExceptionQueue(*this)));
6849 }
6850 
6851 inline void Message::SetExceptionQueue(const ostring& value)
6852 {
6853  Check(OCI_MsgSetExceptionQueue(*this, value.c_str()));
6854 }
6855 
6857 {
6858  return Agent(Check(OCI_MsgGetSender(*this)), nullptr);
6859 }
6860 
6861 inline void Message::SetSender(const Agent &agent)
6862 {
6863  Check(OCI_MsgSetSender(*this, agent));
6864 }
6865 
6866 inline void Message::SetConsumers(std::vector<Agent> &agents)
6867 {
6868  size_t size = agents.size();
6869  ManagedBuffer<OCI_Agent*> buffer(size);
6870 
6871  OCI_Agent ** pAgents = static_cast<OCI_Agent **>(buffer);
6872 
6873  for (size_t i = 0; i < size; ++i)
6874  {
6875  pAgents[i] = static_cast<const Agent &>(agents[i]);
6876  }
6877 
6878  Check(OCI_MsgSetConsumers(*this, pAgents, static_cast<unsigned int>(size)));
6879 }
6880 
6881 /* --------------------------------------------------------------------------------------------- *
6882  * Enqueue
6883  * --------------------------------------------------------------------------------------------- */
6884 
6885 inline Enqueue::Enqueue(const TypeInfo &typeInfo, const ostring& queueName)
6886 {
6887  Acquire(Check(OCI_EnqueueCreate(typeInfo, queueName.c_str())), reinterpret_cast<HandleFreeFunc>(OCI_EnqueueFree), nullptr, nullptr);
6888 }
6889 
6890 inline void Enqueue::Put(const Message &message)
6891 {
6892  Check(OCI_EnqueuePut(*this, message));
6893 }
6894 
6896 {
6897  return EnqueueVisibility(static_cast<EnqueueVisibility::Type>(Check(OCI_EnqueueGetVisibility(*this))));
6898 }
6899 
6901 {
6902  Check(OCI_EnqueueSetVisibility(*this, value));
6903 }
6904 
6906 {
6907  return EnqueueMode(static_cast<EnqueueMode::Type>(Check(OCI_EnqueueGetSequenceDeviation(*this))));
6908 }
6909 
6910 inline void Enqueue::SetMode(EnqueueMode value)
6911 {
6912  Check(OCI_EnqueueSetSequenceDeviation(*this, value));
6913 }
6914 
6915 inline Raw Enqueue::GetRelativeMsgID() const
6916 {
6917  unsigned int size = OCI_SIZE_BUFFER;
6918 
6919  ManagedBuffer<unsigned char> buffer(size + 1);
6920 
6921  Check(OCI_EnqueueGetRelativeMsgID(*this, static_cast<AnyPointer>(buffer), &size));
6922 
6923  return MakeRaw(buffer, size);
6924 }
6925 
6926 inline void Enqueue::SetRelativeMsgID(const Raw &value)
6927 {
6928  if (value.size() > 0)
6929  {
6930  Check(OCI_EnqueueSetRelativeMsgID(*this, static_cast<AnyPointer>(const_cast<Raw::value_type *>(&value[0])), static_cast<unsigned int>(value.size())));
6931  }
6932  else
6933  {
6934  Check(OCI_EnqueueSetRelativeMsgID(*this, nullptr, 0));
6935  }
6936 }
6937 
6938 /* --------------------------------------------------------------------------------------------- *
6939  * Dequeue
6940  * --------------------------------------------------------------------------------------------- */
6941 
6942 inline Dequeue::Dequeue(const TypeInfo &typeInfo, const ostring& queueName)
6943 {
6944  Acquire(Check(OCI_DequeueCreate(typeInfo, queueName.c_str())), reinterpret_cast<HandleFreeFunc>(OCI_DequeueFree), nullptr, nullptr);
6945 }
6946 
6947 inline Dequeue::Dequeue(OCI_Dequeue *pDequeue)
6948 {
6949  Acquire(pDequeue, nullptr, nullptr, nullptr);
6950 }
6951 
6953 {
6954  return Message(Check(OCI_DequeueGet(*this)), nullptr);
6955 }
6956 
6957 inline Agent Dequeue::Listen(int timeout)
6958 {
6959  return Agent(Check(OCI_DequeueListen(*this, timeout)), nullptr);
6960 }
6961 
6962 inline ostring Dequeue::GetConsumer() const
6963 {
6964  return MakeString(Check(OCI_DequeueGetConsumer(*this)));
6965 }
6966 
6967 inline void Dequeue::SetConsumer(const ostring& value)
6968 {
6969  Check(OCI_DequeueSetConsumer(*this, value.c_str()));
6970 }
6971 
6972 inline ostring Dequeue::GetCorrelation() const
6973 {
6974  return MakeString(Check(OCI_DequeueGetCorrelation(*this)));
6975 }
6976 
6977 inline void Dequeue::SetCorrelation(const ostring& value)
6978 {
6979  Check(OCI_DequeueSetCorrelation(*this, value.c_str()));
6980 }
6981 
6982 inline Raw Dequeue::GetRelativeMsgID() const
6983 {
6984  unsigned int size = OCI_SIZE_BUFFER;
6985 
6986  ManagedBuffer<unsigned char> buffer(size + 1);
6987 
6988  Check(OCI_DequeueGetRelativeMsgID(*this, static_cast<AnyPointer>(buffer), &size));
6989 
6990  return MakeRaw(buffer, size);
6991 }
6992 
6993 inline void Dequeue::SetRelativeMsgID(const Raw &value)
6994 {
6995  if (value.size() > 0)
6996  {
6997  Check(OCI_DequeueSetRelativeMsgID(*this, static_cast<AnyPointer>(const_cast<Raw::value_type *>(&value[0])), static_cast<unsigned int>(value.size())));
6998  }
6999  else
7000  {
7001  Check(OCI_DequeueSetRelativeMsgID(*this, nullptr, 0));
7002  }
7003 }
7004 
7006 {
7007  return DequeueVisibility(static_cast<DequeueVisibility::Type>(Check(OCI_DequeueGetVisibility(*this))));
7008 }
7009 
7011 {
7012  Check(OCI_DequeueSetVisibility(*this, value));
7013 }
7014 
7016 {
7017  return DequeueMode(static_cast<DequeueMode::Type>(Check(OCI_DequeueGetMode(*this))));
7018 }
7019 
7020 inline void Dequeue::SetMode(DequeueMode value)
7021 {
7022  Check(OCI_DequeueSetMode(*this, value));
7023 }
7024 
7026 {
7027  return NavigationMode(static_cast<NavigationMode::Type>(Check(OCI_DequeueGetNavigation(*this))));
7028 }
7029 
7031 {
7032  Check(OCI_DequeueSetNavigation(*this, value));
7033 }
7034 
7035 inline int Dequeue::GetWaitTime() const
7036 {
7037  return Check(OCI_DequeueGetWaitTime(*this));
7038 }
7039 
7040 inline void Dequeue::SetWaitTime(int value)
7041 {
7042  Check(OCI_DequeueSetWaitTime(*this, value));
7043 }
7044 
7045 inline void Dequeue::SetAgents(std::vector<Agent> &agents)
7046 {
7047  size_t size = agents.size();
7048  ManagedBuffer<OCI_Agent*> buffer(size);
7049 
7050  OCI_Agent ** pAgents = static_cast<OCI_Agent **>(buffer);
7051 
7052  for (size_t i = 0; i < size; ++i)
7053  {
7054  pAgents[i] = static_cast<const Agent &>(agents[i]);
7055  }
7056 
7057  Check(OCI_DequeueSetAgentList(*this, pAgents, static_cast<unsigned int>(size)));
7058 }
7059 
7060 inline void Dequeue::Subscribe(unsigned int port, unsigned int timeout, NotifyAQHandlerProc handler)
7061 {
7062  Check(OCI_DequeueSubscribe(*this, port, timeout, static_cast<POCI_NOTIFY_AQ>(handler != nullptr ? Environment::NotifyHandlerAQ : nullptr)));
7063 
7064  Environment::SetUserCallback<NotifyAQHandlerProc>(static_cast<OCI_Dequeue*>(*this), handler);
7065 }
7066 
7068 {
7069  Check(OCI_DequeueUnsubscribe(*this));
7070 }
7071 
7072 /* --------------------------------------------------------------------------------------------- *
7073  * DirectPath
7074  * --------------------------------------------------------------------------------------------- */
7075 
7076 inline DirectPath::DirectPath(const TypeInfo &typeInfo, unsigned int nbCols, unsigned int nbRows, const ostring& partition)
7077 {
7078  Acquire(Check(OCI_DirPathCreate(typeInfo, partition.c_str(), nbCols, nbRows)), reinterpret_cast<HandleFreeFunc>(OCI_DirPathFree), nullptr, nullptr);
7079 }
7080 
7081 inline void DirectPath::SetColumn(unsigned int colIndex, const ostring& name, unsigned int maxSize, const ostring& format)
7082 {
7083  Check(OCI_DirPathSetColumn(*this, colIndex, name.c_str(), maxSize, format.c_str()));
7084 }
7085 
7086 template<class T>
7087 inline void DirectPath::SetEntry(unsigned int rowIndex, unsigned int colIndex, const T &value, bool complete)
7088 {
7089  Check(OCI_DirPathSetEntry(*this, rowIndex, colIndex, static_cast<const AnyPointer>(const_cast<typename T::value_type *>(value.c_str())), static_cast<unsigned int>(value.size()), complete));
7090 }
7091 
7092 inline void DirectPath::Reset()
7093 {
7094  Check(OCI_DirPathReset(*this));
7095 }
7096 
7097 inline void DirectPath::Prepare()
7098 {
7099  Check(OCI_DirPathPrepare(*this));
7100 }
7101 
7103 {
7104  return Result(static_cast<Result::Type>(Check(OCI_DirPathConvert(*this))));
7105 }
7106 
7108 {
7109  return Result(static_cast<Result::Type>(Check(OCI_DirPathLoad(*this))));
7110 }
7111 
7112 inline void DirectPath::Finish()
7113 {
7114  Check(OCI_DirPathFinish(*this));
7115 }
7116 
7117 inline void DirectPath::Abort()
7118 {
7119  Check(OCI_DirPathAbort(*this));
7120 }
7121 
7122 inline void DirectPath::Save()
7123 {
7124  Check(OCI_DirPathSave(*this));
7125 }
7126 
7128 {
7129  Check(OCI_DirPathFlushRow(*this));
7130 }
7131 
7132 inline void DirectPath::SetCurrentRows(unsigned int value)
7133 {
7134  Check(OCI_DirPathSetCurrentRows(*this, value));
7135 }
7136 
7137 inline unsigned int DirectPath::GetCurrentRows() const
7138 {
7139  return Check(OCI_DirPathGetCurrentRows(*this));
7140 }
7141 
7142 inline unsigned int DirectPath::GetMaxRows() const
7143 {
7144  return Check(OCI_DirPathGetMaxRows(*this));
7145 }
7146 
7147 inline unsigned int DirectPath::GetRowCount() const
7148 {
7149  return Check(OCI_DirPathGetRowCount(*this));
7150 }
7151 
7152 inline unsigned int DirectPath::GetAffectedRows() const
7153 {
7154  return Check(OCI_DirPathGetAffectedRows(*this));
7155 }
7156 
7157 inline void DirectPath::SetDateFormat(const ostring& format)
7158 {
7159  Check(OCI_DirPathSetDateFormat(*this, format.c_str()));
7160 }
7161 
7162 inline void DirectPath::SetParallel(bool value)
7163 {
7164  Check(OCI_DirPathSetParallel(*this, value));
7165 }
7166 
7167 inline void DirectPath::SetNoLog(bool value)
7168 {
7169  Check(OCI_DirPathSetNoLog(*this, value));
7170 }
7171 
7172 inline void DirectPath::SetCacheSize(unsigned int value)
7173 {
7174  Check(OCI_DirPathSetCacheSize(*this, value));
7175 }
7176 
7177 inline void DirectPath::SetBufferSize(unsigned int value)
7178 {
7179  Check(OCI_DirPathSetBufferSize(*this, value));
7180 }
7181 
7183 {
7184  Check(OCI_DirPathSetConvertMode(*this, value));
7185 }
7186 
7187 inline unsigned int DirectPath::GetErrorColumn()
7188 {
7189  return Check(OCI_DirPathGetErrorColumn(*this));
7190 }
7191 
7192 inline unsigned int DirectPath::GetErrorRow()
7193 {
7194  return Check(OCI_DirPathGetErrorRow(*this));
7195 }
7196 
7197 /* --------------------------------------------------------------------------------------------- *
7198  * Queue
7199  * --------------------------------------------------------------------------------------------- */
7200 
7201 inline void Queue::Create(const Connection &connection, const ostring& queue, const ostring& table, QueueType queueType, unsigned int maxRetries,
7202  unsigned int retryDelay, unsigned int retentionTime, bool dependencyTracking, const ostring& comment)
7203 {
7204  Check(OCI_QueueCreate(connection, queue.c_str(), table.c_str(), queueType, maxRetries, retryDelay, retentionTime, dependencyTracking, comment.c_str()));
7205 }
7206 
7207 inline void Queue::Alter(const Connection &connection, const ostring& queue, unsigned int maxRetries, unsigned int retryDelay, unsigned int retentionTime, const ostring& comment)
7208 {
7209  Check(OCI_QueueAlter(connection, queue.c_str(), maxRetries, retryDelay, retentionTime, comment.c_str()));
7210 }
7211 
7212 inline void Queue::Drop(const Connection &connection, const ostring& queue)
7213 {
7214  Check(OCI_QueueDrop(connection, queue.c_str()));
7215 }
7216 
7217 inline void Queue::Start(const Connection &connection, const ostring& queue, bool enableEnqueue, bool enableDequeue)
7218 {
7219  Check(OCI_QueueStart(connection, queue.c_str(), enableEnqueue, enableDequeue));
7220 }
7221 
7222 inline void Queue::Stop(const Connection &connection, const ostring& queue, bool stopEnqueue, bool stopDequeue, bool wait)
7223 {
7224  Check(OCI_QueueStop(connection, queue.c_str(), stopEnqueue, stopDequeue, wait));
7225 }
7226 
7227 /* --------------------------------------------------------------------------------------------- *
7228  * QueueTable
7229  * --------------------------------------------------------------------------------------------- */
7230 
7231 inline void QueueTable::Create(const Connection &connection, const ostring& table, const ostring& payloadType, bool multipleConsumers, const ostring& storageClause, const ostring& sortList,
7232  GroupingMode groupingMode, const ostring& comment, unsigned int primaryInstance, unsigned int secondaryInstance, const ostring& compatible)
7233 
7234 {
7235  Check(OCI_QueueTableCreate(connection, table.c_str(), payloadType.c_str(), storageClause.c_str(), sortList.c_str(), multipleConsumers,
7236  groupingMode, comment.c_str(), primaryInstance, secondaryInstance, compatible.c_str()));
7237 }
7238 
7239 inline void QueueTable::Alter(const Connection &connection, const ostring& table, const ostring& comment, unsigned int primaryInstance, unsigned int secondaryInstance)
7240 {
7241  Check(OCI_QueueTableAlter(connection, table.c_str(), comment.c_str(), primaryInstance, secondaryInstance));
7242 }
7243 
7244 inline void QueueTable::Drop(const Connection &connection, const ostring& table, bool force)
7245 {
7246  Check(OCI_QueueTableDrop(connection, table.c_str(), force));
7247 }
7248 
7249 inline void QueueTable::Purge(const Connection &connection, const ostring& table, PurgeMode mode, const ostring& condition, bool block)
7250 {
7251  Check(OCI_QueueTablePurge(connection, table.c_str(), condition.c_str(), block, static_cast<unsigned int>(mode)));
7252 }
7253 
7254 inline void QueueTable::Migrate(const Connection &connection, const ostring& table, const ostring& compatible)
7255 {
7256  Check(OCI_QueueTableMigrate(connection, table.c_str(), compatible.c_str()));
7257 }
7258 
7263 }
OCI_EXPORT boolean OCI_API OCI_LobRead2(OCI_Lob *lob, void *buffer, unsigned int *char_count, unsigned int *byte_count)
Read a portion of a lob into the given buffer.
OCI_EXPORT OCI_Subscription *OCI_API OCI_EventGetSubscription(OCI_Event *event)
Return the subscription handle that generated this event.
Object()
Create an empty null Object instance.
TimestampType GetType() const
Return the type of the given timestamp object.
OCI_EXPORT boolean OCI_API OCI_ObjectSetFile(OCI_Object *obj, const otext *attr, OCI_File *value)
Set an object attribute of type File.
unsigned int GetAffectedRows() const
Return the number of rows affected by the SQL statement.
OCI_EXPORT boolean OCI_API OCI_BindUnsignedBigInt(OCI_Statement *stmt, const otext *name, big_uint *data)
Bind an unsigned big integer variable.
struct OCI_Agent OCI_Agent
OCILIB encapsulation of A/Q Agent.
Definition: ocilib.h:759
OCI_EXPORT unsigned int OCI_API OCI_GetLongMode(OCI_Statement *stmt)
Return the long data type handling mode of a SQL statement.
OCI_EXPORT unsigned int OCI_API OCI_EnqueueGetVisibility(OCI_Enqueue *enqueue)
Get the enqueuing/locking behavior.
OCI_EXPORT OCI_Column *OCI_API OCI_GetColumn(OCI_Resultset *rs, unsigned int index)
Return the column object handle at the given index in the resultset.
bool operator>(const Timestamp &other) const
Indicates if the current Timestamp value is superior to the given Timestamp value.
Interval operator-(const Interval &other) const
Return a new Interval holding the difference of the current Interval value and the given Interval val...
unsigned int GetLongMaxSize() const
Return the LONG data type piece buffer size.
Encapsulate a Resultset column or object member properties.
Definition: ocilib.hpp:6996
BindDirection GetDirection() const
Get the direction mode.
OCI_EXPORT int OCI_API OCI_ErrorGetInternalCode(OCI_Error *err)
Retrieve Internal Error code from error handle.
OCI_EXPORT big_int OCI_API OCI_ElemGetBigInt(OCI_Elem *elem)
Return the big int value of the given collection element.
void SetHours(int value)
Set the interval hours value.
OCI_EXPORT const otext *OCI_API OCI_GetVersionServer(OCI_Connection *con)
Return the connected database server version.
OCI_EXPORT boolean OCI_API OCI_DateLastDay(OCI_Date *date)
Place the last day of month (from the given date) into the given date.
unsigned int GetSubType() const
Return the OCILIB object subtype of a column.
OCI_EXPORT boolean OCI_API OCI_MsgGetID(OCI_Msg *msg, void *id, unsigned int *len)
Return the ID of the message.
Agent Listen(int timeout)
Listen for messages that match any recipient of the associated Agent list.
OCI_EXPORT big_uint OCI_API OCI_GetAllocatedBytes(unsigned int mem_type)
Return the current number of bytes allocated internally in the library.
OCI_EXPORT boolean OCI_API OCI_ConnectionFree(OCI_Connection *con)
Close a physical connection to an Oracle database server.
unsigned int GetColumnCount() const
Return the number of columns in the resultset.
Lob< Raw, LobBinary > Blob
Class handling BLOB oracle type.
Definition: ocilib.hpp:4481
OCI_EXPORT boolean OCI_API OCI_QueueStart(OCI_Connection *con, const otext *queue_name, boolean enqueue, boolean dequeue)
Start the given queue.
bool operator<(const Date &other) const
Indicates if the current date value is inferior to the given date value.
OCI_EXPORT boolean OCI_API OCI_DequeueSubscribe(OCI_Dequeue *dequeue, unsigned int port, unsigned int timeout, POCI_NOTIFY_AQ callback)
Subscribe for asynchronous messages notifications.
OCI_EXPORT const otext *OCI_API OCI_ServerGetOutput(OCI_Connection *con)
Retrieve one line of the server buffer.
ostring GetRowID() const
Return the rowid of the altered database object row.
OCI_EXPORT 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_EXPORT boolean OCI_API OCI_SubscriptionUnregister(OCI_Subscription *sub)
Unregister a previously registered notification.
STL compliant Collection Random iterator class.
Definition: ocilib.hpp:5118
OCI_EXPORT unsigned int OCI_API OCI_LobGetType(OCI_Lob *lob)
Return the type of the given Lob object.
void Open(const ostring &db, const ostring &user, const ostring &pwd, Pool::PoolType poolType, unsigned int minSize, unsigned int maxSize, unsigned int increment=1, Environment::SessionFlags sessionFlags=Environment::SessionDefault)
Create an Oracle pool of connections or sessions.
static void Initialize(EnvironmentFlags mode=Environment::Default, const ostring &libpath=OTEXT(""))
Initialize the OCILIB environment.
OCI_EXPORT boolean OCI_API OCI_CollClear(OCI_Coll *coll)
clear all items of the given collection
bool IsValid() const
Check if the given date is valid.
OCI_EXPORT boolean OCI_API OCI_BindSetNullAtPos(OCI_Bind *bnd, unsigned int position)
Set to null the entry in the bind variable input array.
OCI_EXPORT OCI_Object *OCI_API OCI_ObjectCreate(OCI_Connection *con, OCI_TypeInfo *typinf)
Create a local object instance.
Timestamp & operator-=(int value)
Decrement the Timestamp by the given number of days.
OCI_EXPORT unsigned int OCI_API OCI_MsgGetState(OCI_Msg *msg)
Return the state of the message at the time of the dequeue.
OCI_EXPORT boolean OCI_API OCI_ElemSetNull(OCI_Elem *elem)
Set a collection element value to null.
OCI_EXPORT boolean OCI_API OCI_ObjectSetLob(OCI_Object *obj, const otext *attr, OCI_Lob *value)
Set an object attribute of type Lob.
unsigned int GetCurrentRow() const
Retrieve the current row index.
OCI_EXPORT boolean OCI_API OCI_ExecuteStmt(OCI_Statement *stmt, const otext *sql)
Prepare and Execute a SQL statement or PL/SQL block.
OCI_EXPORT boolean OCI_API OCI_ObjectSetNull(OCI_Object *obj, const otext *attr)
Set an object attribute to null.
OCI_EXPORT OCI_Column *OCI_API OCI_GetColumn2(OCI_Resultset *rs, const otext *name)
Return the column object handle from its name in the resultset.
int GetYear() const
Return the timestamp year value.
OCI_EXPORT boolean OCI_API OCI_DateAddDays(OCI_Date *date, int nb)
Add or subtract days to a date handle.
bool IsRemote() const
Check if the given lob is a remote lob.
OCI_EXPORT boolean OCI_API OCI_RegisterUnsignedShort(OCI_Statement *stmt, const otext *name)
Register an unsigned short output bind placeholder.
bool operator!=(const Interval &other) const
Indicates if the current Interval value is not equal the given Interval value.
Statement GetStatement() const
Return the statement associated with the bind object.
OCI_EXPORT boolean OCI_API OCI_RegisterUnsignedBigInt(OCI_Statement *stmt, const otext *name)
Register an unsigned big integer output bind placeholder.
Connection GetConnection() const
Return the lob parent connection.
void(* NotifyAQHandlerProc)(Dequeue &dequeue)
User callback for dequeue event notifications.
Definition: ocilib.hpp:8080
unsigned int GetErrorRow()
Return the index of a row which caused an error during data conversion.
void SetCacheSize(unsigned int value)
Set number of elements in the date cache.
OCI_EXPORT boolean OCI_API OCI_EnqueueSetRelativeMsgID(OCI_Enqueue *enqueue, const void *id, unsigned int len)
Set a message identifier to use for enqueuing messages using a sequence deviation.
OCI_EXPORT boolean OCI_API OCI_RegisterFile(OCI_Statement *stmt, const otext *name, unsigned int type)
Register a file output bind placeholder.
void SetTAFHandler(TAFHandlerProc handler)
Set the Transparent Application Failover (TAF) user handler.
OCI_EXPORT unsigned int OCI_API OCI_GetPrefetchSize(OCI_Statement *stmt)
Return the number of rows pre-fetched by OCI Client.
OCI_EXPORT boolean OCI_API OCI_RegisterDate(OCI_Statement *stmt, const otext *name)
Register a date output bind placeholder.
Lob & operator+=(const Lob &other)
Appending the given lob content to the current lob content.
void GetDateTime(int &year, int &month, int &day, int &hour, int &min, int &sec, int &fsec) const
Extract date and time parts.
void SetFetchSize(unsigned int value)
Set the number of rows fetched per internal server fetch call.
bool Delete(unsigned int index) const
Delete the element at the given position in the Nested Table Collection.
static void EnableWarnings(bool value)
Enable or disable Oracle warning notifications.
Interval()
Create an empty null Interval instance.
ostring GetPassword() const
Return the current logged user password.
OCI_EXPORT OCI_Statement *OCI_API OCI_StatementCreate(OCI_Connection *con)
Create a statement object and return its handle.
OCI_EXPORT boolean OCI_API OCI_ServerDisableOutput(OCI_Connection *con)
Disable the server output.
static unsigned int GetCompileRevisionVersion()
Return the revision version number of OCI used for compiling OCILIB.
void SetFetchMode(FetchMode value)
Set the fetch mode of a SQL statement.
OCI_EXPORT boolean OCI_API OCI_BindUnsignedInt(OCI_Statement *stmt, const otext *name, unsigned int *data)
Bind an unsigned integer variable.
OCI_EXPORT boolean OCI_API OCI_RefSetNull(OCI_Ref *ref)
Nullify the given Ref handle.
struct OCI_Connection OCI_Connection
Oracle physical connection.
Definition: ocilib.h:423
OCI_EXPORT int OCI_API OCI_ObjectGetInt(OCI_Object *obj, const otext *attr)
Return the integer value of the given object attribute.
void FromString(const ostring &str, const ostring &format=OTEXT("")) const
Assign to the number object the value provided by the input number time string.
int GetSeconds() const
Return the interval seconds value.
OCI_EXPORT boolean OCI_API OCI_ThreadRun(OCI_Thread *thread, POCI_THREAD proc, void *arg)
Execute the given routine within the given thread object.
Exception class handling all OCILIB errors.
Definition: ocilib.hpp:534
OCI_EXPORT unsigned int OCI_API OCI_GetLongMaxSize(OCI_Statement *stmt)
Return the LONG data type piece buffer size.
File()
Create an empty null File instance.
big_uint GetLength() const
Returns the number of bytes contained in the file.
void SetMinutes(int value)
Set the date minutes value.
OCI_EXPORT boolean OCI_API OCI_BindSetNotNullAtPos(OCI_Bind *bnd, unsigned int position)
Set to NOT null the entry in the bind variable input array.
OCI_EXPORT unsigned int OCI_API OCI_IntervalGetType(OCI_Interval *itv)
Return the type of the given Interval object.
unsigned int GetServerRevisionVersion() const
Return the revision version number of the connected database server.
bool IsCharSemanticUsed() const
Return true if the length of the column is character-length or false if it is byte-length.
Provides SQL bind informations.
Definition: ocilib.hpp:5508
bool IsColumnNull(unsigned int index) const
Check if the current row value is null for the column at the given index.
ostring GetServer() const
Return the Oracle server Hos name of the connected database/service name.
OCI_EXPORT boolean OCI_API OCI_DequeueFree(OCI_Dequeue *dequeue)
Free a Dequeue object.
OCI_EXPORT OCI_Connection *OCI_API OCI_ErrorGetConnection(OCI_Error *err)
Retrieve connection handle within the error occurred.
OCI_EXPORT boolean OCI_API OCI_NumberGetValue(OCI_Number *number, unsigned int type, void *value)
Assign the number value to a native C numeric type.
Date operator+(int value) const
Return a new date holding the current date value incremented by the given number of days...
void SetTrace(SessionTrace trace, const ostring &value)
Set tracing information for the session.
unsigned int GetPort() const
Return the port used by the notification.
OCI_EXPORT boolean OCI_API OCI_FileAssign(OCI_File *file, OCI_File *file_src)
Assign a file to another one.
unsigned int GetCount() const
Returns the current number of elements in the collection.
Resultset GetResultset()
Retrieve the resultset from an executed statement.
OCI_EXPORT boolean OCI_API OCI_DateFromText(OCI_Date *date, const otext *str, const otext *fmt)
Convert a string to a date and store it in the given date handle.
OCI_EXPORT const otext *OCI_API OCI_GetUserName(OCI_Connection *con)
Return the current logged user name.
OCI_EXPORT const otext *OCI_API OCI_ColumnGetSQLType(OCI_Column *col)
Return the Oracle SQL type name of the column data type.
OCI_EXPORT boolean OCI_API OCI_PoolSetStatementCacheSize(OCI_Pool *pool, unsigned int value)
Set the maximum number of statements to keep in the pool statement cache.
void SetCharsetForm(CharsetForm value)
Set the charset form of the given character based bind object.
ostring GetName() const
Return the name of the given registered subscription.
bool Next()
Fetch the next row of the resultset.
OCI_EXPORT boolean OCI_API OCI_DequeueSetWaitTime(OCI_Dequeue *dequeue, int timeout)
set the time that OCIDequeueGet() waits for messages if no messages are currently available ...
void Describe(const ostring &sql)
Describe the select list of a SQL select statement.
void SetNoLog(bool value)
Set the logging mode for the loading operation.
OCI_EXPORT boolean OCI_API OCI_FetchPrev(OCI_Resultset *rs)
Fetch the previous row of the resultset.
int GetSeconds() const
Return the timestamp seconds value.
OCI_EXPORT boolean OCI_API OCI_DequeueSetNavigation(OCI_Dequeue *dequeue, unsigned int position)
Set the position of messages to be retrieved.
OCI_EXPORT boolean OCI_API OCI_IsNull(OCI_Resultset *rs, unsigned int index)
Check if the current row value is null for the column at the given index in the resultset.
OCI_EXPORT unsigned int OCI_API OCI_ElemGetUnsignedInt(OCI_Elem *elem)
Return the unsigned int value of the given collection element.
OCI_EXPORT boolean OCI_API OCI_SetUserPassword(const otext *db, const otext *user, const otext *pwd, const otext *new_pwd)
Change the password of the given user on the given database.
OCI_EXPORT boolean OCI_API OCI_ObjectSetRaw(OCI_Object *obj, const otext *attr, void *value, unsigned int len)
Set an object attribute of type RAW.
ostring GetUserName() const
Return the current logged user name.
OCI_EXPORT const otext *OCI_API OCI_ObjectGetString(OCI_Object *obj, const otext *attr)
Return the string value of the given object attribute.
OCI_EXPORT big_uint OCI_API OCI_LobGetOffset(OCI_Lob *lob)
Return the current position in the Lob content buffer.
OCILIB ++ Namespace.
OCI_EXPORT boolean OCI_API OCI_IntervalSubtract(OCI_Interval *itv, OCI_Interval *itv2)
Subtract an interval handle value from another.
OCI_EXPORT 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.
void SetDefaultLobPrefetchSize(unsigned int value)
Enable or disable prefetching for all LOBs fetched in the connection.
void ChangePassword(const ostring &newPwd)
Change the password of the logged user.
OCI_EXPORT double OCI_API OCI_ObjectGetDouble(OCI_Object *obj, const otext *attr)
Return the double value of the given object attribute.
OCI_EXPORT boolean OCI_API OCI_BindString(OCI_Statement *stmt, const otext *name, otext *data, unsigned int len)
Bind a string variable.
void Set(unsigned int index, const T &value)
Set the collection element value at the given position.
OCI_EXPORT unsigned int OCI_API OCI_ObjectGetType(OCI_Object *obj)
Return the type of an object instance.
ostring GetName() const
Return the name of the bind object.
static void Purge(const Connection &connection, const ostring &table, PurgeMode mode, const ostring &condition=OTEXT(""), bool block=true)
Purge messages from the given queue table.
TypeInfo GetTypeInfo() const
Return the type information object associated to the collection.
static void Alter(const Connection &connection, const ostring &queue, unsigned int maxRetries=0, unsigned int retryDelay=0, unsigned int retentionTime=0, const ostring &comment=OTEXT(""))
Alter the given queue.
int GetMonth() const
Return the timestamp month value.
iterator begin()
Returns an iterator pointing to the first element in the collection.
OCI_EXPORT OCI_Enqueue *OCI_API OCI_EnqueueCreate(OCI_TypeInfo *typinf, const otext *name)
Create a Enqueue object for the given queue.
Enum< CharsetFormValues > CharsetForm
Type of charsetForm.
Definition: ocilib.hpp:359
OCI_EXPORT OCI_Elem *OCI_API OCI_ElemCreate(OCI_TypeInfo *typinf)
Create a local collection element instance based on a collection type descriptor. ...
OCI_EXPORT boolean OCI_API OCI_ElemSetRaw(OCI_Elem *elem, void *value, unsigned int len)
Set a RAW value to a collection element.
OCI_EXPORT const otext *OCI_API OCI_ColumnGetName(OCI_Column *col)
Return the name of the given column.
void FromString(const ostring &str, const ostring &format=OTEXT(""))
Assign to the date object the value provided by the input date time string.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfUnsignedShorts(OCI_Statement *stmt, const otext *name, unsigned short *data, unsigned int nbelem)
Bind an array of unsigned shorts.
Object Clone() const
Clone the current instance to a new one performing deep copy.
OCI_EXPORT int OCI_API OCI_ObjectGetRaw(OCI_Object *obj, const otext *attr, void *value, unsigned int len)
Return the raw attribute value of the given object attribute into the given buffer.
OCI_EXPORT boolean OCI_API OCI_BindArraySetSize(OCI_Statement *stmt, unsigned int size)
Set the input array size for bulk operations.
OCI_EXPORT OCI_File *OCI_API OCI_ElemGetFile(OCI_Elem *elem)
Return the File value of the given collection element.
void Put(const Message &message)
Enqueue a message the on queue associated to the Enqueue object.
OCI_EXPORT OCI_Connection *OCI_API OCI_PoolGetConnection(OCI_Pool *pool, const otext *tag)
Get a connection from the pool.
void SetAutoCommit(bool enabled)
Enable or disable auto commit mode (implicit commits after every SQL execution)
OCI_EXPORT unsigned int OCI_API OCI_GetTimeout(OCI_Connection *con, unsigned int type)
Returns the requested timeout value for OCI calls that require server round-trips to the given databa...
CollectionElement< T > operator[](unsigned int index)
Returns the element at a given position in the collection.
OCI_EXPORT boolean OCI_API OCI_IntervalFromTimeZone(OCI_Interval *itv, const otext *str)
Correct an interval handle value with the given time zone.
OCI_EXPORT unsigned int OCI_API OCI_GetImportMode(void)
Return the Oracle shared library import mode.
OCI_EXPORT unsigned int OCI_API OCI_BindGetDirection(OCI_Bind *bnd)
Get the direction mode of a bind handle.
Long< Raw, LongBinary > Blong
Class handling LONG RAW oracle type.
Definition: ocilib_impl.hpp:60
OCI_EXPORT OCI_Connection *OCI_API OCI_FileGetConnection(OCI_File *file)
Retrieve connection handle from the file handle.
OCI_EXPORT boolean OCI_API OCI_SetBindMode(OCI_Statement *stmt, unsigned int mode)
Set the binding mode of a SQL statement.
OCI_EXPORT boolean OCI_API OCI_ObjectToText(OCI_Object *obj, unsigned int *size, otext *str)
Convert an object handle value to a string.
OCI_EXPORT boolean OCI_API OCI_DequeueSetVisibility(OCI_Dequeue *dequeue, unsigned int visibility)
Set whether the new message is dequeued as part of the current transaction.
OCI_EXPORT OCI_Statement *OCI_API OCI_GetStatement(OCI_Resultset *rs, unsigned int index)
Return the current cursor value (Nested table) of the column at the given index in the resultset...
OCI_EXPORT boolean OCI_API OCI_FileExists(OCI_File *file)
Check if the given file exists on server.
OCI_EXPORT boolean OCI_API OCI_FetchLast(OCI_Resultset *rs)
Fetch the last row of the resultset.
unsigned int GetRow() const
Return the row index which caused an error during statement execution.
OCI_EXPORT boolean OCI_API OCI_BindStatement(OCI_Statement *stmt, const otext *name, OCI_Statement *data)
Bind a Statement variable (PL/SQL Ref Cursor)
OCI_EXPORT boolean OCI_API OCI_ObjectSetShort(OCI_Object *obj, const otext *attr, short value)
Set an object attribute of type short.
bool IsTemporary() const
Check if the given lob is a temporary lob.
OCI_EXPORT boolean OCI_API OCI_DateAddMonths(OCI_Date *date, int nb)
Add or subtract months to a date handle.
ostring ToString() const override
Convert the interval value to a string using the default precisions of 10.
void Forget()
Cancel the prepared global transaction validation.
T Get(unsigned int index) const
Return the current value of the column at the given index in the resultset.
void ChangeTimeZone(const ostring &tzSrc, const ostring &tzDst)
Convert the date from one zone to another zone.
ostring GetAddress() const
Get the given AQ agent address.
OCI_EXPORT boolean OCI_API OCI_MutexAcquire(OCI_Mutex *mutex)
Acquire a mutex lock.
OCI_EXPORT boolean OCI_API OCI_ElemSetString(OCI_Elem *elem, const otext *value)
Set a string value to a collection element.
bool operator++(int)
Convenient operator overloading that performs a call to Next()
int GetMonth() const
Return the interval month value.
void SetDaySecond(int day, int hour, int min, int sec, int fsec)
Set the Day / Second parts.
Subscription Event.
Definition: ocilib.hpp:7334
OCI_EXPORT boolean OCI_API OCI_Ping(OCI_Connection *con)
Makes a round trip call to the server to confirm that the connection and the server are active...
big_uint GetChunkSize() const
Returns the current lob chunk size.
StatementType GetStatementType() const
Return the type of a SQL statement.
OCI_EXPORT unsigned int OCI_API OCI_GetAffectedRows(OCI_Statement *stmt)
Return the number of rows affected by the SQL statement.
Date LastDay() const
Return the last day of month from the current date object.
OCI_EXPORT unsigned int OCI_API OCI_LobRead(OCI_Lob *lob, void *buffer, unsigned int len)
[OBSOLETE] Read a portion of a lob into the given buffer
void Open()
Open a file for reading on the server.
void SetHours(int value)
Set the timestamp hours value.
static void Alter(const Connection &connection, const ostring &table, const ostring &comment, unsigned int primaryInstance=0, unsigned int secondaryInstance=0)
Alter the given queue table.
Reference Clone() const
Clone the current instance to a new one performing deep copy.
int GetDay() const
Return the interval day value.
Subscription()
Default constructor.
OCI_EXPORT unsigned short OCI_API OCI_GetUnsignedShort2(OCI_Resultset *rs, const otext *name)
Return the current unsigned short value of the column from its name in the resultset.
OCI_EXPORT boolean OCI_API OCI_ElemSetInterval(OCI_Elem *elem, OCI_Interval *value)
Assign an Interval handle to a collection element.
unsigned int GetRowCount() const
Return the number of rows successfully loaded into the database so far.
Subscription GetSubscription() const
Return the subscription that generated this event.
OCI_EXPORT unsigned int OCI_API OCI_PoolGetStatementCacheSize(OCI_Pool *pool)
Return the maximum number of statements to keep in the pool statement cache.
unsigned int GetSubType() const
Return the OCILIB object subtype of a column.
OCI_EXPORT boolean OCI_API OCI_BindDouble(OCI_Statement *stmt, const otext *name, double *data)
Bind a double variable.
OCI_EXPORT OCI_Ref *OCI_API OCI_ObjectGetRef(OCI_Object *obj, const otext *attr)
Return the Ref value of the given object attribute.
OCI_EXPORT boolean OCI_API OCI_ObjectSetDouble(OCI_Object *obj, const otext *attr, double value)
Set an object attribute of type double.
Date NextDay(const ostring &day) const
Return the date of next day of the week, after the current date object.
OCI_EXPORT OCI_Lob *OCI_API OCI_GetLob2(OCI_Resultset *rs, const otext *name)
Return the current lob value of the column from its name in the resultset.
Date(bool create=false)
Create an empty null Date object.
Enum< LobTypeValues > LobType
Type of Lob.
Definition: ocilib.hpp:474
OCI_EXPORT int OCI_API OCI_ColumnGetScale(OCI_Column *col)
Return the scale of the column for numeric columns.
static void Release(MutexHandle handle)
Release a mutex lock.
OCI_EXPORT boolean OCI_API OCI_SetDefaultLobPrefetchSize(OCI_Connection *con, unsigned int value)
Enable or disable prefetching for all LOBs fetched in the connection.
int GetMinutes() const
Return the date minutes value.
OCI_EXPORT boolean OCI_API OCI_CollDeleteElem(OCI_Coll *coll, unsigned int index)
Delete the element at the given position in the Nested Table Collection.
OCI_EXPORT boolean OCI_API OCI_TimestampFromText(OCI_Timestamp *tmsp, const otext *str, const otext *fmt)
Convert a string to a timestamp and store it in the given timestamp handle.
OCI_EXPORT int OCI_API OCI_DateCompare(OCI_Date *date, OCI_Date *date2)
Compares two date handles.
Enum< DataTypeValues > DataType
Column data type.
Definition: ocilib.hpp:301
OCI_Mutex * MutexHandle
Alias for an OCI_Mutex pointer.
Definition: ocilib.hpp:187
static void Drop(const Connection &connection, const ostring &queue)
Drop the given queue.
struct OCI_XID OCI_XID
Global transaction identifier.
void Copy(Lob &dest, big_uint offset, big_uint offsetDest, big_uint length) const
Copy the given portion of the lob content to another one.
ostring GetMessage() const
Retrieve the error message.
OCI_EXPORT boolean OCI_API OCI_MsgSetOriginalID(OCI_Msg *msg, const void *id, unsigned int len)
Set the original ID of the message in the last queue that generated this message. ...
Timestamp Clone() const
Clone the current instance to a new one performing deep copy.
OCI_EXPORT OCI_Interval *OCI_API OCI_GetInterval(OCI_Resultset *rs, unsigned int index)
Return the current interval value of the column at the given index in the resultset.
OCI_EXPORT boolean OCI_API OCI_ObjectSetRef(OCI_Object *obj, const otext *attr, OCI_Ref *value)
Set an object attribute of type Ref.
static ostring GetFormat(FormatType formatType)
Return the format string for implicit string conversions of the given type.
OCI_EXPORT OCI_Bind *OCI_API OCI_GetBind(OCI_Statement *stmt, unsigned int index)
Return the bind handle at the given index in the internal array of bind handle.
int GetHours() const
Return the interval hours value.
OCI_EXPORT OCI_Lob *OCI_API OCI_ObjectGetLob(OCI_Object *obj, const otext *attr)
Return the lob value of the given object attribute.
bool operator<=(const Date &other) const
Indicates if the current date value is inferior or equal to the given date value. ...
OCI_EXPORT boolean OCI_API OCI_NumberAdd(OCI_Number *number, unsigned int type, void *value)
Add the value of a native C numeric type to the given number.
unsigned int GetBindIndex(const ostring &name) const
Return the index of the bind from its name belonging to the statement.
OCI_EXPORT boolean OCI_API OCI_MsgGetOriginalID(OCI_Msg *msg, void *id, unsigned int *len)
Return the original ID of the message in the last queue that generated this message.
OCI_EXPORT boolean OCI_API OCI_ObjectSetNumber(OCI_Object *obj, const otext *attr, OCI_Number *value)
Set an object attribute of type number.
static void ShutdownDatabase(const ostring &db, const ostring &user, const ostring &pwd, Environment::ShutdownFlags shutdownFlags, Environment::ShutdownMode shutdownMode, Environment::SessionFlags sessionFlags=SessionSysDba)
Shutdown a database instance.
A connection or session with a specific database.
Definition: ocilib.hpp:1738
ostring GetFullSQLType() const
Return the Oracle SQL Full name including precision and size of the column data type.
OCI_EXPORT boolean OCI_API OCI_DirPathSetBufferSize(OCI_DirPath *dp, unsigned int size)
Set the size of the internal stream transfer buffer.
Lob()
Create an empty null Lob instance.
OCI_EXPORT boolean OCI_API OCI_Commit(OCI_Connection *con)
Commit current pending changes.
OCI_EXPORT boolean OCI_API OCI_NumberDivide(OCI_Number *number, unsigned int type, void *value)
Divide the given number with the value of a native C numeric.
OCI_EXPORT OCI_Ref *OCI_API OCI_GetRef(OCI_Resultset *rs, unsigned int index)
Return the current Ref value of the column at the given index in the resultset.
void Convert(const Timestamp &other)
Convert the current timestamp to the type of the given timestamp.
OCI_EXPORT boolean OCI_API OCI_StatementFree(OCI_Statement *stmt)
Free a statement and all resources associated to it (resultsets ...)
DequeueVisibility GetVisibility() const
Get the dequeuing/locking behavior.
OCI_EXPORT const otext *OCI_API OCI_GetString(OCI_Resultset *rs, unsigned int index)
Return the current string value of the column at the given index in the resultset.
unsigned int GetOpenedConnectionsCount() const
Return the current number of opened connections/sessions.
void Close()
Close the physical connection to the DB server.
OCI_EXPORT boolean OCI_API OCI_ElemSetBigInt(OCI_Elem *elem, big_int value)
Set a big int value to a collection element.
OCI_EXPORT unsigned int OCI_API OCI_ErrorGetType(OCI_Error *err)
Retrieve the type of error from error handle.
OCI_EXPORT int OCI_API OCI_DateCheck(OCI_Date *date)
Check if the given date is valid.
TypeInfo GetTypeInfo() const
Return the TypeInfo object describing the object.
Timestamp & operator+=(int value)
Increment the Timestamp by the given number of days.
int DaysBetween(const Date &other) const
Return the number of days with the given date.
void SetYear(int value)
Set the interval year value.
OCI_EXPORT boolean OCI_API OCI_BindBigInt(OCI_Statement *stmt, const otext *name, big_int *data)
Bind a big integer variable.
OCI_EXPORT unsigned int OCI_API OCI_DirPathLoad(OCI_DirPath *dp)
Loads the data converted to direct path stream format.
OCI_EXPORT OCI_Date *OCI_API OCI_GetDate(OCI_Resultset *rs, unsigned int index)
Return the current date value of the column at the given index in the resultset.
void SetExceptionQueue(const ostring &value)
Set the name of the queue to which the message is moved to if it cannot be processed successfully...
OCI_EXPORT boolean OCI_API OCI_Break(OCI_Connection *con)
Perform an immediate abort of any currently Oracle OCI call.
big_uint GetOffset() const
Returns the current R/W offset within the file.
NavigationMode GetNavigation() const
Return the navigation position of messages to retrieve from the queue.
T Read(unsigned int length)
Read a portion of a lob.
OCI_EXPORT boolean OCI_API OCI_SetTAFHandler(OCI_Connection *con, POCI_TAF_HANDLER handler)
Set the Transparent Application Failover (TAF) user handler.
OCI_EXPORT boolean OCI_API OCI_DirPathFree(OCI_DirPath *dp)
Free an OCI_DirPath handle.
static void Join(ThreadHandle handle)
Join the given thread.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfIntervals(OCI_Statement *stmt, const otext *name, OCI_Interval **data, unsigned int type, unsigned int nbelem)
Bind an array of interval handles.
OCI_EXPORT unsigned int OCI_API OCI_FileRead(OCI_File *file, void *buffer, unsigned int len)
Read a portion of a file into the given buffer.
void SetBindMode(BindMode value)
Set the binding mode of a SQL statement.
struct OCI_Interval OCI_Interval
Oracle internal interval representation.
Definition: ocilib.h:598
Object identifying the SQL data type LONG.
Definition: ocilib.hpp:5446
OCI_EXPORT const otext *OCI_API OCI_GetSqlIdentifier(OCI_Statement *stmt)
Returns the statement SQL_ID from the server.
OCI_EXPORT boolean OCI_API OCI_DateFree(OCI_Date *date)
Free a date object.
OCI_EXPORT const otext *OCI_API OCI_MsgGetExceptionQueue(OCI_Msg *msg)
Get the Exception queue name of the message.
bool operator!=(const Timestamp &other) const
Indicates if the current Timestamp value is not equal the given Timestamp value.
static unsigned int GetCompileMinorVersion()
Return the minor version number of OCI used for compiling OCILIB.
bool operator>(const Interval &other) const
Indicates if the current Interval value is superior to the given Interval value.
struct OCI_Dequeue OCI_Dequeue
OCILIB encapsulation of A/Q dequeuing operations.
Definition: ocilib.h:769
int GetOracleErrorCode() const
Return the Oracle error code.
void Register(const Connection &connection, const ostring &name, ChangeTypes changeTypes, NotifyHandlerProc handler, unsigned int port=0, unsigned int timeout=0)
Register a notification against the given database.
Oracle Transaction object.
Definition: ocilib.hpp:2533
OCI_EXPORT OCI_Object *OCI_API OCI_GetObject2(OCI_Resultset *rs, const otext *name)
Return the current Object value of the column from its name in the resultset.
OCI_EXPORT boolean OCI_API OCI_GetAutoCommit(OCI_Connection *con)
Get current auto commit mode status.
OCI_EXPORT unsigned short OCI_API OCI_ElemGetUnsignedShort(OCI_Elem *elem)
Return the unsigned short value of the given collection element.
struct OCI_Statement OCI_Statement
Oracle SQL or PL/SQL statement.
Definition: ocilib.h:435
bool IsNullable() const
Return true if the column is nullable otherwise false.
Agent(const Connection &connection, const ostring &name=OTEXT(""), const ostring &address=OTEXT(""))
Create an AQ agent object.
OCI_EXPORT OCI_Ref *OCI_API OCI_GetRef2(OCI_Resultset *rs, const otext *name)
Return the current Ref value of the column from its name in the resultset.
OCI_EXPORT big_uint OCI_API OCI_FileGetSize(OCI_File *file)
Return the size in bytes of a file.
OCI_EXPORT OCI_File *OCI_API OCI_GetFile2(OCI_Resultset *rs, const otext *name)
Return the current File value of the column from its name in the resultset.
void SetMinutes(int value)
Set the interval minutes value.
int GetMinutes() const
Return the timestamp minutes value.
static unsigned int GetCompileMajorVersion()
Return the major version number of OCI used for compiling OCILIB.
Raw MakeRaw(void *result, unsigned int size)
Internal usage. Constructs a C++ Raw object from the given OCILIB raw buffer.
OCI_EXPORT boolean OCI_API OCI_BindInterval(OCI_Statement *stmt, const otext *name, OCI_Interval *data)
Bind an interval variable.
OCI_EXPORT boolean OCI_API OCI_FileSetName(OCI_File *file, const otext *dir, const otext *name)
Set the directory and file name of FILE handle.
OCI_EXPORT int OCI_API OCI_ErrorGetOCICode(OCI_Error *err)
Retrieve Oracle Error code from error handle.
OCI_EXPORT const otext *OCI_API OCI_MsgGetCorrelation(OCI_Msg *msg)
Get the correlation identifier of the message.
OCI_EXPORT int OCI_API OCI_DateAssign(OCI_Date *date, OCI_Date *date_src)
Assign the value of a date handle to another one.
void ExecutePrepared()
Execute a prepared SQL statement or PL/SQL block.
struct OCI_Bind OCI_Bind
Internal bind representation.
Definition: ocilib.h:447
ostring GetObjectName() const
Return the name of the object that generated the event.
OCI_EXPORT boolean OCI_API OCI_BindInt(OCI_Statement *stmt, const otext *name, int *data)
Bind an integer variable.
OCI_EXPORT boolean OCI_API OCI_ThreadKeyCreate(const otext *name, POCI_THREADKEYDEST destfunc)
Create a thread key object.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfTimestamps(OCI_Statement *stmt, const otext *name, OCI_Timestamp **data, unsigned int type, unsigned int nbelem)
Bind an array of timestamp handles.
OCI_EXPORT boolean OCI_API OCI_ObjectSetObject(OCI_Object *obj, const otext *attr, OCI_Object *value)
Set an object attribute of type Object.
int GetHours() const
Return the date hours value.
OCI_EXPORT boolean OCI_API OCI_NumberToText(OCI_Number *number, const otext *fmt, int size, otext *str)
Convert a number value from the given number handle to a string.
OCI_EXPORT boolean OCI_API OCI_TimestampGetDateTime(OCI_Timestamp *tmsp, int *year, int *month, int *day, int *hour, int *min, int *sec, int *fsec)
Extract the date and time parts from a date handle.
struct OCI_Subscription OCI_Subscription
OCILIB encapsulation of Oracle DCN notification.
Definition: ocilib.h:729
static Environment::EnvironmentFlags GetMode()
Return the Environment mode flags.
void Close()
Close explicitly a Lob.
int GetDay() const
Return the date day value.
TimestampTypeValues
Interval types enumerated values.
Definition: ocilib.hpp:3680
void Parse(const ostring &sql)
Parse a SQL statement or PL/SQL block.
OCI_EXPORT boolean OCI_API OCI_BindFile(OCI_Statement *stmt, const otext *name, OCI_File *data)
Bind a File variable.
ostring ToString() const override
return a string representation of the current collection
StartFlagsValues
Oracle instance start flags enumerated values.
Definition: ocilib.hpp:862
bool Last()
Fetch the last row of the resultset.
bool operator<(const Timestamp &other) const
Indicates if the current Timestamp value is inferior to the given Timestamp value.
AQ identified agent for messages delivery.
Definition: ocilib.hpp:7461
OCI_EXPORT boolean OCI_API OCI_BindArrayOfShorts(OCI_Statement *stmt, const otext *name, short *data, unsigned int nbelem)
Bind an array of shorts.
Enum< OracleVersionValues > OracleVersion
Oracle Version.
Definition: ocilib.hpp:255
TypeInfo GetTypeInfo() const
Return the type information object associated to the column.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfDoubles(OCI_Statement *stmt, const otext *name, double *data, unsigned int nbelem)
Bind an array of doubles.
virtual ~Exception()
Virtual destructor required for deriving from std::exception.
void SetEntry(unsigned int rowIndex, unsigned int colIndex, const T &value, bool complete=true)
Set the value of the given row/column array entry from the given string.
void SetSeconds(int value)
Set the date seconds value.
Column GetColumn(unsigned int index) const
Return the column from its index in the resultset.
OCI_EXPORT OCI_Statement *OCI_API OCI_ResultsetGetStatement(OCI_Resultset *rs)
Return the statement handle associated with a resultset handle.
OCI_EXPORT short OCI_API OCI_ObjectGetShort(OCI_Object *obj, const otext *attr)
Return the short value of the given object attribute.
OCI_EXPORT boolean OCI_API OCI_ObjectSetColl(OCI_Object *obj, const otext *attr, OCI_Coll *value)
Set an object attribute of type Collection.
OCI_EXPORT int OCI_API OCI_TimestampCompare(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp2)
Compares two timestamp handles.
OCI_EXPORT double OCI_API OCI_GetDouble2(OCI_Resultset *rs, const otext *name)
Return the current double value of the column from its name in the resultset.
ObjectEvent GetObjectEvent() const
Return the type of operation reported by a notification.
Simplified resolver for scalar types that do not need translation.
Definition: ocilib_impl.hpp:80
OCI_EXPORT boolean OCI_API OCI_ElemSetBoolean(OCI_Elem *elem, boolean value)
Set a boolean value to a collection element.
OCI_EXPORT boolean OCI_API OCI_BindObject(OCI_Statement *stmt, const otext *name, OCI_Object *data)
Bind an object (named type) variable.
Transaction GetTransaction() const
Return the current transaction of the connection.
OCI_EXPORT const otext *OCI_API OCI_SubscriptionGetName(OCI_Subscription *sub)
Return the name of the given registered subscription.
static Environment::ImportMode GetImportMode()
Return the Oracle shared library import mode.
OCI_EXPORT unsigned int OCI_API OCI_PoolGetOpenedCount(OCI_Pool *pool)
Return the current number of opened connections/sessions.
OCI_EXPORT OCI_Connection *OCI_API OCI_TypeInfoGetConnection(OCI_TypeInfo *typinf)
Retrieve connection handle from the type info handle.
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetSubType(OCI_Column *col)
Return the OCILIB object subtype of a column.
OCI_EXPORT unsigned int OCI_API OCI_BindGetDataSize(OCI_Bind *bnd)
Return the actual size of the element held by the given bind handle.
void Reset()
Reset internal arrays and streams to prepare another load.
int GetYear() const
Return the interval year value.
OCI_EXPORT boolean OCI_API OCI_FileIsOpen(OCI_File *file)
Check if the specified file is opened within the file handle.
OCI_EXPORT int OCI_API OCI_GetInt2(OCI_Resultset *rs, const otext *name)
Return the current integer value of the column from its name in the resultset.
ostring GetDatabase() const
Return the Oracle server database name of the connected database/service name.
OCI_EXPORT boolean OCI_API OCI_PoolSetNoWait(OCI_Pool *pool, boolean value)
Set the waiting mode used when no more connections/sessions are available from the pool...
void SetTimeout(TimeoutType timeout, unsigned int value)
Set a given timeout for OCI calls that require server round-trips to the given database.
OCI_EXPORT boolean OCI_API OCI_DateGetDateTime(OCI_Date *date, int *year, int *month, int *day, int *hour, int *min, int *sec)
Extract the date and time parts from a date handle.
OCI_EXPORT OCI_Long *OCI_API OCI_GetLong(OCI_Resultset *rs, unsigned int index)
Return the current Long value of the column at the given index in the resultset.
OCI_EXPORT const otext *OCI_API OCI_EventGetObject(OCI_Event *event)
Return the name of the object that generated the event.
bool operator>=(const Timestamp &other) const
Indicates if the current Timestamp value is superior or equal to the given Timestamp value...
OCI_EXPORT big_uint OCI_API OCI_ObjectGetUnsignedBigInt(OCI_Object *obj, const otext *attr)
Return the unsigned big integer value of the given object attribute.
OCI_EXPORT big_uint OCI_API OCI_GetUnsignedBigInt2(OCI_Resultset *rs, const otext *name)
Return the current unsigned big integer value of the column from its name in the resultset.
OCI_EXPORT OCI_Timestamp *OCI_API OCI_GetInstanceStartTime(OCI_Connection *con)
Return the date and time (Timestamp) server instance start of the connected database/service name...
OCI_EXPORT OCI_Date *OCI_API OCI_GetDate2(OCI_Resultset *rs, const otext *name)
Return the current date value of the column from its name in the resultset.
OCI_EXPORT unsigned int OCI_API OCI_PoolGetIncrement(OCI_Pool *pool)
Return the increment for connections/sessions to be opened to the database when the pool is not full...
static void Stop(const Connection &connection, const ostring &queue, bool stopEnqueue=true, bool stopDequeue=true, bool wait=true)
Stop enqueuing or dequeuing or both on the given queue.
OCI_EXPORT boolean OCI_API OCI_DequeueSetConsumer(OCI_Dequeue *dequeue, const otext *consumer)
Set the current consumer name to retrieve message for.
OCI_EXPORT const otext *OCI_API OCI_GetSessionTag(OCI_Connection *con)
Return the tag associated the given connection.
OCI_EXPORT unsigned int OCI_API OCI_ElemGetRawSize(OCI_Elem *elem)
Return the raw attribute value size of the given element handle.
bool operator==(const Lob &other) const
Indicates if the current lob value is equal to the given lob value.
int GetMonth() const
Return the date month value.
Reference GetReference() const
Creates a reference on the current object.
OCI_EXPORT boolean OCI_API OCI_QueueTableAlter(OCI_Connection *con, const otext *queue_table, const otext *comment, unsigned int primary_instance, unsigned int secondary_instance)
Alter the given queue table.
OCI_EXPORT const otext *OCI_API OCI_TypeInfoGetName(OCI_TypeInfo *typinf)
Return the name described by the type info object.
ostring GetTrace(SessionTrace trace) const
Get the current trace for the trace type from the given connection.
OCI_EXPORT boolean OCI_API OCI_MsgReset(OCI_Msg *msg)
Reset all attributes of a message object.
void SetStatementCacheSize(unsigned int value)
Set the maximum number of statements to keep in the pool&#39;s statement cache.
struct OCI_Timestamp OCI_Timestamp
Oracle internal timestamp representation.
Definition: ocilib.h:588
int GetPriority() const
Return the priority of the message.
OCI_EXPORT boolean OCI_API OCI_AgentSetName(OCI_Agent *agent, const otext *name)
Set the given AQ agent name.
OCI_EXPORT boolean OCI_API OCI_QueueTablePurge(OCI_Connection *con, const otext *queue_table, const otext *purge_condition, boolean block, unsigned int delivery_mode)
Purge messages from the given queue table.
void SetBufferSize(unsigned int value)
Set the size of the internal stream transfer buffer.
OCI_EXPORT unsigned int OCI_API OCI_PoolGetMax(OCI_Pool *pool)
Return the maximum number of connections/sessions that can be opened to the database.
OCI_EXPORT boolean OCI_API OCI_LobIsEqual(OCI_Lob *lob, OCI_Lob *lob2)
Compare two lob handles for equality.
ostring ToString() const override
return a string representation of the current reference
ostring GetFormat(FormatType formatType)
Return the format string for implicit string conversions of the given type.
ostring GetSql() const
Return the last SQL or PL/SQL statement prepared or executed by the statement.
OCI_EXPORT boolean OCI_API OCI_LobAssign(OCI_Lob *lob, OCI_Lob *lob_src)
Assign a lob to another one.
OCI_EXPORT big_uint OCI_API OCI_LobErase(OCI_Lob *lob, big_uint offset, big_uint len)
Erase a portion of the lob at a given position.
OCI_EXPORT const otext *OCI_API OCI_GetString2(OCI_Resultset *rs, const otext *name)
Return the current string value of the column from its name in the resultset.
OCI_EXPORT OCI_TypeInfo *OCI_API OCI_CollGetTypeInfo(OCI_Coll *coll)
Return the type info object associated to the collection.
OCI_EXPORT boolean OCI_API OCI_SetTimeout(OCI_Connection *con, unsigned int type, unsigned int value)
Set a given timeout for OCI calls that require server round-trips to the given database.
Template Enumeration template class providing some type safety to some extends for manipulating enume...
OCI_EXPORT unsigned int OCI_API OCI_LobGetChunkSize(OCI_Lob *lob)
Returns the chunk size of a LOB.
void Flush()
Flush the lob content to the server (if applicable)
OCI_EXPORT boolean OCI_API OCI_RefToText(OCI_Ref *ref, unsigned int size, otext *str)
Converts a Ref handle value to a hexadecimal string.
OCI_EXPORT boolean OCI_API OCI_ThreadJoin(OCI_Thread *thread)
Join the given thread.
OCI_EXPORT unsigned int OCI_API OCI_GetCharset(void)
Return the OCILIB charset type.
Timestamp & operator++()
Increment the timestamp by 1 day.
OCI_EXPORT float OCI_API OCI_ElemGetFloat(OCI_Elem *elem)
Return the float value of the given collection element.
OCI_EXPORT unsigned int OCI_API OCI_GetServerRevisionVersion(OCI_Connection *con)
Return the revision version number of the connected database server.
Timestamp operator-(int value) const
Return a new Timestamp holding the current Timestamp value decremented by the given number of days...
OCI_EXPORT boolean OCI_API OCI_ObjectAssign(OCI_Object *obj, OCI_Object *obj_src)
Assign an object to another one.
void SetDateTime(int year, int month, int day, int hour, int min, int sec)
Set the date and time part.
Long()
Create an empty null Long instance.
void Reset()
Reset all attributes of the message.
OCI_EXPORT OCI_TypeInfo *OCI_API OCI_TypeInfoGet(OCI_Connection *con, const otext *name, unsigned int type)
Retrieve the available type info information.
unsigned int GetServerMinorVersion() const
Return the minor version number of the connected database server.
Statement GetStatement() const
Return the statement associated with the resultset.
OCI_EXPORT boolean OCI_API OCI_BindRaw(OCI_Statement *stmt, const otext *name, void *data, unsigned int len)
Bind a raw buffer.
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.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfLobs(OCI_Statement *stmt, const otext *name, OCI_Lob **data, unsigned int type, unsigned int nbelem)
Bind an array of Lob handles.
void SetHours(int value)
Set the date hours value.
static void Create(const Connection &connection, const ostring &table, const ostring &payloadType, bool multipleConsumers, const ostring &storageClause=OTEXT(""), const ostring &sortList=OTEXT(""), GroupingMode groupingMode=None, const ostring &comment=OTEXT(""), unsigned int primaryInstance=0, unsigned int secondaryInstance=0, const ostring &compatible=OTEXT(""))
Create a queue table for messages of the given type.
void FromString(const ostring &data)
Assign to the interval object the value provided by the input interval string.
Connection GetConnection() const
Return the connection associated with a statement.
Number Clone() const
Clone the current instance to a new one performing deep copy.
OCI_EXPORT boolean OCI_API OCI_ElemGetBoolean(OCI_Elem *elem)
Return the boolean value of the given collection element.
OCI_EXPORT boolean OCI_API OCI_DirPathSetCacheSize(OCI_DirPath *dp, unsigned int size)
Set number of elements in the date cache.
OCI_EXPORT OCI_Date *OCI_API OCI_ElemGetDate(OCI_Elem *elem)
Return the Date value of the given collection element.
static void ChangeUserPassword(const ostring &db, const ostring &user, const ostring &pwd, const ostring &newPwd)
Change the password of the given user on the given database.
OCI_EXPORT unsigned int OCI_API OCI_GetRowCount(OCI_Resultset *rs)
Retrieve the number of rows fetched so far.
OCI_EXPORT boolean OCI_API OCI_BindSetDataSizeAtPos(OCI_Bind *bnd, unsigned int position, unsigned int size)
Set the size of the element at the given position in the bind input array.
OCI_EXPORT unsigned int OCI_API OCI_BindArrayGetSize(OCI_Statement *stmt)
Return the current input array size for bulk operations.
OCI_EXPORT unsigned int OCI_API OCI_EventGetType(OCI_Event *event)
Return the type of event reported by a notification.
boolean OCI_API OCI_BindSetCharsetForm(OCI_Bind *bnd, unsigned int csfrm)
Set the charset form of the given character based bind variable.
OCI_EXPORT boolean OCI_API OCI_DatabaseShutdown(const otext *db, const otext *user, const otext *pwd, unsigned int sess_mode, unsigned int shut_mode, unsigned int shut_flag)
Shutdown a database instance.
OCI_EXPORT boolean OCI_API OCI_DateGetTime(OCI_Date *date, int *hour, int *min, int *sec)
Extract the time part from a date handle.
OCI_EXPORT const otext *OCI_API OCI_GetPassword(OCI_Connection *con)
Return the current logged user password.
ShutdownModeValues
Oracle instance shutdown modes enumerated values.
Definition: ocilib.hpp:886
bool operator<=(const Interval &other) const
Indicates if the current Interval value is inferior or equal to the given Interval value...
OCI_EXPORT boolean OCI_API OCI_TimestampGetTime(OCI_Timestamp *tmsp, int *hour, int *min, int *sec, int *fsec)
Extract the time portion from a timestamp handle.
void SetLongMaxSize(unsigned int value)
Set the LONG data type piece buffer size.
OCI_EXPORT boolean OCI_API OCI_NumberFree(OCI_Number *number)
Free a number object.
unsigned int GetColumnIndex(const ostring &name) const
Return the index of the column in the result from its name.
Column GetColumn(unsigned int index) const
Return the column from its index in the resultset.
OCI_EXPORT boolean OCI_API OCI_LobWrite2(OCI_Lob *lob, void *buffer, unsigned int *char_count, unsigned int *byte_count)
Write a buffer into a LOB.
void Close()
Destroy the current Oracle pool of connections or sessions.
OCI_EXPORT unsigned int OCI_API OCI_GetUnsignedInt2(OCI_Resultset *rs, const otext *name)
Return the current unsigned integer value of the column from its name in the resultset.
OCI_EXPORT OCI_Timestamp *OCI_API OCI_ObjectGetTimestamp(OCI_Object *obj, const otext *attr)
Return the timestamp value of the given object attribute.
OCI_EXPORT boolean OCI_API OCI_BindSetDirection(OCI_Bind *bnd, unsigned int direction)
Set the direction mode of a bind handle.
OCI_EXPORT boolean OCI_API OCI_EnqueueGetRelativeMsgID(OCI_Enqueue *enqueue, void *id, unsigned int *len)
Get the current associated message identifier used for enqueuing messages using a sequence deviation...
struct OCI_Msg OCI_Msg
OCILIB encapsulation of A/Q message.
Definition: ocilib.h:749
OCI_EXPORT boolean OCI_API OCI_IsRebindingAllowed(OCI_Statement *stmt)
Indicate if rebinding is allowed on the given statement.
OCI_EXPORT boolean OCI_API OCI_TimestampGetTimeZoneName(OCI_Timestamp *tmsp, int size, otext *str)
Return the time zone name of a timestamp handle.
OCI_EXPORT unsigned int OCI_API OCI_TransactionGetMode(OCI_Transaction *trans)
Return global transaction mode.
OCI_EXPORT OCI_Statement *OCI_API OCI_BindGetStatement(OCI_Bind *bnd)
Return the statement handle associated with a bind handle.
OCI_EXPORT boolean OCI_API OCI_IntervalGetDaySecond(OCI_Interval *itv, int *day, int *hour, int *min, int *sec, int *fsec)
Return the day / time portion of an interval handle.
EventType GetType() const
Return the type of event reported by a notification.
OCI_EXPORT boolean OCI_API OCI_ElemSetRef(OCI_Elem *elem, OCI_Ref *value)
Assign a Ref handle to a collection element.
const void * ThreadId
Thread Unique ID.
Definition: ocilib.hpp:205
OCI_EXPORT OCI_Object *OCI_API OCI_ObjectGetObject(OCI_Object *obj, const otext *attr)
Return the object value of the given object attribute.
OCI_EXPORT unsigned int OCI_API OCI_EventGetOperation(OCI_Event *event)
Return the type of operation reported by a notification.
unsigned int GetMaxRows() const
Return the maximum number of rows allocated in the OCI and OCILIB internal arrays of rows...
void SetConsumer(const ostring &value)
Set the current consumer name to retrieve message for.
void SetUserData(AnyPointer value)
Associate a pointer to user data to the given connection.
OCI_EXPORT boolean OCI_API OCI_ThreadKeySetValue(const otext *name, void *value)
Set a thread key value.
OCI_EXPORT short OCI_API OCI_GetShort2(OCI_Resultset *rs, const otext *name)
Return the current short value of the column from its name in the resultset.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfUnsignedBigInts(OCI_Statement *stmt, const otext *name, big_uint *data, unsigned int nbelem)
Bind an array of unsigned big integers.
OCI_EXPORT boolean OCI_API OCI_TimestampIntervalSub(OCI_Timestamp *tmsp, OCI_Interval *itv)
Subtract an interval value from a timestamp value of a timestamp handle.
void SetDay(int value)
Set the date day value.
OCI_EXPORT boolean OCI_API OCI_MutexFree(OCI_Mutex *mutex)
Destroy a mutex object.
OCI_EXPORT boolean OCI_API OCI_LobIsRemote(OCI_Lob *lob)
Indicates if the given lob belongs to a local or remote database table.
bool operator--(int)
Convenient operator overloading that performs a call to Prev()
void FromString(const ostring &data, const ostring &format=OCI_STRING_FORMAT_DATE)
Assign to the timestamp object the value provided by the input date time string.
ostring GetConsumer() const
Get the current consumer name associated with the dequeuing process.
T GetContent() const
Return the string read from a fetch sequence.
static Date SysDate()
Return the current system date time.
ostring GetExceptionQueue() const
Get the Exception queue name of the message.
OCI_EXPORT boolean OCI_API OCI_TimestampFree(OCI_Timestamp *tmsp)
Free an OCI_Timestamp handle.
OCI_EXPORT unsigned int OCI_API OCI_BindGetSubtype(OCI_Bind *bnd)
Return the OCILIB object subtype of the given bind.
OCI_EXPORT boolean OCI_API OCI_SetUserData(OCI_Connection *con, void *data)
Associate a pointer to user data to the given connection.
unsigned int Write(const T &content)
Write the given content at the current position within the lob.
OCI_EXPORT OCI_Date *OCI_API OCI_DateCreate(OCI_Connection *con)
Create a local date object.
CharsetForm GetCharsetForm() const
Return the charset form of the given column.
OCI_EXPORT OCI_Ref *OCI_API OCI_RefCreate(OCI_Connection *con, OCI_TypeInfo *typinf)
Create a local Ref instance.
OCI_EXPORT OCI_Interval *OCI_API OCI_IntervalCreate(OCI_Connection *con, unsigned int type)
Create a local interval object.
OCI_EXPORT OCI_Connection *OCI_API OCI_LobGetConnection(OCI_Lob *lob)
Retrieve connection handle from the lob handle.
OCI_EXPORT boolean OCI_API OCI_EnqueueSetSequenceDeviation(OCI_Enqueue *enqueue, unsigned int sequence)
Set the enqueuing sequence of messages to put in the queue.
OCI_EXPORT const otext *OCI_API OCI_GetDBName(OCI_Connection *con)
Return the Oracle server database name of the connected database/service name.
void SetDateTime(int year, int month, int day, int hour, int min, int sec, int fsec, const ostring &timeZone=OTEXT(""))
Set the timestamp value from given date time parts.
OCI_EXPORT boolean OCI_API OCI_ElemIsNull(OCI_Elem *elem)
Check if the collection element value is null.
void Stop()
Stop current global transaction.
void SetConversionMode(ConversionMode value)
Set the direct path conversion mode.
Static class in charge of library initialization / cleanup.
Definition: ocilib.hpp:659
OCI_EXPORT boolean OCI_API OCI_RegisterBigInt(OCI_Statement *stmt, const otext *name)
Register a big integer output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfFloats(OCI_Statement *stmt, const otext *name, float *data, unsigned int nbelem)
Bind an array of floats.
OCI_EXPORT big_uint OCI_API OCI_FileGetOffset(OCI_File *file)
Return the current position in the file.
void SetPrefetchMemory(unsigned int value)
Set the amount of memory pre-fetched by OCI Client.
OCI_EXPORT boolean OCI_API OCI_SetLongMaxSize(OCI_Statement *stmt, unsigned int size)
Set the LONG data type piece buffer size.
OCI_EXPORT OCI_TypeInfo *OCI_API OCI_RefGetTypeInfo(OCI_Ref *ref)
Return the type info object associated to the Ref.
OCI_EXPORT boolean OCI_API OCI_ElemSetLob(OCI_Elem *elem, OCI_Lob *value)
Assign a Lob handle to a collection element.
OCI_EXPORT OCI_File *OCI_API OCI_FileCreate(OCI_Connection *con, unsigned int type)
Create a file object instance.
PropertyFlags GetPropertyFlags() const
Return the column property flags.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfUnsignedInts(OCI_Statement *stmt, const otext *name, unsigned int *data, unsigned int nbelem)
Bind an array of unsigned integers.
void SetMinutes(int value)
Set the timestamp minutes value.
OCI_EXPORT OCI_Transaction *OCI_API OCI_TransactionCreate(OCI_Connection *con, unsigned int timeout, unsigned int mode, OCI_XID *pxid)
Create a new global transaction or a serializable/read-only local transaction.
void SetCorrelation(const ostring &value)
set the correlation identifier of the message to be dequeued
Message Get()
Dequeue messages from the given queue.
void SetDate(int year, int month, int day)
Set the date part.
Reference()
Create an empty null Reference instance.
Class used for handling transient collection value. it is used internally by the Collection<T> class:...
Definition: ocilib.hpp:5086
OCI_EXPORT OCI_Coll *OCI_API OCI_GetColl(OCI_Resultset *rs, unsigned int index)
Return the current Collection value of the column at the given index in the resultset.
int GetLeadingPrecision() const
Return the leading precision of the column for Interval columns.
AllocatedBytesValues
Allocated Bytes enumerated values.
Definition: ocilib.hpp:949
void Append(const T &data)
Append the given element value at the end of the collection.
OCI_EXPORT unsigned int OCI_API OCI_ObjectGetUnsignedInt(OCI_Object *obj, const otext *attr)
Return the unsigned integer value of the given object attribute.
static void Create(const Connection &connection, const ostring &queue, const ostring &table, QueueType type=NormalQueue, unsigned int maxRetries=0, unsigned int retryDelay=0, unsigned int retentionTime=0, bool dependencyTracking=false, const ostring &comment=OTEXT(""))
Create a queue.
OCI_EXPORT boolean OCI_API OCI_ElemSetUnsignedShort(OCI_Elem *elem, unsigned short value)
Set a unsigned short value to a collection element.
static void Migrate(const Connection &connection, const ostring &table, const ostring &compatible=OTEXT(""))
Migrate a queue table from one version to another.
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetCollationID(OCI_Column *col)
Return the column collation ID.
bool operator>=(const Interval &other) const
Indicates if the current Interval value is superior or equal to the given Interval value...
unsigned int GetCurrentRows() const
Return the current number of rows used in the OCILIB internal arrays of rows.
OCI_EXPORT boolean OCI_API OCI_SetPassword(OCI_Connection *con, const otext *password)
Change the password of the logged user.
struct OCI_Ref OCI_Ref
Oracle REF type representation.
Definition: ocilib.h:655
unsigned int GetErrorColumn()
Return the index of a column which caused an error during data conversion.
void GetDate(int &year, int &month, int &day) const
Extract the date parts.
void SetRelativeMsgID(const Raw &value)
Set the message identifier of the message to be dequeued.
ChangeTypesValues
Subscription changes flags values.
Definition: ocilib.hpp:7220
void SetAgents(std::vector< Agent > &agents)
Set the Agent list to listen to message for.
OCI_EXPORT int OCI_API OCI_TimestampCheck(OCI_Timestamp *tmsp)
Check if the given timestamp is valid.
void(* NotifyHandlerProc)(Event &evt)
User callback for subscriptions event notifications.
Definition: ocilib.hpp:7213
void SetTransaction(const Transaction &transaction)
Set a transaction to a connection.
OCI_EXPORT big_uint OCI_API OCI_GetUnsignedBigInt(OCI_Resultset *rs, unsigned int index)
Return the current unsigned big integer value of the column at the given index in the resultset...
int GetPrecision() const
Return the precision of the column for numeric columns.
OCI_EXPORT boolean OCI_API OCI_TransactionForget(OCI_Transaction *trans)
Cancel the prepared global transaction validation.
OCI_EXPORT unsigned int OCI_API OCI_GetRaw2(OCI_Resultset *rs, const otext *name, void *buffer, unsigned int len)
Copy the current raw value of the column from its name into the specified buffer. ...
unsigned int GetLength() const
Return the buffer length.
OCI_EXPORT boolean OCI_API OCI_IntervalToText(OCI_Interval *itv, int leading_prec, int fraction_prec, int size, otext *str)
Convert an interval value from the given interval handle to a string.
void SetCorrelation(const ostring &value)
Set the correlation identifier of the message.
OCI_EXPORT boolean OCI_API OCI_EnableWarnings(boolean value)
Enable or disable Oracle warning notifications.
OCI_EXPORT boolean OCI_API OCI_RegisterInt(OCI_Statement *stmt, const otext *name)
Register an integer output bind placeholder.
OCI_EXPORT OCI_Resultset *OCI_API OCI_GetResultset(OCI_Statement *stmt)
Retrieve the resultset handle from an executed statement.
unsigned int ForEach(T callback)
Fetch all rows in the resultset and call the given callback for row.
CollectionType GetType() const
Return the type of the collection.
void * AnyPointer
Alias for the generic void pointer.
Definition: ocilib.hpp:169
OCI_EXPORT unsigned int OCI_API OCI_GetBindIndex(OCI_Statement *stmt, const otext *name)
Return the index of the bind from its name belonging to the given statement.
OCI_EXPORT boolean OCI_API OCI_TransactionFree(OCI_Transaction *trans)
Free current transaction.
const char * what() const override
Override the std::exception::what() method.
ExceptionType GetType() const
Return the Exception type.
OCI_EXPORT boolean OCI_API OCI_ObjectSetUnsignedBigInt(OCI_Object *obj, const otext *attr, big_uint value)
Set an object attribute of type unsigned big int.
unsigned int GetAffectedRows() const
return the number of rows successfully processed during in the last conversion or loading call ...
OCI_EXPORT void *OCI_API OCI_GetUserData(OCI_Connection *con)
Return the pointer to user data previously associated with the connection.
Raw GetRelativeMsgID() const
Get the current associated message identifier used for enqueuing messages using a sequence deviation...
void Subscribe(unsigned int port, unsigned int timeout, NotifyAQHandlerProc handler)
Subscribe for asynchronous messages notifications.
Connection GetConnection() const
Return the connection within the error occurred.
static void Cleanup()
Clean up all resources allocated by the environment.
void SetMilliSeconds(int value)
Set the interval milliseconds value.
OCI_EXPORT unsigned int OCI_API OCI_DequeueGetMode(OCI_Dequeue *dequeue)
Get the dequeuing/locking behavior.
OCI_EXPORT unsigned short OCI_API OCI_GetUnsignedShort(OCI_Resultset *rs, unsigned int index)
Return the current unsigned short value of the column at the given index in the resultset.
OCI_EXPORT boolean OCI_API OCI_FetchFirst(OCI_Resultset *rs)
Fetch the first row of the resultset.
void Clear()
Clear all items of the collection.
bool IsServerAlive() const
Indicate if the connection is still connected to the server.
Interval operator+(const Interval &other) const
Return a new Interval holding the sum of the current Interval value and the given Interval value...
OCI_EXPORT boolean OCI_API OCI_DateSetTime(OCI_Date *date, int hour, int min, int sec)
Set the time portion if the given date handle.
OCI_EXPORT OCI_Timestamp *OCI_API OCI_GetTimestamp2(OCI_Resultset *rs, const otext *name)
Return the current timestamp value of the column from its name in the resultset.
void SetBindArraySize(unsigned int size)
Set the input array size for bulk operations.
Interval & operator+=(const Interval &other)
Increment the current Value with the given Interval value.
static void Run(ThreadHandle handle, ThreadProc func, void *args)
Execute the given routine within the given thread.
OCI_EXPORT unsigned int OCI_API OCI_SubscriptionGetPort(OCI_Subscription *sub)
Return the port used by the notification.
OCI_EXPORT unsigned int OCI_API OCI_RefGetHexSize(OCI_Ref *ref)
Returns the size of the hex representation of the given Ref handle.
unsigned int GetSize() const
Returns the total number of elements in the collection.
OCI_EXPORT const otext *OCI_API OCI_AgentGetAddress(OCI_Agent *agent)
Get the given AQ agent address.
unsigned int GetFetchSize() const
Return the number of rows fetched per internal server fetch call.
OCI_EXPORT unsigned int OCI_API OCI_GetOCICompileVersion(void)
Return the version of OCI used for compilation.
OCI_EXPORT boolean OCI_API OCI_NumberSub(OCI_Number *number, unsigned int type, void *value)
Subtract the value of a native C numeric type to the given number.
OCI_EXPORT boolean OCI_API OCI_DatabaseStartup(const otext *db, const otext *user, const otext *pwd, unsigned int sess_mode, unsigned int start_mode, unsigned int start_flag, const otext *spfile)
Start a database instance.
OCI_EXPORT float OCI_API OCI_ObjectGetFloat(OCI_Object *obj, const otext *attr)
Return the float value of the given object attribute.
void Prepare()
Prepare a global transaction validation.
OCI_EXPORT int OCI_API OCI_ColumnGetLeadingPrecision(OCI_Column *col)
Return the leading precision of the column for interval columns.
void SetMode(EnqueueMode value)
Set the enqueuing mode of messages to put in the queue.
OCI_EXPORT unsigned int OCI_API OCI_GetServerMinorVersion(OCI_Connection *con)
Return the minor version number of the connected database server.
OCI_EXPORT boolean OCI_API OCI_DirPathReset(OCI_DirPath *dp)
Reset internal arrays and streams to prepare another load.
OCI_EXPORT OCI_Interval *OCI_API OCI_ElemGetInterval(OCI_Elem *elem)
Return the Interval value of the given collection element.
OCI_EXPORT boolean OCI_API OCI_MsgSetObject(OCI_Msg *msg, OCI_Object *obj)
Set the object payload of the given message.
OCI_EXPORT unsigned int OCI_API OCI_CollGetMax(OCI_Coll *coll)
Returns the maximum number of elements of the given collection.
OCI_EXPORT const otext *OCI_API OCI_DequeueGetCorrelation(OCI_Dequeue *dequeue)
Get the correlation identifier of the message to be dequeued.
OCI_EXPORT int OCI_API OCI_NumberCompare(OCI_Number *number1, OCI_Number *number2)
Compares two number handles.
Object identifying the SQL data types VARRAY and NESTED TABLE.
Definition: ocilib.hpp:5177
void SetPriority(int value)
Set the priority of the message.
OCI_EXPORT unsigned int OCI_API OCI_ElemGetRaw(OCI_Elem *elem, void *value, unsigned int len)
Read the RAW value of the collection element into the given buffer.
ostring ToString() const override
Convert the date value to a string using default format OCI_STRING_FORMAT_DATE.
bool IsAttributeNull(const ostring &name) const
Check if an object attribute is null.
Timestamp & operator--()
Decrement the Timestamp by 1 day.
OCI_EXPORT OCI_Statement *OCI_API OCI_GetStatement2(OCI_Resultset *rs, const otext *name)
Return the current cursor value of the column from its name in the resultset.
int GetScale() const
Return the scale of the column for numeric columns.
OCI_EXPORT boolean OCI_API OCI_FileFree(OCI_File *file)
Free a local File object.
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetPropertyFlags(OCI_Column *col)
Return the column property flags.
void SetNoWait(bool value)
Set the waiting mode used when no more connections/sessions are available from the pool...
OCI_EXPORT boolean OCI_API OCI_LobOpen(OCI_Lob *lob, unsigned int mode)
Open explicitly a Lob.
void SetMonth(int value)
Set the date month value.
struct OCI_Date OCI_Date
Oracle internal date representation.
Definition: ocilib.h:578
OCI_EXPORT big_int OCI_API OCI_GetBigInt(OCI_Resultset *rs, unsigned int index)
Return the current big integer value of the column at the given index in the resultset.
Lob Clone() const
Clone the current instance to a new one performing deep copy.
bool operator<=(const Timestamp &other) const
Indicates if the current Timestamp value is inferior or equal to the given Timestamp value...
unsigned int GetMaxSize() const
Return the maximum number of connections/sessions that can be opened to the database.
OracleVersion GetVersion() const
Return the Oracle version supported by the connection.
unsigned int GetStatementCacheSize() const
Return the maximum number of statements to keep in the pool&#39;s statement cache.
OCI_EXPORT unsigned int OCI_API OCI_DequeueGetNavigation(OCI_Dequeue *dequeue)
Return the navigation position of messages to retrieve from the queue.
OCI_EXPORT OCI_Number *OCI_API OCI_ElemGetNumber(OCI_Elem *elem)
Return the number value of the given collection element.
OCI_EXPORT boolean OCI_API OCI_PoolGetNoWait(OCI_Pool *pool)
Get the waiting mode used when no more connections/sessions are available from the pool...
OCI_EXPORT unsigned int OCI_API OCI_DirPathConvert(OCI_DirPath *dp)
Convert provided user data to the direct path stream format.
OCI_EXPORT boolean OCI_API OCI_DateSetDate(OCI_Date *date, int year, int month, int day)
Set the date portion if the given date handle.
OCI_EXPORT int OCI_API OCI_DateDaysBetween(OCI_Date *date, OCI_Date *date2)
Return the number of days betWeen two dates.
void SetTimeZone(const ostring &timeZone)
Set the given time zone to the timestamp.
Collection Clone() const
Clone the current instance to a new one performing deep copy.
OCI_EXPORT unsigned int OCI_API OCI_GetVersionConnection(OCI_Connection *con)
Return the highest Oracle version is supported by the connection.
OCI_EXPORT unsigned int OCI_API OCI_BindGetDataSizeAtPos(OCI_Bind *bnd, unsigned int position)
Return the actual size of the element at the given position in the bind input array.
ostring GetTimeZone() const
Return the name of the current time zone.
OCI_EXPORT boolean OCI_API OCI_IsTAFCapable(OCI_Connection *con)
Verify if the given connection support TAF events.
static bool Initialized()
Return true if the environment has been successfully initialized.
OCI_EXPORT const void *OCI_API OCI_HandleGetEnvironment(void)
Return the OCI Environment Handle (OCIEnv *) of OCILIB library.
int GetInternalErrorCode() const
Return the OCILIB error code.
OCI_EXPORT int OCI_API OCI_MsgGetExpiration(OCI_Msg *msg)
Return the duration that the message is available for dequeuing.
int GetMilliSeconds() const
Return the interval seconds value.
static void Destroy(MutexHandle handle)
Destroy a mutex handle.
OCI_EXPORT boolean OCI_API OCI_BindDate(OCI_Statement *stmt, const otext *name, OCI_Date *data)
Bind a date variable.
unsigned int GetCount() const
Retrieve the number of rows fetched so far.
static OracleVersion GetRuntimeVersion()
Return the version of OCI used at runtime.
OCI_EXPORT boolean OCI_API OCI_CollFree(OCI_Coll *coll)
Free a local collection.
void AllowRebinding(bool value)
Allow different host variables to be binded using the same bind name or position between executions o...
OCI_EXPORT boolean OCI_API OCI_DateSysDate(OCI_Date *date)
Return the current system date/time into the date handle.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfRaws(OCI_Statement *stmt, const otext *name, void *data, unsigned int len, unsigned int nbelem)
Bind an array of raw buffers.
OCI_EXPORT OCI_Object *OCI_API OCI_RefGetObject(OCI_Ref *ref)
Returns the object pointed by the Ref handle.
void GetBatchErrors(std::vector< Exception > &exceptions)
Returns all errors that occurred within a DML array statement execution.
OCI_EXPORT OCI_Coll *OCI_API OCI_ElemGetColl(OCI_Elem *elem)
Return the collection value of the given collection element.
void Resume()
Resume a stopped global transaction.
struct OCI_Transaction OCI_Transaction
Oracle Transaction.
Definition: ocilib.h:537
void SetSeconds(int value)
Set the timestamp seconds value.
OCI_EXPORT unsigned int OCI_API OCI_CollGetCount(OCI_Coll *coll)
Returns the current number of elements of the given collection.
unsigned int GetPrefetchMemory() const
Return the amount of memory used to retrieve rows pre-fetched by OCI Client.
OCI_EXPORT OCI_Elem *OCI_API OCI_CollGetElem(OCI_Coll *coll, unsigned int index)
Return the element at the given position in the collection.
OCI_EXPORT boolean OCI_API OCI_ElemSetUnsignedInt(OCI_Elem *elem, unsigned int value)
Set a unsigned int value to a collection element.
OCI_EXPORT unsigned short OCI_API OCI_ObjectGetUnsignedShort(OCI_Object *obj, const otext *attr)
Return the unsigned short value of the given object attribute.
int GetSeconds() const
Return the date seconds value.
OCI_EXPORT const otext *OCI_API OCI_GetInstanceName(OCI_Connection *con)
Return the Oracle server Instance name of the connected database/service name.
OCI_EXPORT unsigned int OCI_API OCI_GetFetchMode(OCI_Statement *stmt)
Return the fetch mode of a SQL statement.
File Clone() const
Clone the current instance to a new one performing deep copy.
OCI_EXPORT boolean OCI_API OCI_SubscriptionAddStatement(OCI_Subscription *sub, OCI_Statement *stmt)
Add a statement to the notification to monitor.
OCI_EXPORT boolean OCI_API OCI_LobTruncate(OCI_Lob *lob, big_uint size)
Truncate the given lob to a shorter length.
ostring GetName() const
Return the Column name.
void SetAddress(const ostring &value)
Set the given AQ agent address.
OCI_EXPORT void *OCI_API OCI_ThreadKeyGetValue(const otext *name)
Get a thread key value.
POCI_THREADKEYDEST ThreadKeyFreeProc
Thread Key callback for freeing resources.
Definition: ocilib.hpp:1464
void SetDay(int value)
Set the timestamp day value.
unsigned int GetBindCount() const
Return the number of binds currently associated to a statement.
Message(const TypeInfo &typeInfo)
Create a message object based on the given payload type.
OCI_EXPORT boolean OCI_API OCI_LobClose(OCI_Lob *lob)
Close explicitly a Lob.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfDates(OCI_Statement *stmt, const otext *name, OCI_Date **data, unsigned int nbelem)
Bind an array of dates.
bool Prev()
Fetch the previous row of the resultset.
OCI_EXPORT OCI_Interval *OCI_API OCI_GetInterval2(OCI_Resultset *rs, const otext *name)
Return the current interval value of the column from its name in the resultset.
void SetTimeout(unsigned int value)
Set the connections/sessions idle timeout.
OCI_EXPORT boolean OCI_API OCI_CollSetElem(OCI_Coll *coll, unsigned int index, OCI_Elem *elem)
Assign the given element value to the element at the given position in the collection.
void SetMode(DequeueMode value)
Set the dequeuing/locking behavior.
LobType GetType() const
return the type of lob
OCI_EXPORT boolean OCI_API OCI_DirPathAbort(OCI_DirPath *dp)
Terminate a direct path operation without committing changes.
OCI_EXPORT boolean OCI_API OCI_CollAppend(OCI_Coll *coll, OCI_Elem *elem)
Append the given element at the end of the collection.
OCI_EXPORT boolean OCI_API OCI_ElemSetUnsignedBigInt(OCI_Elem *elem, big_uint value)
Set a unsigned big_int value to a collection element.
OCI_EXPORT boolean OCI_API OCI_BindLob(OCI_Statement *stmt, const otext *name, OCI_Lob *data)
Bind a Lob variable.
Connection GetConnection() const
Return the file parent connection.
OCI_EXPORT boolean OCI_API OCI_RegisterDouble(OCI_Statement *stmt, const otext *name)
Register a double output bind placeholder.
OCI_EXPORT unsigned int OCI_API OCI_GetColumnCount(OCI_Resultset *rs)
Return the number of columns in the resultset.
OCI_EXPORT unsigned int OCI_API OCI_DirPathGetErrorColumn(OCI_DirPath *dp)
Return the index of a column which caused an error during data conversion.
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetCharsetForm(OCI_Column *col)
Return the charset form of the given column.
void(* POCI_NOTIFY)(OCI_Event *event)
Database Change Notification User callback prototype.
Definition: ocilib.h:839
static void Start(const Connection &connection, const ostring &queue, bool enableEnqueue=true, bool enableDequeue=true)
Start the given queue.
ostring ToString() const override
Convert the number value to a string using default format OCI_STRING_FORMAT_NUMERIC.
OCI_EXPORT boolean OCI_API OCI_AllowRebinding(OCI_Statement *stmt, boolean value)
Allow different host variables to be binded using the same bind name or position between executions o...
OCI_EXPORT boolean OCI_API OCI_Describe(OCI_Statement *stmt, const otext *sql)
Describe the select list of a SQL select statement.
OCI_EXPORT const otext *OCI_API OCI_BindGetName(OCI_Bind *bnd)
Return the name of the given bind.
void UpdateTimeZone(const ostring &timeZone)
Update the interval value with the given time zone.
OCI_EXPORT boolean OCI_API OCI_ServerEnableOutput(OCI_Connection *con, unsigned int bufsize, unsigned int arrsize, unsigned int lnsize)
Enable the server output.
bool operator!=(const Date &other) const
Indicates if the current date value is not equal the given date value.
OCI_EXPORT unsigned int OCI_API OCI_LobAppend(OCI_Lob *lob, void *buffer, unsigned int len)
Append a buffer at the end of a LOB.
OCI_EXPORT unsigned int OCI_API OCI_GetMaxCursors(OCI_Connection *con)
Return the maximum number of SQL statements that can be opened in one session.
OCI_EXPORT boolean OCI_API OCI_LobCopy(OCI_Lob *lob, OCI_Lob *lob_src, big_uint offset_dst, big_uint offset_src, big_uint count)
Copy a portion of a source LOB into a destination LOB.
OCI_EXPORT boolean OCI_API OCI_MsgSetSender(OCI_Msg *msg, OCI_Agent *sender)
Set the original sender of a message.
OCI_EXPORT const otext *OCI_API OCI_GetSQLVerb(OCI_Statement *stmt)
Return the verb of the SQL command held by the statement handle.
int GetMinutes() const
Return the interval minutes value.
OCI_EXPORT const otext *OCI_API OCI_ErrorGetString(OCI_Error *err)
Retrieve error message from error handle.
void SetInfos(const ostring &directory, const ostring &name)
Set the directory and file name of our file object.
struct OCI_Resultset OCI_Resultset
Collection of output columns from a select statement.
Definition: ocilib.h:462
OCI_EXPORT const otext *OCI_API OCI_GetDomainName(OCI_Connection *con)
Return the Oracle server domain name of the connected database/service name.
OCI_EXPORT boolean OCI_API OCI_ObjectIsNull(OCI_Object *obj, const otext *attr)
Check if an object attribute is null.
OCI_EXPORT int OCI_API OCI_DequeueGetWaitTime(OCI_Dequeue *dequeue)
Return the time that OCIDequeueGet() waits for messages if no messages are currently available...
OCI_EXPORT boolean OCI_API OCI_Execute(OCI_Statement *stmt)
Execute a prepared SQL statement or PL/SQL block.
DataType GetType() const
Return the OCILIB type of the data associated with the bind object.
OCI_EXPORT boolean OCI_API OCI_TypeInfoIsFinalType(OCI_TypeInfo *typinf)
Indicate if the given UDT type if final.
void SetStatementCacheSize(unsigned int value)
Set the maximum number of statements to keep in the statement cache.
unsigned int GetMaxCursors() const
Return the maximum number of SQL statements that can be opened in one session.
OCI_EXPORT boolean OCI_API OCI_ObjectFree(OCI_Object *obj)
Free a local object.
OCI_EXPORT boolean OCI_API OCI_ElemSetFile(OCI_Elem *elem, OCI_File *value)
Assign a File handle to a collection element.
Allow resolving a the C API numeric enumerated type from a C++ type.
FetchMode GetFetchMode() const
Return the fetch mode of a SQL statement.
SessionFlagsValues
Session flags enumerated values.
Definition: ocilib.hpp:798
TransactionFlagsValues
Transaction flags enumerated values.
Definition: ocilib.hpp:2544
OCI_EXPORT OCI_Error *OCI_API OCI_GetLastError(void)
Retrieve the last error or warning occurred within the last OCILIB call.
OCI_EXPORT boolean OCI_API OCI_TransactionPrepare(OCI_Transaction *trans)
Prepare a global transaction validation.
OCI_EXPORT const otext *OCI_API OCI_FileGetDirectory(OCI_File *file)
Return the directory of the given file.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfInts(OCI_Statement *stmt, const otext *name, int *data, unsigned int nbelem)
Bind an array of integers.
void AddDays(int days)
Add or subtract days.
unsigned int GetIncrement() const
Return the increment for connections/sessions to be opened to the database when the pool is not full...
void GetDate(int &year, int &month, int &day) const
Extract the date parts.
OCI_EXPORT unsigned int OCI_API OCI_DirPathGetAffectedRows(OCI_DirPath *dp)
return the number of rows successfully processed during in the last conversion or loading call ...
OCI_EXPORT OCI_Date *OCI_API OCI_MsgGetEnqueueTime(OCI_Msg *msg)
return the time the message was enqueued
ostring GetName() const
Get the given AQ agent name.
T Get(unsigned int index) const
Return the collection element value at the given position.
OCI_EXPORT boolean OCI_API OCI_BindBoolean(OCI_Statement *stmt, const otext *name, boolean *data)
Bind a boolean variable (PL/SQL ONLY)
static void Destroy(ThreadHandle handle)
Destroy a thread.
OCI_EXPORT int OCI_API OCI_GetInt(OCI_Resultset *rs, unsigned int index)
Return the current integer value of the column at the given index in the resultset.
BindInfo GetBind(unsigned int index) const
Return the bind at the given index in the internal array of bind objects.
bool operator>=(const Date &other) const
Indicates if the current date value is superior or equal to the given date value. ...
void SetTime(int hour, int min, int sec)
Set the time part.
OCI_EXPORT unsigned int OCI_API OCI_GetCurrentRow(OCI_Resultset *rs)
Retrieve the current row number.
OCI_EXPORT OCI_Connection *OCI_API OCI_SubscriptionGetConnection(OCI_Subscription *sub)
Return the connection handle associated with a subscription handle.
OCI_EXPORT boolean OCI_API OCI_ObjectSetUnsignedInt(OCI_Object *obj, const otext *attr, unsigned int value)
Set an object attribute of type unsigned int.
OCI_EXPORT float OCI_API OCI_GetFloat2(OCI_Resultset *rs, const otext *name)
Return the current float value of the column from its name in the resultset.
void GetYearMonth(int &year, int &month) const
Extract the year / month parts from the interval value.
OCI_EXPORT big_int OCI_API OCI_GetBigInt2(OCI_Resultset *rs, const otext *name)
Return the current big integer value of the column from its name in the resultset.
unsigned int GetTimeout() const
Return the timeout of the given registered subscription.
unsigned int GetStatementCacheSize() const
Return the maximum number of statements to keep in the statement cache.
Long< ostring, LongCharacter > Clong
Class handling LONG oracle type.
Definition: ocilib_impl.hpp:49
OCI_EXPORT boolean OCI_API OCI_DirPathSetCurrentRows(OCI_DirPath *dp, unsigned int nb_rows)
Set the current number of rows to convert and load.
void Start()
Start global transaction.
OCI_EXPORT boolean OCI_API OCI_MsgGetRaw(OCI_Msg *msg, void *raw, unsigned int *size)
Get the RAW payload of the given message.
TransactionFlags GetFlags() const
Return the transaction mode.
Raw Read(unsigned int size)
Read a portion of a file.
OCI_EXPORT boolean OCI_API OCI_MutexRelease(OCI_Mutex *mutex)
Release a mutex lock.
void SetMilliSeconds(int value)
Set the timestamp milliseconds value.
OCI_EXPORT boolean OCI_API OCI_TimestampConstruct(OCI_Timestamp *tmsp, int year, int month, int day, int hour, int min, int sec, int fsec, const otext *time_zone)
Set a timestamp handle value.
OCI_EXPORT boolean OCI_API OCI_TimestampSubtract(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp2, OCI_Interval *itv)
Store the difference of two timestamp handles into an interval handle.
void SetVisibility(DequeueVisibility value)
Set whether the new message is dequeued as part of the current transaction.
static AnyPointer GetValue(const ostring &name)
Get a thread key value.
OCI_EXPORT int OCI_API OCI_MsgGetPriority(OCI_Msg *msg)
Return the priority of the message.
void DisableServerOutput()
Disable the server output.
OCI_EXPORT boolean OCI_API OCI_DateZoneToZone(OCI_Date *date, const otext *zone1, const otext *zone2)
Convert a date from one zone to another zone.
bool operator==(const Timestamp &other) const
Indicates if the current Timestamp value is equal to the given Timestamp value.
OCI_EXPORT unsigned int OCI_API OCI_CollGetSize(OCI_Coll *coll)
Returns the total number of elements of the given collection.
unsigned int GetBindArraySize() const
Return the current input array size for bulk operations.
OCI_EXPORT const void *OCI_API OCI_HandleGetThreadID(OCI_Thread *thread)
Return OCI Thread ID (OCIThreadId *) of an OCILIB OCI_Thread object.
MessageState GetState() const
Return the state of the message at the time of the dequeue.
OCI_EXPORT boolean OCI_API OCI_MsgFree(OCI_Msg *msg)
Free a message object.
void GetDaySecond(int &day, int &hour, int &min, int &sec, int &fsec) const
Extract the date / second parts from the interval value.
void SetColumn(unsigned int colIndex, const ostring &name, unsigned int maxSize, const ostring &format=OTEXT(""))
Describe a column to load into the given table.
OCI_EXPORT boolean OCI_API OCI_RegisterUnsignedInt(OCI_Statement *stmt, const otext *name)
Register an unsigned integer output bind placeholder.
static void Substract(const Timestamp &lsh, const Timestamp &rsh, Interval &result)
Subtract the given two timestamp and store the result into the given Interval.
OCI_EXPORT boolean OCI_API OCI_EnqueueSetVisibility(OCI_Enqueue *enqueue, unsigned int visibility)
Set whether the new message is enqueued as part of the current transaction.
OCI_EXPORT unsigned int OCI_API OCI_PoolGetBusyCount(OCI_Pool *pool)
Return the current number of busy connections/sessions.
OCI_EXPORT OCI_Connection *OCI_API OCI_ConnectionCreate(const otext *db, const otext *user, const otext *pwd, unsigned int mode)
Create a physical connection to an Oracle database server.
IntervalType GetType() const
Return the type of the given interval object.
OCI_EXPORT double OCI_API OCI_GetDouble(OCI_Resultset *rs, unsigned int index)
Return the current double value of the column at the given index in the resultset.
OCI_EXPORT boolean OCI_API OCI_CollAssign(OCI_Coll *coll, OCI_Coll *coll_src)
Assign a collection to another one.
unsigned int GetTimeout(TimeoutType timeout)
Returns the requested timeout value for OCI calls that require server round-trips to the given databa...
unsigned int GetSqlErrorPos() const
Return the error position (in terms of characters) in the SQL statement where the error occurred in c...
OCI_EXPORT unsigned int OCI_API OCI_SubscriptionGetTimeout(OCI_Subscription *sub)
Return the timeout of the given registered subscription.
ostring GetSqlIdentifier() const
Return the server SQL_ID of the last SQL or PL/SQL statement prepared or executed by the statement...
OCI_EXPORT OCI_Agent *OCI_API OCI_MsgGetSender(OCI_Msg *msg)
Return the original sender of a message.
static OracleVersion GetCompileVersion()
Return the version of OCI used for compiling OCILIB.
void Finish()
Terminate a direct path operation and commit changes into the database.
OCI_EXPORT boolean OCI_API OCI_SetHAHandler(POCI_HA_HANDLER handler)
Set the High availability (HA) user handler.
DirectPath::Result Convert()
Convert provided user data to the direct path stream format.
Interval & operator-=(const Interval &other)
Decrement the current Value with the given Interval value.
OCI_EXPORT boolean OCI_API OCI_DateToText(OCI_Date *date, const otext *fmt, int size, otext *str)
Convert a Date value from the given date handle to a string.
OCI_EXPORT short OCI_API OCI_ElemGetShort(OCI_Elem *elem)
Return the short value of the given collection element.
Enqueue(const TypeInfo &typeInfo, const ostring &queueName)
Create a Enqueue object for the given queue.
Dequeue(const TypeInfo &typeInfo, const ostring &queueName)
Parametrized constructor.
static void SetValue(const ostring &name, AnyPointer value)
Set a thread key value.
OCI_EXPORT const otext *OCI_API OCI_EventGetDatabase(OCI_Event *event)
Return the name of the database that generated the event.
OCI_EXPORT boolean OCI_API OCI_RegisterObject(OCI_Statement *stmt, const otext *name, OCI_TypeInfo *typinf)
Register an object output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_ObjectSetBigInt(OCI_Object *obj, const otext *attr, big_int value)
Set an object attribute of type big int.
Connection GetConnection() const
Return the connection associated with a statement.
struct OCI_File OCI_File
Oracle External Large objects:
Definition: ocilib.h:522
OCI_EXPORT OCI_Lob *OCI_API OCI_LobCreate(OCI_Connection *con, unsigned int type)
Create a local temporary Lob instance.
static MutexHandle Create()
Create a Mutex handle.
ostring ToString() const override
Convert the timestamp value to a string using default date format and no precision.
OCI_EXPORT const otext *OCI_API OCI_GetDatabase(OCI_Connection *con)
Return the name of the connected database/service name.
OCI_EXPORT boolean OCI_API OCI_IntervalAdd(OCI_Interval *itv, OCI_Interval *itv2)
Adds an interval handle value to another.
bool operator==(const Date &other) const
Indicates if the current date value is equal to the given date value.
OCI_EXPORT boolean OCI_API OCI_BindTimestamp(OCI_Statement *stmt, const otext *name, OCI_Timestamp *data)
Bind a timestamp variable.
OCI_EXPORT boolean OCI_API OCI_SetTrace(OCI_Connection *con, unsigned int trace, const otext *value)
Set tracing information to the session of the given connection.
void GetTime(int &hour, int &min, int &sec) const
Extract time parts.
OCI_EXPORT boolean OCI_API OCI_ObjectSetDate(OCI_Object *obj, const otext *attr, OCI_Date *value)
Set an object attribute of type Date.
bool operator<(const Interval &other) const
Indicates if the current Interval value is inferior to the given Interval value.
void SetDataNull(bool value, unsigned int index=1)
Mark as null or not null the current bind real value(s) used in SQL statements.
unsigned int GetDataCount() const
Return the number of elements associated with the bind object.
void Prepare()
Prepares the OCI direct path load interface before any rows can be converted or loaded.
void GetDateTime(int &year, int &month, int &day, int &hour, int &min, int &sec) const
Extract the date and time parts.
OCI_EXPORT boolean OCI_API OCI_FetchNext(OCI_Resultset *rs)
Fetch the next row of the resultset.
CollationID GetCollationID() const
Return the collation ID of the given column.
OCI_EXPORT float OCI_API OCI_GetFloat(OCI_Resultset *rs, unsigned int index)
Return the current float value of the column at the given index in the resultset. ...
OCI_EXPORT const otext *OCI_API OCI_GetFormat(OCI_Connection *con, unsigned int type)
Return the format string for implicit string conversions of the given type.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfFiles(OCI_Statement *stmt, const otext *name, OCI_File **data, unsigned int type, unsigned int nbelem)
Bind an array of File handles.
OCI_EXPORT boolean OCI_API OCI_MsgSetRaw(OCI_Msg *msg, const void *raw, unsigned int size)
Set the RAW payload of the given message.
OCI_EXPORT boolean OCI_API OCI_MsgSetConsumers(OCI_Msg *msg, OCI_Agent **consumers, unsigned int count)
Set the recipient list of a message to enqueue.
Date & operator--()
Decrement the date by 1 day.
OCI_EXPORT boolean OCI_API OCI_RegisterNumber(OCI_Statement *stmt, const otext *name)
Register a register output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_QueueTableMigrate(OCI_Connection *con, const otext *queue_table, const otext *compatible)
Migrate a queue table from one version to another.
OCI_EXPORT boolean OCI_API OCI_ObjectSetTimestamp(OCI_Object *obj, const otext *attr, OCI_Timestamp *value)
Set an object attribute of type Timestamp.
static unsigned int GetRuntimeRevisionVersion()
Return the revision version number of OCI used at runtime.
OCI_EXPORT boolean OCI_API OCI_RegisterLob(OCI_Statement *stmt, const otext *name, unsigned int type)
Register a lob output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_ThreadFree(OCI_Thread *thread)
Destroy a thread object.
static void Drop(const Connection &connection, const ostring &table, bool force=true)
Drop the given queue table.
DequeueMode GetMode() const
Get the dequeuing/locking behavior.
OCI_EXPORT boolean OCI_API OCI_TimestampIntervalAdd(OCI_Timestamp *tmsp, OCI_Interval *itv)
Add an interval value to a timestamp value of a timestamp handle.
OCI_EXPORT OCI_Date *OCI_API OCI_ObjectGetDate(OCI_Object *obj, const otext *attr)
Return the date value of the given object attribute.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfStrings(OCI_Statement *stmt, const otext *name, otext *data, unsigned int len, unsigned int nbelem)
Bind an array of strings.
OCI_EXPORT boolean OCI_API OCI_ObjectGetSelfRef(OCI_Object *obj, OCI_Ref *ref)
Retrieve an Oracle Ref handle from an object and assign it to the given OCILIB OCI_Ref handle...
bool IsTAFCapable() const
Verify if the connection support TAF events.
unsigned int Write(const T &content)
Write the given string into the long Object.
void SetOriginalID(const Raw &value)
Set the original ID of the message in the last queue that generated this message. ...
big_uint GetLength() const
Returns the number of characters or bytes contained in the lob.
OCI_EXPORT boolean OCI_API OCI_PoolFree(OCI_Pool *pool)
Destroy a pool object.
ostring GetCorrelation() const
Get the correlation identifier of the message.
OCI_EXPORT boolean OCI_API OCI_ElemSetNumber(OCI_Elem *elem, OCI_Number *value)
Set a number value to a collection element.
OCI_EXPORT OCI_Coll *OCI_API OCI_CollCreate(OCI_TypeInfo *typinf)
Create a local collection instance.
bool IsRebindingAllowed() const
Indicate if rebinding is allowed on the statement.
OCI_EXPORT unsigned int OCI_API OCI_GetFetchSize(OCI_Statement *stmt)
Return the number of rows fetched per internal server fetch call.
Connection GetConnection() const
Return the connection associated with a subscription handle.
void SetMonth(int value)
Set the timestamp month value.
OCI_EXPORT boolean OCI_API OCI_ColumnGetNullable(OCI_Column *col)
Return the nullable attribute of the column.
OCI_EXPORT const otext *OCI_API OCI_FileGetName(OCI_File *file)
Return the name of the given file.
OCI_EXPORT unsigned int OCI_API OCI_GetStatementType(OCI_Statement *stmt)
Return the type of a SQL statement.
OCI_EXPORT boolean OCI_API OCI_QueueCreate(OCI_Connection *con, const otext *queue_name, const otext *queue_table, unsigned int queue_type, unsigned int max_retries, unsigned int retry_delay, unsigned int retention_time, boolean dependency_tracking, const otext *comment)
Create a queue.
OCI_EXPORT unsigned int OCI_API OCI_GetRaw(OCI_Resultset *rs, unsigned int index, void *buffer, unsigned int len)
Copy the current raw value of the column at the given index into the specified buffer.
OCI_EXPORT boolean OCI_API OCI_FileSeek(OCI_File *file, big_uint offset, unsigned int mode)
Perform a seek operation on the OCI_File content buffer.
bool operator+=(int offset)
Convenient operator overloading that performs a call to Seek() with Resultset::SeekRelative and the g...
OCI_EXPORT boolean OCI_API OCI_SetAutoCommit(OCI_Connection *con, boolean enable)
Enable / disable auto commit mode.
OCI_EXPORT boolean OCI_API OCI_LobIsTemporary(OCI_Lob *lob)
Check if the given lob is a temporary lob.
OCI_EXPORT boolean OCI_API OCI_DirPathSetColumn(OCI_DirPath *dp, unsigned int index, const otext *name, unsigned int maxsize, const otext *format)
Describe a column to load into the given table.
OCI_EXPORT boolean OCI_API OCI_NumberSetValue(OCI_Number *number, unsigned int type, void *value)
Assign the number value with the value of a native C numeric type.
OCI_EXPORT boolean OCI_API OCI_DirPathSetNoLog(OCI_DirPath *dp, boolean value)
Set the logging mode for the loading operation.
OCI_EXPORT boolean OCI_API OCI_IsConnected(OCI_Connection *con)
Returns TRUE is the given connection is still connected otherwise FALSE.
static void SetHAHandler(HAHandlerProc handler)
Set the High availability (HA) user handler.
static unsigned int GetCharMaxSize()
Return maximum size for a character.
OCI_EXPORT boolean OCI_API OCI_QueueTableCreate(OCI_Connection *con, const otext *queue_table, const otext *queue_payload_type, const otext *storage_clause, const otext *sort_list, boolean multiple_consumers, unsigned int message_grouping, const otext *comment, unsigned int primary_instance, unsigned int secondary_instance, const otext *compatible)
Create a queue table for messages of the given type.
OCI_EXPORT OCI_Bind *OCI_API OCI_GetBind2(OCI_Statement *stmt, const otext *name)
Return a bind handle from its name.
OCI_EXPORT boolean OCI_API OCI_Prepare(OCI_Statement *stmt, const otext *sql)
Prepare a SQL statement or PL/SQL block.
OCI_EXPORT boolean OCI_API OCI_DequeueSetAgentList(OCI_Dequeue *dequeue, OCI_Agent **consumers, unsigned int count)
Set the Agent list to listen to message for.
OCI_EXPORT boolean OCI_API OCI_PoolSetTimeout(OCI_Pool *pool, unsigned int value)
Set the connections/sessions idle timeout.
void SetDate(int year, int month, int day)
Set the date part.
OCI_EXPORT OCI_File *OCI_API OCI_GetFile(OCI_Resultset *rs, unsigned int index)
Return the current File value of the column at the given index in the resultset.
OCI_EXPORT boolean OCI_API OCI_DateSetDateTime(OCI_Date *date, int year, int month, int day, int hour, int min, int sec)
Set the date and time portions if the given date handle.
Connection GetConnection(const ostring &sessionTag=OTEXT(""))
Get a connection from the pool.
OCI_EXPORT boolean OCI_API OCI_ObjectSetInt(OCI_Object *obj, const otext *attr, int value)
Set an object attribute of type int.
ostring GetSessionTag() const
Return the tag associated with the given connection.
OCI_EXPORT big_uint OCI_API OCI_LobGetLength(OCI_Lob *lob)
Return the actual length of a lob.
OCI_EXPORT unsigned int OCI_API OCI_GetServerMajorVersion(OCI_Connection *con)
Return the major version number of the connected database server.
OCI_EXPORT boolean OCI_API OCI_DirPathSetEntry(OCI_DirPath *dp, unsigned int row, unsigned int index, void *value, unsigned size, boolean complete)
Set the value of the given row/column array entry.
OCI_EXPORT OCI_Lob *OCI_API OCI_ElemGetLob(OCI_Elem *elem)
Return the Lob value of the given collection element.
bool operator!=(const File &other) const
Indicates if the current file value is not equal the given file value.
OCI_EXPORT boolean OCI_API OCI_LobEnableBuffering(OCI_Lob *lob, boolean value)
Enable / disable buffering mode on the given lob handle.
OCI_EXPORT unsigned int OCI_API OCI_GetStatementCacheSize(OCI_Connection *con)
Return the maximum number of statements to keep in the statement cache.
void SetConsumers(std::vector< Agent > &agents)
Set the recipient list of a message to enqueue.
OCI_EXPORT boolean OCI_API OCI_SetTransaction(OCI_Connection *con, OCI_Transaction *trans)
Set a transaction to a connection.
OCI_EXPORT boolean OCI_API OCI_CollTrim(OCI_Coll *coll, unsigned int nb_elem)
Trims the given number of elements from the end of the collection.
void Open(const ostring &db, const ostring &user, const ostring &pwd, Environment::SessionFlags sessionFlags=Environment::SessionDefault)
Create a physical connection to an Oracle database server.
OCI_EXPORT boolean OCI_API OCI_RefFree(OCI_Ref *ref)
Free a local Ref.
OCI_EXPORT OCI_Transaction *OCI_API OCI_GetTransaction(OCI_Connection *con)
Return the current transaction of the connection.
AnyPointer GetUserData()
Return the pointer to user data previously associated with the connection.
void SetLongMode(LongMode value)
Set the long data type handling mode of a SQL statement.
OCI_EXPORT boolean OCI_API OCI_DateNextDay(OCI_Date *date, const otext *day)
Gets the date of next day of the week, after a given date.
OCI_EXPORT boolean OCI_API OCI_Rollback(OCI_Connection *con)
Cancel current pending changes.
Template class providing OCILIB handles auto memory, life cycle and scope management.
OCI_EXPORT OCI_TypeInfo *OCI_API OCI_ObjectGetTypeInfo(OCI_Object *obj)
Return the type info object associated to the object.
OCI_EXPORT unsigned int OCI_API OCI_LongGetSize(OCI_Long *lg)
Return the buffer size of a long object in bytes (OCI_BLONG) or character (OCI_CLONG) ...
big_uint GetOffset() const
Returns the current R/W offset within the lob.
OCI_EXPORT boolean OCI_API OCI_FileOpen(OCI_File *file)
Open a file for reading.
OCI_EXPORT boolean OCI_API OCI_FetchSeek(OCI_Resultset *rs, unsigned int mode, int offset)
Custom Fetch of the resultset.
Timestamp()
Create an empty null timestamp instance.
OCI_EXPORT boolean OCI_API OCI_IntervalGetYearMonth(OCI_Interval *itv, int *year, int *month)
Return the year / month portion of an interval handle.
Collection()
Create an empty null Collection instance.
OCI_EXPORT boolean OCI_API OCI_IntervalSetDaySecond(OCI_Interval *itv, int day, int hour, int min, int sec, int fsec)
Set the day / time portion if the given interval handle.
Pool()
Default constructor.
void Prepare(const ostring &sql)
Prepare a SQL statement or PL/SQL block.
Template Flags template class providing some type safety to some extends for manipulating flags set v...
OCI_EXPORT boolean OCI_API OCI_ElemSetColl(OCI_Elem *elem, OCI_Coll *value)
Assign a Collection handle to a collection element.
OCI_EXPORT unsigned int OCI_API OCI_DequeueGetVisibility(OCI_Dequeue *dequeue)
Get the dequeuing/locking behavior.
OCI_EXPORT boolean OCI_API OCI_ElemSetDate(OCI_Elem *elem, OCI_Date *value)
Assign a Date handle to a collection element.
OCI_EXPORT boolean OCI_API OCI_ObjectSetUnsignedShort(OCI_Object *obj, const otext *attr, unsigned short value)
Set an object attribute of type unsigned short.
void GetTime(int &hour, int &min, int &sec, int &fsec) const
Extract time parts.
OCI_EXPORT unsigned int OCI_API OCI_GetDataLength(OCI_Resultset *rs, unsigned int index)
Return the current row data length of the column at the given index in the resultset.
void SetDay(int value)
Set the interval day value.
Date Clone() const
Clone the current instance to a new one performing deep copy.
OCI_EXPORT boolean OCI_API OCI_RegisterString(OCI_Statement *stmt, const otext *name, unsigned int len)
Register a string output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_RegisterShort(OCI_Statement *stmt, const otext *name)
Register a short output bind placeholder.
void Commit()
Commit current pending changes.
OCI_Thread * ThreadHandle
Alias for an OCI_Thread pointer.
Definition: ocilib.hpp:196
OCI_EXPORT OCI_Object *OCI_API OCI_ElemGetObject(OCI_Elem *elem)
Return the object value of the given collection element.
OCI_EXPORT unsigned int OCI_API OCI_GetSQLCommand(OCI_Statement *stmt)
Return the Oracle SQL code the command held by the statement handle.
OCI_EXPORT unsigned int OCI_API OCI_DirPathGetRowCount(OCI_DirPath *dp)
Return the number of rows successfully loaded into the database so far.
unsigned int GetMinSize() const
Return the minimum number of connections/sessions that can be opened to the database.
bool SetFormat(FormatType formatType, const ostring &format)
Set the format string for implicit string conversions of the given type.
void Break()
Perform an immediate abort of any currently Oracle OCI call on the given connection.
OCI_EXPORT boolean OCI_API OCI_TimestampAssign(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp_src)
Assign the value of a timestamp handle to another one.
static void StartDatabase(const ostring &db, const ostring &user, const ostring &pwd, Environment::StartFlags startFlags, Environment::StartMode startMode, Environment::SessionFlags sessionFlags=SessionSysDba, const ostring &spfile=OTEXT(""))
Start a database instance.
unsigned int GetMax() const
Returns the maximum number of elements for the collection.
OCI_EXPORT boolean OCI_API OCI_DirPathSetConvertMode(OCI_DirPath *dp, unsigned int mode)
Set the direct path conversion mode.
void Unsubscribe()
Unsubscribe for asynchronous messages notifications.
OCI_EXPORT int OCI_API OCI_ColumnGetFractionalPrecision(OCI_Column *col)
Return the fractional precision of the column for timestamp and interval columns. ...
void SetYear(int value)
Set the timestamp year value.
OCI_EXPORT unsigned int OCI_API OCI_GetPrefetchMemory(OCI_Statement *stmt)
Return the amount of memory used to retrieve rows pre-fetched by OCI Client.
OCI_EXPORT boolean OCI_API OCI_SetPrefetchSize(OCI_Statement *stmt, unsigned int size)
Set the number of rows pre-fetched by OCI Client.
OCI_EXPORT boolean OCI_API OCI_DequeueGetRelativeMsgID(OCI_Dequeue *dequeue, void *id, unsigned int *len)
Get the message identifier of the message to be dequeued.
OCI_EXPORT boolean OCI_API OCI_DirPathSetParallel(OCI_DirPath *dp, boolean value)
Set the parallel loading mode.
OCI_EXPORT boolean OCI_API OCI_DequeueSetCorrelation(OCI_Dequeue *dequeue, const otext *pattern)
set the correlation identifier of the message to be dequeued
OCI_EXPORT int OCI_API OCI_NumberAssign(OCI_Number *number, OCI_Number *number_src)
Assign the value of a number handle to another one.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfRefs(OCI_Statement *stmt, const otext *name, OCI_Ref **data, OCI_TypeInfo *typinf, unsigned int nbelem)
Bind an array of Ref handles.
OCI_EXPORT boolean OCI_API OCI_QueueAlter(OCI_Connection *con, const otext *queue_name, unsigned int max_retries, unsigned int retry_delay, unsigned int retention_time, const otext *comment)
Alter the given queue.
std::vector< unsigned char > Raw
C++ counterpart of SQL RAW data type.
Definition: ocilib.hpp:178
OCI_EXPORT OCI_Dequeue *OCI_API OCI_DequeueCreate(OCI_TypeInfo *typinf, const otext *name)
Create a Dequeue object for the given queue.
OCI_EXPORT OCI_Error *OCI_API OCI_GetBatchError(OCI_Statement *stmt)
Returns the first or next error that occurred within a DML array statement execution.
ostring GetName() const
Return the type info name.
Date operator-(int value) const
Return a new date holding the current date value decremented by the given number of days...
OCI_EXPORT OCI_Resultset *OCI_API OCI_GetNextResultset(OCI_Statement *stmt)
Retrieve the next available resultset.
OCI_EXPORT unsigned int OCI_API OCI_TransactionGetTimeout(OCI_Transaction *trans)
Return global transaction Timeout.
OCI_EXPORT boolean OCI_API OCI_ElemSetInt(OCI_Elem *elem, int value)
Set a int value to a collection element.
OCI_EXPORT boolean OCI_API OCI_LongFree(OCI_Long *lg)
Free a local temporary long.
struct OCI_Long OCI_Long
Oracle Long data type.
Definition: ocilib.h:559
OCI_EXPORT double OCI_API OCI_ElemGetDouble(OCI_Elem *elem)
Return the Double value of the given collection element.
Statement()
Create an empty null Statement instance.
ostring GetDomain() const
Return the Oracle server Domain name of the connected database/service name.
Agent GetSender() const
Return the original sender of the message.
OCI_EXPORT boolean OCI_API OCI_RegisterRef(OCI_Statement *stmt, const otext *name, OCI_TypeInfo *typinf)
Register a Ref output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_TimestampToText(OCI_Timestamp *tmsp, const otext *fmt, int size, otext *str, int precision)
Convert a timestamp value from the given timestamp handle to a string.
int GetMilliSeconds() const
Return the timestamp seconds value.
OCI_EXPORT short OCI_API OCI_GetShort(OCI_Resultset *rs, unsigned int index)
Return the current short value of the column at the given index in the resultset. ...
void SetWaitTime(int value)
Set the time that Get() waits for messages if no messages are currently available.
Raw GetID() const
Return the ID of the message.
iterator end()
Returns an iterator referring to the past-the-end element in the collection.
Provides type information on Oracle Database objects.
Definition: ocilib.hpp:4680
OCI_EXPORT boolean OCI_API OCI_SetPrefetchMemory(OCI_Statement *stmt, unsigned int size)
Set the amount of memory pre-fetched by OCI Client.
OCI_EXPORT OCI_Column *OCI_API OCI_TypeInfoGetColumn(OCI_TypeInfo *typinf, unsigned int index)
Return the column object handle at the given index in the table.
ostring GetName() const
Return the file name.
OCI_EXPORT OCI_Number *OCI_API OCI_GetNumber(OCI_Resultset *rs, unsigned int index)
Return the current Number value of the column at the given index in the resultset.
OCI_EXPORT const otext *OCI_API OCI_EventGetRowid(OCI_Event *event)
Return the rowid of the altered database object row.
struct OCI_TypeInfo OCI_TypeInfo
Type info metadata handle.
Definition: ocilib.h:665
EnqueueVisibility GetVisibility() const
Get the enqueuing/locking behavior.
OCI_EXPORT unsigned int OCI_API OCI_DirPathGetErrorRow(OCI_DirPath *dp)
Return the index of a row which caused an error during data conversion.
OCI_EXPORT boolean OCI_API OCI_ObjectGetBoolean(OCI_Object *obj, const otext *attr)
Return the boolean value of the given object attribute (ONLY for PL/SQL records)
TypeInfoType GetType() const
Return the type of the given TypeInfo object.
void Rollback()
Cancel current pending changes.
void SetCurrentRows(unsigned int value)
Set the current number of rows to convert and load.
OCI_EXPORT const otext *OCI_API OCI_ElemGetString(OCI_Elem *elem)
Return the String value of the given collection element.
ostring GetSQLType() const
Return the Oracle SQL type name of the column data type.
OCI_EXPORT const otext *OCI_API OCI_GetServiceName(OCI_Connection *con)
Return the Oracle server service name of the connected database/service name.
OCI_EXPORT OCI_Object *OCI_API OCI_MsgGetObject(OCI_Msg *msg)
Get the object payload of the given message.
Resolve a bind input / output types.
Definition: ocilib_impl.hpp:68
unsigned int GetColumnCount() const
Return the number of columns contained in the type.
OCI_EXPORT boolean OCI_API OCI_BindShort(OCI_Statement *stmt, const otext *name, short *data)
Bind an short variable.
OCI_EXPORT boolean OCI_API OCI_ElemSetDouble(OCI_Elem *elem, double value)
Set a double value to a collection element.
OCI_EXPORT const otext *OCI_API OCI_DequeueGetConsumer(OCI_Dequeue *dequeue)
Get the current consumer name associated with the dequeuing process.
DirectPath::Result Load()
Loads the data converted to direct path stream format.
int GetEnqueueDelay() const
Return the number of seconds that a message is delayed for dequeuing.
IntervalTypeValues
Interval types enumerated values.
Definition: ocilib.hpp:3280
OCI_EXPORT boolean OCI_API OCI_ElemSetObject(OCI_Elem *elem, OCI_Object *value)
Assign an Object handle to a collection element.
OCI_EXPORT unsigned int OCI_API OCI_GetUnsignedInt(OCI_Resultset *rs, unsigned int index)
Return the current unsigned integer value of the column at the given index in the resultset...
OCI_EXPORT boolean OCI_API OCI_RefIsNull(OCI_Ref *ref)
Check if the Ref points to an object or not.
unsigned int GetBusyConnectionsCount() const
Return the current number of busy connections/sessions.
OCI_EXPORT unsigned int OCI_API OCI_GetOCIRuntimeVersion(void)
Return the version of OCI used at runtime.
OCI_EXPORT boolean OCI_API OCI_BindFloat(OCI_Statement *stmt, const otext *name, float *data)
Bind a float variable.
OCI_EXPORT boolean OCI_API OCI_IsNull2(OCI_Resultset *rs, const otext *name)
Check if the current row value is null for the column of the given name in the resultset.
void SetPrefetchSize(unsigned int value)
Set the number of rows pre-fetched by OCI Client.
OCI_EXPORT boolean OCI_API OCI_TimestampGetDate(OCI_Timestamp *tmsp, int *year, int *month, int *day)
Extract the date part from a timestamp handle.
POCI_THREAD ThreadProc
Thread callback.
Definition: ocilib.hpp:1339
bool IsDataNull(unsigned int index=1) const
Check if the current bind value(s) used in SQL statements is marked as NULL.
Date & operator-=(int value)
Decrement the date by the given number of days.
OCI_EXPORT boolean OCI_API OCI_DequeueSetMode(OCI_Dequeue *dequeue, unsigned int mode)
Set the dequeuing/locking behavior.
Resultset GetNextResultset()
Retrieve the next available resultset.
ShutdownFlagsValues
Oracle instance shutdown flags enumerated values.
Definition: ocilib.hpp:912
OCI_EXPORT big_uint OCI_API OCI_LobGetMaxSize(OCI_Lob *lob)
Return the maximum size that the lob can contain.
OCI_EXPORT int OCI_API OCI_ElemGetInt(OCI_Elem *elem)
Return the int value of the given collection element.
unsigned int GetDefaultLobPrefetchSize() const
Return the default LOB prefetch buffer size for the connection.
OCI_EXPORT boolean OCI_API OCI_FileClose(OCI_File *file)
Close a file.
OCI_EXPORT boolean OCI_API OCI_DirPathPrepare(OCI_DirPath *dp)
Prepares the OCI direct path load interface before any rows can be converted or loaded.
OCI_EXPORT void *OCI_API OCI_LongGetBuffer(OCI_Long *lg)
Return the internal buffer of an OCI_Long object read from a fetch sequence.
OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetType(OCI_TypeInfo *typinf)
Return the type of the type info object.
void Watch(const ostring &sql)
Add a SQL query to monitor.
Statement GetStatement() const
Return the statement within the error occurred.
ostring GetServerVersion() const
Return the connected database server string version.
OCI_EXPORT boolean OCI_API OCI_SetFetchSize(OCI_Statement *stmt, unsigned int size)
Set the number of rows fetched per internal server fetch call.
ostring GetInstance() const
Return the Oracle server Instance name of the connected database/service name.
int GetFractionalPrecision() const
Return the fractional precision of the column for Timestamp and Interval columns. ...
OCI_EXPORT unsigned int OCI_API OCI_DirPathGetMaxRows(OCI_DirPath *dp)
Return the maximum number of rows allocated in the OCI and OCILIB internal arrays of rows...
OCI_EXPORT unsigned int OCI_API OCI_EnqueueGetSequenceDeviation(OCI_Enqueue *enqueue)
Return the sequence deviation of messages to enqueue to the queue.
Number(bool create=false)
Create an empty null number object.
void EnableServerOutput(unsigned int bufsize, unsigned int arrsize, unsigned int lnsize)
Enable the server output.
OCI_EXPORT OCI_Msg *OCI_API OCI_DequeueGet(OCI_Dequeue *dequeue)
Dequeue messages from the given queue.
OCI_EXPORT OCI_Agent *OCI_API OCI_AgentCreate(OCI_Connection *con, const otext *name, const otext *address)
Create an AQ agent object.
OCI_EXPORT unsigned int OCI_API OCI_GetBindMode(OCI_Statement *stmt)
Return the binding mode of a SQL statement.
OCI_EXPORT big_int OCI_API OCI_ObjectGetBigInt(OCI_Object *obj, const otext *attr)
Return the big integer value of the given object attribute.
OCI_EXPORT boolean OCI_API OCI_TimestampSysTimestamp(OCI_Timestamp *tmsp)
Stores the system current date and time as a timestamp value with time zone into the timestamp handle...
bool Seek(SeekMode seekMode, big_uint offset)
Move the current position within the file for read/write operations.
void Abort()
Terminate a direct path operation without committing changes.
OCI_EXPORT unsigned int OCI_API OCI_CollGetType(OCI_Coll *coll)
Return the collection type.
Date & operator+=(int value)
Increment the date by the given number of days.
OCI_EXPORT boolean OCI_API OCI_CollToText(OCI_Coll *coll, unsigned int *size, otext *str)
Convert a collection handle value to a string.
OCI_EXPORT boolean OCI_API OCI_SetSessionTag(OCI_Connection *con, const otext *tag)
Associate a tag to the given connection/session.
OCI_EXPORT 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_EXPORT boolean OCI_API OCI_MsgSetExpiration(OCI_Msg *msg, int value)
set the duration that the message is available for dequeuing
OCI_EXPORT unsigned int OCI_API OCI_TimestampGetType(OCI_Timestamp *tmsp)
Return the type of the given Timestamp object.
OCI_EXPORT boolean OCI_API OCI_IntervalFromText(OCI_Interval *itv, const otext *str)
Convert a string to an interval and store it in the given interval handle.
void SetSender(const Agent &agent)
Set the original sender of the message.
void SetTime(int hour, int min, int sec, int fsec)
Set the time part.
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
Lob< ostring, LobNationalCharacter > NClob
Class handling NCLOB oracle type.
Definition: ocilib.hpp:4470
bool IsElementNull(unsigned int index) const
check if the element at the given index is null
TypeInfo GetSuperType() const
Return the super type of the given type (e.g. parent type for a derived ORACLE UDT type) ...
ostring GetCorrelation() const
Get the correlation identifier of the message to be dequeued.
OCI_EXPORT OCI_Timestamp *OCI_API OCI_TimestampCreate(OCI_Connection *con, unsigned int type)
Create a local Timestamp instance.
OCI_EXPORT boolean OCI_API OCI_ObjectSetInterval(OCI_Object *obj, const otext *attr, OCI_Interval *value)
Set an object attribute of type Interval.
static void Acquire(MutexHandle handle)
Acquire a mutex lock.
OCI_EXPORT boolean OCI_API OCI_SetStatementCacheSize(OCI_Connection *con, unsigned int value)
Set the maximum number of statements to keep in the statement cache.
OCI_EXPORT boolean OCI_API OCI_ObjectSetBoolean(OCI_Object *obj, const otext *attr, boolean value)
Set an object attribute of type boolean (ONLY for PL/SQL records)
void SetReferenceNull()
Nullify the given Ref handle.
static big_uint GetAllocatedBytes(AllocatedBytesFlags type)
Return the current number of bytes allocated internally in the library.
OCI_EXPORT OCI_Thread *OCI_API OCI_ThreadCreate(void)
Create a Thread object.
void SetParallel(bool value)
Set the parallel loading mode.
OCI_EXPORT boolean OCI_API OCI_SetFormat(OCI_Connection *con, unsigned int type, const otext *format)
Set the format string for implicit string conversions of the given type.
ostring GetSQLVerb() const
Return the verb of the SQL command held by the statement.
OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetColumnCount(OCI_TypeInfo *typinf)
Return the number of columns of a table/view/object.
void SetAttributeNull(const ostring &name)
Set the given object attribute to null.
OCI_EXPORT boolean OCI_API OCI_ObjectSetFloat(OCI_Object *obj, const otext *attr, float value)
Set an object attribute of type float.
OCI_EXPORT OCI_Coll *OCI_API OCI_ObjectGetColl(OCI_Object *obj, const otext *attr)
Return the collection value of the given object attribute.
OCI_EXPORT boolean OCI_API OCI_SetLongMode(OCI_Statement *stmt, unsigned int mode)
Set the long data type handling mode of a SQL statement.
ostring GetService() const
Return the Oracle server Service name of the connected database/service name.
OCI_EXPORT boolean OCI_API OCI_AgentFree(OCI_Agent *agent)
Free an AQ agent object.
OCI_EXPORT OCI_Long *OCI_API OCI_GetLong2(OCI_Resultset *rs, const otext *name)
Return the current Long value of the column from its name in the resultset.
OCI_EXPORT int OCI_API OCI_IntervalCheck(OCI_Interval *itv)
Check if the given interval is valid.
OCI_EXPORT OCI_Connection *OCI_API OCI_StatementGetConnection(OCI_Statement *stmt)
Return the connection handle associated with a statement handle.
OCI_EXPORT boolean OCI_API OCI_QueueTableDrop(OCI_Connection *con, const otext *queue_table, boolean force)
Drop the given queue table.
OCI_EXPORT OCI_Timestamp *OCI_API OCI_GetTimestamp(OCI_Resultset *rs, unsigned int index)
Return the current timestamp value of the column at the given index in the resultset.
OCI_EXPORT boolean OCI_API OCI_BindLong(OCI_Statement *stmt, const otext *name, OCI_Long *data, unsigned int size)
Bind a Long variable.
OCI_EXPORT unsigned int OCI_API OCI_GetBindCount(OCI_Statement *stmt)
Return the number of binds currently associated to a statement.
void SetName(const ostring &value)
Set the given AQ agent name.
OCI_EXPORT OCI_Agent *OCI_API OCI_DequeueListen(OCI_Dequeue *dequeue, int timeout)
Listen for messages that match any recipient of the associated Agent list.
OCI_EXPORT boolean OCI_API OCI_MsgSetPriority(OCI_Msg *msg, int value)
Set the priority of the message.
void SetElementNull(unsigned int index)
Nullify the element at the given index.
OCI_EXPORT int OCI_API OCI_MsgGetEnqueueDelay(OCI_Msg *msg)
Return the number of seconds that a message is delayed for dequeuing.
Object identifying the SQL data type LOB (CLOB, NCLOB and BLOB)
Definition: ocilib.hpp:4169
OCI_EXPORT OCI_TypeInfo *OCI_API OCI_ColumnGetTypeInfo(OCI_Column *col)
Return the type information object associated to the column.
Enum< CollationIDValues > CollationID
Type of Collation ID.
Definition: ocilib.hpp:403
void SetEnqueueDelay(int value)
set the number of seconds to delay the enqueued message
OCI_EXPORT unsigned int OCI_API OCI_PoolGetTimeout(OCI_Pool *pool)
Get the idle timeout for connections/sessions in the pool.
OCI_EXPORT boolean OCI_API OCI_RegisterTimestamp(OCI_Statement *stmt, const otext *name, unsigned int type)
Register a timestamp output bind placeholder.
OCI_EXPORT OCI_File *OCI_API OCI_ObjectGetFile(OCI_Object *obj, const otext *attr)
Return the file value of the given object attribute.
unsigned int Append(const T &content)
Append the given content to the lob.
ostring GetConnectionString() const
Return the name of the connected database/service name.
unsigned int GetServerMajorVersion() const
Return the major version number of the connected database server.
TypeInfo(const Connection &connection, const ostring &name, TypeInfoType type)
Parametrized constructor.
OCI_EXPORT OCI_Interval *OCI_API OCI_ObjectGetInterval(OCI_Object *obj, const otext *attr)
Return the interval value of the given object attribute.
void Open(OpenMode mode)
Open explicitly a Lob.
OCI_EXPORT boolean OCI_API OCI_IntervalFree(OCI_Interval *itv)
Free an OCI_Interval handle.
Internal usage. Allow resolving a native type used by C API from a C++ type in binding operations...
OCI_EXPORT boolean OCI_API OCI_DirPathSave(OCI_DirPath *dp)
Execute a data save-point (server side)
Object GetObject() const
Returns the object pointed by the reference.
OCI_EXPORT boolean OCI_API OCI_MsgSetEnqueueDelay(OCI_Msg *msg, int value)
set the number of seconds to delay the enqueued message
OCI_EXPORT boolean OCI_API OCI_DateGetDate(OCI_Date *date, int *year, int *month, int *day)
Extract the date part from a date handle.
void Execute(const ostring &sql)
Prepare and execute a SQL statement or PL/SQL block.
TypeInfo GetTypeInfo() const
Return the TypeInfo object describing the referenced object.
bool GetNoWait() const
Get the waiting mode used when no more connections/sessions are available from the pool...
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetSize(OCI_Column *col)
Return the size of the column.
static Timestamp SysTimestamp(TimestampType type=NoTimeZone)
return the current system timestamp
static Environment::CharsetMode GetCharset()
Return the OCILIB charset type.
OCI_EXPORT 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_EXPORT boolean OCI_API OCI_TransactionStart(OCI_Transaction *trans)
Start global transaction.
int GetYear() const
Return the date year value.
Lob< ostring, LobCharacter > Clob
Class handling CLOB oracle type.
Definition: ocilib.hpp:4459
bool operator>(const Date &other) const
Indicates if the current date value is superior to the given date value.
void SetExpiration(int value)
set the duration that the message is available for dequeuing
void SetVisibility(EnqueueVisibility value)
Set whether the new message is enqueued as part of the current transaction.
OCI_EXPORT unsigned int OCI_API OCI_GetColumnIndex(OCI_Resultset *rs, const otext *name)
Return the index of the column in the result from its name.
bool IsValid() const
Check if the given timestamp is valid.
OCI_EXPORT boolean OCI_API OCI_BindColl(OCI_Statement *stmt, const otext *name, OCI_Coll *data)
Bind a Collection variable.
void SetSessionTag(const ostring &tag)
Associate a tag to the given connection/session.
OCI_EXPORT unsigned int OCI_API OCI_LongWrite(OCI_Long *lg, void *buffer, unsigned int len)
Write a buffer into a Long.
struct OCI_Coll OCI_Coll
Oracle Collections (VARRAYs and Nested Tables) representation.
Definition: ocilib.h:618
OCI_EXPORT boolean OCI_API OCI_QueueDrop(OCI_Connection *con, const otext *queue_name)
Drop the given queue.
void Set(const ostring &name, const T &value)
Set the given object attribute value.
OCI_EXPORT int OCI_API OCI_ColumnGetPrecision(OCI_Column *col)
Return the precision of the column for numeric columns.
OCI_EXPORT const otext *OCI_API OCI_GetServerName(OCI_Connection *con)
Return the Oracle server machine name of the connected database/service name.
OCI_EXPORT boolean OCI_API OCI_DequeueUnsubscribe(OCI_Dequeue *dequeue)
Unsubscribe for asynchronous messages notifications.
OCI_EXPORT boolean OCI_API OCI_TransactionStop(OCI_Transaction *trans)
Stop current global transaction.
OCI_EXPORT boolean OCI_API OCI_NumberFromText(OCI_Number *number, const otext *str, const otext *fmt)
Convert a string to a number and store it in the given number handle.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfNumbers(OCI_Statement *stmt, const otext *name, OCI_Number **data, unsigned int nbelem)
Bind an array of Number.
OCI_EXPORT unsigned int OCI_API OCI_DirPathGetCurrentRows(OCI_DirPath *dp)
Return the current number of rows used in the OCILIB internal arrays of rows.
OCI_EXPORT boolean OCI_API OCI_MsgSetCorrelation(OCI_Msg *msg, const otext *correlation)
set the correlation identifier of the message
PropertyFlagsValues
Column properties flags values.
Definition: ocilib.hpp:7008
OCI_EXPORT unsigned int OCI_API OCI_ErrorGetRow(OCI_Error *err)
Return the row index which caused an error during statement execution.
OCI_EXPORT boolean OCI_API OCI_ElemFree(OCI_Elem *elem)
Free a local collection element.
OCI_EXPORT const otext *OCI_API OCI_AgentGetName(OCI_Agent *agent)
Get the given AQ agent name.
OCI_EXPORT OCI_DirPath *OCI_API OCI_DirPathCreate(OCI_TypeInfo *typinf, const otext *partition, unsigned int nb_cols, unsigned int nb_rows)
Create a direct path object.
void Unregister()
Unregister a previously registered notification.
OCI_EXPORT boolean OCI_API OCI_LobSeek(OCI_Lob *lob, big_uint offset, unsigned int mode)
Perform a seek operation on the OCI_lob content buffer.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfObjects(OCI_Statement *stmt, const otext *name, OCI_Object **data, OCI_TypeInfo *typinf, unsigned int nbelem)
Bind an array of object handles.
void SetYear(int value)
Set the date year value.
struct OCI_Elem OCI_Elem
Oracle Collection item representation.
Definition: ocilib.h:628
Interval Clone() const
Clone the current instance to a new one performing deep copy.
OCI_EXPORT boolean OCI_API OCI_DirPathFlushRow(OCI_DirPath *dp)
Flushes a partially loaded row from server.
OCI_EXPORT boolean OCI_API OCI_ElemSetTimestamp(OCI_Elem *elem, OCI_Timestamp *value)
Assign a Timestamp handle to a collection element.
OCI_EXPORT boolean OCI_API OCI_Initialize(POCI_ERROR err_handler, const otext *lib_path, unsigned int mode)
Initialize the library.
OCI_EXPORT const otext *OCI_API OCI_GetSql(OCI_Statement *stmt)
Return the last SQL or PL/SQL statement prepared or executed by the statement.
OCI_EXPORT OCI_Number *OCI_API OCI_ObjectGetNumber(OCI_Object *obj, const otext *attr)
Return the number value of the given object attribute.
AQ message.
Definition: ocilib.hpp:7551
Timestamp operator+(int value) const
Return a new Timestamp holding the current Timestamp value incremented by the given number of days...
Database resultset.
Definition: ocilib.hpp:6637
OCI_EXPORT OCI_Coll *OCI_API OCI_GetColl2(OCI_Resultset *rs, const otext *name)
Return the current Collection value of the column from its name in the resultset. ...
DirectPath(const TypeInfo &typeInfo, unsigned int nbCols, unsigned int nbRows, const ostring &partition=OTEXT(""))
Constructor.
OCI_EXPORT boolean OCI_API OCI_ObjectSetString(OCI_Object *obj, const otext *attr, const otext *value)
Set an object attribute of type string.
Date & operator++()
Increment the date by 1 day.
OCI_EXPORT big_uint OCI_API OCI_ElemGetUnsignedBigInt(OCI_Elem *elem)
Return the unsigned big int value of the given collection element.
OCI_EXPORT unsigned int OCI_API OCI_PoolGetMin(OCI_Pool *pool)
Return the minimum number of connections/sessions that can be opened to the database.
bool PingServer() const
Performs a round trip call to the server to confirm that the connection to the server is still valid...
void SetDateFormat(const ostring &format)
Set the default date format string for input conversion.
bool IsReferenceNull() const
Check if the reference points to an object or not.
OCI_EXPORT int OCI_API OCI_MsgGetAttemptCount(OCI_Msg *msg)
Return the number of attempts that have been made to dequeue the message.
Timestamp GetInstanceStartTime() const
Return the date and time (Timestamp) server instance start of the.
static unsigned int GetRuntimeMinorVersion()
Return the minor version number of OCI used at runtime.
unsigned int GetSize() const
Return the size of the column.
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: ocilib.hpp:160
OCI_EXPORT boolean OCI_API OCI_ElemSetShort(OCI_Elem *elem, short value)
Set a short value to a collection element.
int GetWaitTime() const
Return the time that Get() waits for messages if no messages are currently available.
Date GetEnqueueTime() const
return the time the message was enqueued
bool operator!=(const Lob &other) const
Indicates if the current lob value is not equal the given lob value.
big_uint GetMaxSize() const
Returns the lob maximum possible size.
struct OCI_Object OCI_Object
Oracle Named types representation.
Definition: ocilib.h:608
OCI_EXPORT unsigned int OCI_API OCI_BindGetDataCount(OCI_Bind *bnd)
Return the number of elements of the bind handle.
OCI_EXPORT OCI_Mutex *OCI_API OCI_MutexCreate(void)
Create a Mutex object.
unsigned int GetTimeout() const
Get the idle timeout for connections/sessions in the pool.
OCI_EXPORT OCI_Long *OCI_API OCI_LongCreate(OCI_Statement *stmt, unsigned int type)
Create a local temporary Long instance.
OCI_EXPORT boolean OCI_API OCI_IntervalAssign(OCI_Interval *itv, OCI_Interval *itv_src)
Assign the value of a interval handle to another one.
StartModeValues
Oracle instance start modes enumerated values.
Definition: ocilib.hpp:836
OCI_EXPORT int OCI_API OCI_IntervalCompare(OCI_Interval *itv, OCI_Interval *itv2)
Compares two interval handles.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfBigInts(OCI_Statement *stmt, const otext *name, big_int *data, unsigned int nbelem)
Bind an array of big integers.
bool IsValid() const
Check if the given interval is valid.
OCI_EXPORT OCI_Timestamp *OCI_API OCI_ElemGetTimestamp(OCI_Elem *elem)
Return the Timestamp value of the given collection element.
static unsigned int GetRuntimeMajorVersion()
Return the major version number of OCI used at runtime.
int GetDay() const
Return the timestamp day value.
void SetSeconds(int value)
Set the interval seconds value.
bool GetAutoCommit() const
Indicates if auto commit is currently activated.
int GetAttemptCount() const
Return the number of attempts that have been made to dequeue the message.
bool Seek(SeekMode mode, int offset)
Custom Fetch of the resultset.
struct OCI_Column OCI_Column
Oracle SQL Column and Type member representation.
Definition: ocilib.h:474
Raw GetRelativeMsgID() const
Get the message identifier of the message to be dequeued.
unsigned int GetPrefetchSize() const
Return the number of rows pre-fetched by OCI Client.
OCI_EXPORT unsigned int OCI_API OCI_GetDefaultLobPrefetchSize(OCI_Connection *con)
Return the default LOB prefetch buffer size for the connection.
bool IsOpened() const
Check if the specified file is currently opened on the server by our object.
OCI_EXPORT boolean OCI_API OCI_LobFree(OCI_Lob *lob)
Free a local temporary lob.
boolean IsFinalType() const
Indicate if the given UDT type is final.
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetType(OCI_Column *col)
Return the type of the given column.
static bool SetFormat(FormatType formatType, const ostring &format)
Set the format string for implicit string conversions of the given type.
void AddMonths(int months)
Add or subtract months.
bool GetServerOutput(ostring &line) const
Retrieve one line of the server buffer.
ObjectType GetType() const
Return the type of the given object.
OCI_EXPORT OCI_Object *OCI_API OCI_GetObject(OCI_Resultset *rs, unsigned int index)
Return the current Object value of the column at the given index in the resultset.
OCI_EXPORT boolean OCI_API OCI_TimestampGetTimeZoneOffset(OCI_Timestamp *tmsp, int *hour, int *min)
Return the time zone (hour, minute) portion of a timestamp handle.
ostring ToString() const
return a string representation of the current object
int GetExpiration() const
Return the duration that the message is available for dequeuing.
OCI_EXPORT boolean OCI_API OCI_EnqueuePut(OCI_Enqueue *enqueue, OCI_Msg *msg)
Enqueue a message on the queue associated to the Enqueue object.
OCI_EXPORT boolean OCI_API OCI_TransactionResume(OCI_Transaction *trans)
Resume a stopped global transaction.
OCI_EXPORT unsigned int OCI_API OCI_GetSqlErrorPos(OCI_Statement *stmt)
Return the error position (in terms of characters) in the SQL statement where the error occurred in c...
DataType GetType() const
Return the type of the given column.
OCI_EXPORT boolean OCI_API OCI_QueueStop(OCI_Connection *con, const otext *queue_name, boolean enqueue, boolean dequeue, boolean wait)
Stop enqueuing or dequeuing or both on the given queue.
OCI_EXPORT boolean OCI_API OCI_LobAppendLob(OCI_Lob *lob, OCI_Lob *lob_src)
Append a source LOB at the end of a destination LOB.
EnqueueMode GetMode() const
Return the enqueuing mode of messages to enqueue.
void Close()
Close the file on the server.
OCI_EXPORT boolean OCI_API OCI_MsgSetExceptionQueue(OCI_Msg *msg, const otext *queue)
Set the name of the queue to which the message is moved to if it cannot be processed successfully...
OCI_EXPORT boolean OCI_API OCI_RegisterInterval(OCI_Statement *stmt, const otext *name, unsigned int type)
Register an interval output bind placeholder.
bool operator==(const File &other) const
Indicates if the current file value is equal the given file value.
struct OCI_Error OCI_Error
Encapsulates an Oracle or OCILIB exception.
Definition: ocilib.h:689
void SetMonth(int value)
Set the interval month value.
OCI_EXPORT boolean OCI_API OCI_Parse(OCI_Statement *stmt, const otext *sql)
Parse a SQL statement or PL/SQL block.
OCI_EXPORT boolean OCI_API OCI_IntervalSetYearMonth(OCI_Interval *itv, int year, int month)
Set the year / month portion if the given Interval handle.
unsigned int GetSQLCommand() const
Return the Oracle SQL code the command held by the statement.
OCI_EXPORT OCI_Statement *OCI_API OCI_ErrorGetStatement(OCI_Error *err)
Retrieve statement handle within the error occurred.
void SetNavigation(NavigationMode value)
Set the position of messages to be retrieved.
OCI_EXPORT boolean OCI_API OCI_SetFetchMode(OCI_Statement *stmt, unsigned int mode)
Set the fetch mode of a SQL statement.
void SetRelativeMsgID(const Raw &value)
Set a message identifier to use for enqueuing messages using a sequence deviation.
OCI_EXPORT OCI_Number *OCI_API OCI_GetNumber2(OCI_Resultset *rs, const otext *name)
Return the current number value of the column from its name in the resultset.
OCI_EXPORT boolean OCI_API OCI_BindArrayOfColls(OCI_Statement *stmt, const otext *name, OCI_Coll **data, OCI_TypeInfo *typinf, unsigned int nbelem)
Bind an array of Collection handles.
Dequeue object for dequeuing messages into an Oracle Queue.
Definition: ocilib.hpp:8067
OCI_EXPORT boolean OCI_API OCI_DirPathSetDateFormat(OCI_DirPath *dp, const otext *format)
Set the default date format string for input conversion.
void Bind(const ostring &name, T &value, BindInfo::BindDirection mode)
Bind an host variable.
unsigned int GetTimeout() const
Return the transaction Timeout.
void Truncate(big_uint length)
Truncate the lob to a shorter length.
Transaction(const Connection &connection, unsigned int timeout, TransactionFlags flags, OCI_XID *pxid=nullptr)
Create a new global transaction or a serializable/read-only local transaction.
OCI_EXPORT boolean OCI_API OCI_DequeueSetRelativeMsgID(OCI_Dequeue *dequeue, const void *id, unsigned int len)
Set the message identifier of the message to be dequeued.
OCI_EXPORT boolean OCI_API OCI_RegisterRaw(OCI_Statement *stmt, const otext *name, unsigned int len)
Register an raw output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_DirPathFinish(OCI_DirPath *dp)
Terminate a direct path operation and commit changes into the database.
OCI_EXPORT boolean OCI_API OCI_EnqueueFree(OCI_Enqueue *enqueue)
Free a Enqueue object.
bool First()
Fetch the first row of the resultset.
void SetYearMonth(int year, int month)
Set the Year / Month parts.
OCI_EXPORT boolean OCI_API OCI_RefAssign(OCI_Ref *ref, OCI_Ref *ref_src)
Assign a Ref to another one.
OCI_EXPORT const otext *OCI_API OCI_GetTrace(OCI_Connection *con, unsigned int trace)
Get the current trace for the trace type from the given connection.
bool Seek(SeekMode seekMode, big_uint offset)
Move the current position within the lob for read/write operations.
OCI_EXPORT OCI_Msg *OCI_API OCI_MsgCreate(OCI_TypeInfo *typinf)
Create a message object based on the given payload type.
void GetTimeZoneOffset(int &hour, int &min) const
Return the time zone (hour, minute) offsets.
OCI_EXPORT boolean OCI_API OCI_AgentSetAddress(OCI_Agent *agent, const otext *address)
Set the given AQ agent address.
void Truncate(unsigned int size)
Trim the given number of elements from the end of the collection.
static ThreadId GetThreadId(ThreadHandle handle)
Return the system Thread ID of the given thread handle.
bool operator==(const Interval &other) const
Indicates if the current Interval value is equal to the given Interval value.
OCI_EXPORT boolean OCI_API OCI_LobFlush(OCI_Lob *lob)
Flush Lob content to the server.
static void Create(const ostring &name, ThreadKeyFreeProc freeProc=nullptr)
Create a thread key object.
void EnableBuffering(bool value)
Enable / disable buffering mode on the given lob object.
bool operator-=(int offset)
Convenient operator overloading that performs a call to Seek() with Resultset::SeekRelative and the g...
int GetHours() const
Return the timestamp hours value.
T Get(const ostring &name) const
Return the given object attribute value.
EnvironmentFlagsValues
Environment Flags enumerated values.
Definition: ocilib.hpp:730
OCI_EXPORT OCI_Lob *OCI_API OCI_GetLob(OCI_Resultset *rs, unsigned int index)
Return the current lob value of the column at the given index in the resultset.
struct OCI_Event OCI_Event
OCILIB encapsulation of Oracle DCN event.
Definition: ocilib.h:739
void FlushRow()
Flushes a partially loaded row from server.
OCI_EXPORT boolean OCI_API OCI_BindUnsignedShort(OCI_Statement *stmt, const otext *name, unsigned short *data)
Bind an unsigned short variable.
OCI_EXPORT OCI_Subscription *OCI_API OCI_SubscriptionRegister(OCI_Connection *con, const otext *name, unsigned int type, POCI_NOTIFY handler, unsigned int port, unsigned int timeout)
Register a notification against the given database.
OCI_EXPORT OCI_Ref *OCI_API OCI_ElemGetRef(OCI_Elem *elem)
Return the Ref value of the given collection element.
OCI_EXPORT boolean OCI_API OCI_RegisterFloat(OCI_Statement *stmt, const otext *name)
Register a float output bind placeholder.
OCI_EXPORT boolean OCI_API OCI_NumberMultiply(OCI_Number *number, unsigned int type, void *value)
Multiply the given number with the value of a native C numeric.
OCI_EXPORT boolean OCI_API OCI_ElemSetFloat(OCI_Elem *elem, float value)
Set a float value to a collection element.
Subscription to database or objects changes.
Definition: ocilib.hpp:7200
ostring GetDatabaseName() const
Return the name of the database that generated the event.
Raw GetOriginalID() const
Return the original ID of the message in the last queue that generated this message.
BindMode GetBindMode() const
Return the binding mode of a SQL statement.
OCI_EXPORT unsigned int OCI_API OCI_ObjectGetRawSize(OCI_Object *obj, const otext *attr)
Return the raw attribute value size of the given object attribute into the given buffer.
ostring GetDirectory() const
Return the file directory.
struct OCI_Lob OCI_Lob
Oracle Internal Large objects:
Definition: ocilib.h:497
LongMode GetLongMode() const
Return the long data type handling mode of a SQL statement.
OCI_EXPORT boolean OCI_API OCI_BindRef(OCI_Statement *stmt, const otext *name, OCI_Ref *data)
Bind a Ref variable.
OCI_EXPORT boolean OCI_API OCI_FileIsEqual(OCI_File *file, OCI_File *file2)
Compare two file handle for equality.
OCI_EXPORT boolean OCI_API OCI_Cleanup(void)
Clean up all resources allocated by the library.
void Save()
Execute a data save-point (server side)
big_uint Erase(big_uint offset, big_uint length)
Erase a portion of the lob at a given position.
FailoverResult(* TAFHandlerProc)(Connection &con, FailoverRequest failoverRequest, FailoverEvent failoverEvent)
User callback for TAF event notifications.
Definition: ocilib.hpp:1896
OCI_EXPORT unsigned int OCI_API OCI_BindGetType(OCI_Bind *bnd)
Return the OCILIB type of the given bind.
OCI_EXPORT OCI_Number *OCI_API OCI_NumberCreate(OCI_Connection *con)
Create a local number object.
static ThreadHandle Create()
Create a Thread.
Connection()
Default constructor.
OCI_EXPORT OCI_Pool *OCI_API OCI_PoolCreate(const otext *db, const otext *user, const otext *pwd, unsigned int type, unsigned int mode, unsigned int min_con, unsigned int max_con, unsigned int incr_con)
Create an Oracle pool of connections or sessions.
bool Exists() const
Check if the given file exists on server.
OCI_EXPORT boolean OCI_API OCI_BindNumber(OCI_Statement *stmt, const otext *name, OCI_Number *data)
Bind an Number variable.
OCI_EXPORT boolean OCI_API OCI_TimestampConvert(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp_src)
Convert one timestamp value from one type to another.