コード例 #1
0
CDB::stringSeq* DAOProxy::get_string_seq (const char * propertyName)
{
    //ACS_TRACE("cdb::DAOProxy::get_string_seq");

    // check remote mode
    if (m_dao.ptr() != CDB::DAO::_nil()) 
	return m_dao->get_string_seq(propertyName);

    string value;
    try{
    get_field(propertyName, value);
    }catch(cdbErrType::CDBFieldDoesNotExistExImpl ex){
	throw ex.getCDBFieldDoesNotExistEx();
    }

    VectorString array;
    split(value.c_str(), array);

    CDB::stringSeq_var seq = new CDB::stringSeq();
    seq->length(array.size());

    CORBA::ULong i = 0;
    for (VectorString::const_iterator iter = array.begin();
	 iter != array.end(); iter++)
	{
	seq[i++] = CORBA::string_dup(iter->c_str());
	}

    return seq._retn();
}
コード例 #2
0
CDB::stringSeq* DAOImpl::get_string_seq (
    const char * propertyName
    
  )
{
	Field fld;
	if( !get_field(propertyName, fld) )
	{
		throw CDBFieldDoesNotExistExImpl (
			__FILE__, __LINE__,
			"DAOImpl::get_long").getCDBFieldDoesNotExistEx();
	}
    
	if(fld.GetType() != Field::tyStringArray)
	{
		throw WrongCDBDataTypeExImpl (
			__FILE__, __LINE__,
			"DAOImpl::get_long").getWrongCDBDataTypeEx();
	}

	// create return value
	CDB::stringSeq_var retSeq;
	ACE_NEW_THROW_EX (retSeq, CDB::stringSeq, CORBA::NO_MEMORY ());
	ACE_CHECK_RETURN (0);

	StringArray * ary = fld.GetStringArray();
	retSeq->length( ary->size() );
	CORBA::ULong n=0;
	for(StringArray::const_iterator aiter = ary->begin(); aiter != ary->end(); ++aiter) 
	{
		retSeq[n++] = CORBA::string_dup( aiter->c_str() );
	}
	
	return retSeq._retn();
	
}