Set binary member value within data object. The object must be initialized to a data class, and the supplied member must exist within that class and be of a BINARY datatype. This function will copy the supplied chain to the core entry of the applicable member, and sets the member litmus byte to LITMUS_SET to state that the member has a new value. The chain is NOT committed to the target binary repository at this juncture. This will only happen when the onject as a whole is committed to the applicable data object repository, in either an INSERT or an UPDATE operation. Note that BINARY members have an aux core entry in addition to the standard core entry. The aux is used to store the datum id of the chain. This is only set on a FETCH. In a new object, the aux is 0. In an existing object, the aux will contain the datim id that was previously assigned. On UPDATE, if the chain has changed, the datum id in the aux is used to DELETE the previous datum.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbObject::SetBinary | (hdbMember*,hzChain&,) |
Declared in file: hzDatabase.h
Defined in file : hdbObject.cpp
Function Logic:
Function body:
hzEcode hdbObject::SetBinary (hdbMember* pMbr)hzChain& Z,
{
// Set binary member value within data object.
//
// The object must be initialized to a data class, and the supplied member must exist within that class and be of a BINARY datatype. This function will copy the supplied chain
// to the core entry of the applicable member, and sets the member litmus byte to LITMUS_SET to state that the member has a new value. The chain is NOT committed to the target
// binary repository at this juncture. This will only happen when the onject as a whole is committed to the applicable data object repository, in either an INSERT or an UPDATE
// operation.
//
// Note that BINARY members have an aux core entry in addition to the standard core entry. The aux is used to store the datum id of the chain. This is only set on a FETCH. In
// a new object, the aux is 0. In an existing object, the aux will contain the datim id that was previously assigned. On UPDATE, if the chain has changed, the datum id in the
// aux is used to DELETE the previous datum.
//
// Arguments: 1) pMbr The member
// 2) Z The chain value the member will be set to
//
// Returns: E_NOINIT If the object has not been initialized to a class
// E_ARGUMENT If no member is supplied
// E_CORRUPT If the supplied member number does not identify an object class member.
// E_TYPE If the object class member is not atomic (is another class) or if the supplied atom has the wrong type.
// E_OK If the object class member has been set to the supplied atom value.
_hzfunc("hdbObject::SetBinary") ;
if (!this) hzexit(E_CORRUPT, "No instance") ;
if (!m_pClass) return hzerr(E_NOINIT, "Single object container not init to a data class") ;
if (!pMbr) return hzerr(E_ARGUMENT, "No member supplied") ;
if (pMbr->Class() != m_pClass)
return hzerr(E_CORRUPT, "Member %s does not belong to class %s", pMbr->txtName(), m_pClass->txtName()) ;
if (pMbr->Basetype() != BASETYPE_BINARY && pMbr->Basetype() != BASETYPE_TXTDOC)
return hzerr(E_TYPE, "Member %s is not BINARY or TXTDOC", pMbr->txtName()) ;
if (!m_pRoot)
m_pRoot = _obj_data::GetInstance(m_pClass) ;
return m_pRoot->SetBinary(pMbr, Z) ;
}