⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ocicmplx.cpp

📁 一个通用的oracle OCI开发程序包
💻 CPP
字号:
#ifndef _COCIComplexObject
#include "ocicmplx.h"
#endif

#ifndef _COCISession
#include "ocisess.h"
#endif

#ifndef _COCIObject
#include "ociobj.h"
#endif


COCIComplexObject::COCIComplexObject(const COCISession& sess, const COCIObject& root, unsigned long level)
: m_Session(sess)
, m_Root(root)
, m_corhp(0)
, m_cordp(0)
, m_Level(level)
, m_OutOfLine(false)
{
  CHECK(m_Session.get_error(), OCIHandleAlloc((dvoid *)m_Session.get_env(), 
                                              (dvoid **)&m_corhp,
                                              (ub4)OCI_HTYPE_COMPLEXOBJECT, 0, 
	                                            (dvoid **)0));

  CHECK(m_Session.get_error(), OCIDescriptorAlloc((dvoid *)m_Session.get_env(), 
                                                  (dvoid **)&m_cordp,
                                                  (ub4)OCI_DTYPE_COMPLEXOBJECTCOMP, 0, 
	                                                (dvoid **)0));

  // Set the root object
  CHECK(m_Session.get_error(), OCIAttrSet((dvoid *)m_cordp,
         (ub4)OCI_DTYPE_COMPLEXOBJECTCOMP, (dvoid *)root.get_type().get_tdo(),
         (ub4)sizeof(dvoid *), (ub4)OCI_ATTR_COMPLEXOBJECTCOMP_TYPE,
         (OCIError *)m_Session.get_error()));

  set_level(m_Level);
  set_outofline(m_OutOfLine);
  set();
}

COCIComplexObject::~COCIComplexObject()
{
    /* free COR descriptor and COR handle */
  CHECK(m_Session.get_error(), OCIDescriptorFree((dvoid *)m_cordp,
          (ub4)OCI_DTYPE_COMPLEXOBJECTCOMP));

  CHECK(m_Session.get_error(), OCIHandleFree((dvoid *)m_corhp,
          (ub4)OCI_HTYPE_COMPLEXOBJECT));

}

void COCIComplexObject::set_level(unsigned long level)
{
  m_Level = level;
  CHECK(m_Session.get_error(), OCIAttrSet((dvoid *)m_cordp,
         (ub4)OCI_DTYPE_COMPLEXOBJECTCOMP,
         (dvoid *)&m_Level, (ub4)sizeof(ub4),
         (ub4)OCI_ATTR_COMPLEXOBJECTCOMP_TYPE_LEVEL, (OCIError *)m_Session.get_error()));
  set();
}

void COCIComplexObject::set_outofline(bool outofline)
{
  m_OutOfLine = outofline;
  CHECK(m_Session.get_error(), OCIAttrSet((dvoid *)m_corhp,(ub4) OCI_HTYPE_COMPLEXOBJECT,
             (dvoid *)&m_OutOfLine, (ub4)sizeof(ub1), (ub4)OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE,
             (OCIError *)m_Session.get_error()));     
  set();
}

void COCIComplexObject::set()
{
  CHECK(m_Session.get_error(), OCIParamSet(m_corhp, OCI_HTYPE_COMPLEXOBJECT, m_Session.get_error(),
           m_cordp, OCI_DTYPE_COMPLEXOBJECTCOMP, 1));
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -