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