Import the hdbObject value as a JSON. Note that the JSON must be compatible with the native data class.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbObject::ImportJSON | (hzChain&,) |
Declared in file: hzDatabase.h
Defined in file : hdbObject.cpp
Function Logic:
Function body:
hzEcode hdbObject::ImportJSON (hzChain& J)
{
// Import the hdbObject value as a JSON. Note that the JSON must be compatible with the native data class.
//
// Arguments: 1) J The JSON as hzChain
//
// Returns: E_NOINIT If this hdbObject is not initialized
// E_NODATA If the supplied JSON is empty
// E_FORMAT If the JSON does not comply with the data class
// E_OK Operation successful
_hzfunc("hdbObject::ImportJSON") ;
hzChain err ; // Gather all errors
chIter zi ; // Chain iterator
hzEcode rc ; // Return code
if (!m_pClass) return E_NOINIT ;
if (!J.Size()) return E_NODATA ;
Clear() ;
zi = J ;
if (*zi != CHAR_CUROPEN)
return E_FORMAT ;
if (!m_pRoot)
m_pRoot = _obj_data::GetInstance(m_pClass) ;
rc = _import_json_r(err, zi, m_pRoot) ;
if (rc != E_OK)
{ threadLog("START IMPORT ERROR\n") ; threadLog(err) ; threadLog("END IMPORT ERROR\n") ; }
return rc ;
}