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