Remove the key/object pair named by the supplied key, from the index
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbIndexUkey::Delete | (hzAtom&,) |
Declared in file: hzDatabase.h
Defined in file : hdbIndex.cpp
Function Logic:
Function body:
hzEcode hdbIndexUkey::Delete (hzAtom& key)
{
// Remove the key/object pair named by the supplied key, from the index
//
// Arguments: 1) atom Reference to atom with the lookup value.
//
// Returns: E_NODATA If the supplied atom has no value
// E_TYPE If the atom data type does not match that of the member to which this index applies
// E_NOTFOUND If the value of the atom does not identify an object
// E_OK If the value of the atom does identify an object
_hzfunc("hdbIndexUkey::Delete") ;
hzString str ; // String
hzDomain dom ; // Domain name if applicable
hzEmaddr ema ; // Email addr if applicable
hzUrl url ; // URL if applicable
hzEcode rc = E_OK ; // Return code
if (!m_bInit) return E_NOINIT ;
if (key.IsNull()) return E_NODATA ;
if (key.Type() != m_eBasetype)
return hzerr(E_TYPE, "Index type %s - supplied value type %s", Basetype2Txt(m_eBasetype), Basetype2Txt(key.Type())) ;
// Do lookup based on type
switch (m_eBasetype)
{
case BASETYPE_DOMAIN: dom = key.Domain() ;
if (dom)
{
_hzGlobal_setDomains[dom].Clear() ;
rc = m_keys.pDom->Delete(dom) ;
}
break ;
case BASETYPE_EMADDR: ema = key.Emaddr() ;
if (ema)
{
_hzGlobal_setEmaddrs[ema].Clear() ;
rc = m_keys.pEma->Delete(ema) ;
}
break ;
case BASETYPE_STRING: str = key.Str() ;
if (str)
{
_hzGlobal_setStrings[str].Clear() ;
rc = m_keys.pStr->Delete(str) ;
}
break ;
case BASETYPE_URL: url = key.Url() ;
if (url)
{
// _hzGlobal_setStrings.Delete(str) ;
rc = m_keys.pUrl->Delete(url) ;
}
break ;
case BASETYPE_DOUBLE:
case BASETYPE_XDATE:
case BASETYPE_INT64:
case BASETYPE_UINT64: rc = m_keys.pUI64->Delete(key.Unt64()) ; break ;
case BASETYPE_IPADDR:
case BASETYPE_TIME:
case BASETYPE_SDATE:
case BASETYPE_INT32:
case BASETYPE_UINT32: rc = m_keys.pUI32->Delete(key.Unt32()) ; break ;
} ;
return rc ;
}