ociind.inl

来自「一个通用的oracle OCI开发程序包」· INL 代码 · 共 133 行

INL
133
字号
template<class T>
CIndStruct<T>::CIndStruct()
: m_Rows(0)
{
}

template<class T>
CIndStruct<T>::CIndStruct(ub4 rows, std::vector<T>& type)
: m_Rows(rows)
{
  indpp = new dvoid * [rows];
  memset(indpp, 0, sizeof(dvoid**) * rows);
  m_indpp_list.push_back(indpp);

  pgvpp = new dvoid * [rows];
  memset(pgvpp, 0, sizeof(dvoid**) * rows);
  m_pgvpp_list.push_back(pgvpp);

  indszp = new ub4[rows];
  memset(indszp, 0, sizeof(ub4*) * rows);
  m_indszp_list.push_back(indszp);

  pvszp = new ub4[rows];
  memset(pvszp, 0, sizeof(ub4*) * rows);
  m_pvszp_list.push_back(pvszp);

  m_TypeInd.push_back(&type);
}

template<class T>
CIndStruct<T>::~CIndStruct()
{
  int size = m_pgvpp_list.size();
  for(ub4 obj = 0; obj < size; obj++)
  {
    dvoid** a = m_pgvpp_list[obj];
    dvoid** b = m_indpp_list[obj];
    ub4*    c = m_indszp_list[obj];
    ub4*    d = m_pvszp_list[obj];

    delete [] a;
    a = 0;
    delete [] b;
    b = 0;
    delete [] c;
    c = 0;
    delete [] d;
    d = 0;
  }
}

template<class T>
void CIndStruct<T>::fix_up_obj(ub4 rows_fetched)
{
  if(m_Rows > 0)
  {
    for(ub4 obj = 0; obj < m_TypeInd.size(); obj++)
    {
      std::vector<T>*t = m_TypeInd[obj];
      // We can shorten the number of objects to the actual size
      if(rows_fetched < t->size())
      {
        t->erase(t->begin() + rows_fetched,t->end());
      }

      dvoid** a = m_pgvpp_list[obj];
      dvoid** b = m_indpp_list[obj];

      for(ub4 i = 0; i < rows_fetched; i++)
      {
        (*t)[i].set_instance(*a);
        (*t)[i].set_null_struct(*b);
        a++;
        b++;
      }
    }
  }
}

template<class T>
void CIndStruct<T>::fix_up_ref(ub4 rows_fetched)
{
  if(m_Rows > 0)
  {
    int type_ind_size = m_TypeInd.size();

    for(ub4 obj = 0; obj < m_TypeInd.size(); obj++)
    {
      std::vector<T>*t = m_TypeInd[obj];
      // We can shorten the number of objects to the actual size
      if(rows_fetched < t->size())
      {
        t->erase(t->begin() + rows_fetched,t->end());
      }

      dvoid** a = m_pgvpp_list[obj];
      for(ub4 i = 0; i < rows_fetched; i++)
      {
        (*t)[i].set_instance(*a);
        a++;
      }
    }
  }
}

template<class T>
void CIndStruct<T>::fix_up_coll(ub4 rows_fetched)
{
  if(m_Rows > 0)
  {
    for(ub4 obj = 0; obj < m_TypeInd.size(); obj++)
    {
      std::vector<T>*t = m_TypeInd[obj];
      // We can shorten the number of objects to the actual size
      if(rows_fetched < t->size())
      {
        t->erase(t->begin() + rows_fetched,t->end());
      }

      dvoid** a = m_pgvpp_list[obj];
      dvoid** b = m_indpp_list[obj];

      for(ub4 i = 0; i < rows_fetched; i++)
      {
        (*t)[i].get_obj().set_instance(*a);
        (*t)[i].get_obj().set_null_struct(*b);
        a++;
        b++;
      }
    }
  }
}

⌨️ 快捷键说明

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