- added hvali command (does not throw an error when geterror is defined)
This commit is contained in:
@ -2850,6 +2850,37 @@ static int GetHdbVal(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int GetHdbValIgnoreError(
|
||||||
|
SConnection * pCon, SicsInterp * pSics, void *pData, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
pHdb targetNode = NULL;
|
||||||
|
pDynString parData = NULL;
|
||||||
|
int protocol, outCode;
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
|
SCWrite(pCon, "ERROR: syntax must be: hvali <path>", eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetNode = FindHdbNode(NULL, argv[1], pCon);
|
||||||
|
if (targetNode == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
parData = formatValue(targetNode->value, targetNode);
|
||||||
|
if (parData == NULL) {
|
||||||
|
SCWrite(pCon, "ERROR: out of memory formatting data", eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((protocol = isJSON(pCon, 0)) == 1)
|
||||||
|
outCode = eHdbEvent;
|
||||||
|
else
|
||||||
|
outCode = eValue;
|
||||||
|
SCWrite(pCon, GetCharArray(parData), outCode);
|
||||||
|
DeleteDynString(parData);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
static int countChildren(pHdb node)
|
static int countChildren(pHdb node)
|
||||||
{
|
{
|
||||||
@ -4269,6 +4300,7 @@ int InstallSICSHipadaba(SConnection * pCon, SicsInterp * pSics,
|
|||||||
AddCommand(pSics, "hupdate", UpdateHdbNode, NULL, NULL);
|
AddCommand(pSics, "hupdate", UpdateHdbNode, NULL, NULL);
|
||||||
AddCommand(pSics, "hget", GetHdbNode, NULL, NULL);
|
AddCommand(pSics, "hget", GetHdbNode, NULL, NULL);
|
||||||
AddCommand(pSics, "hval", GetHdbVal, NULL, NULL);
|
AddCommand(pSics, "hval", GetHdbVal, NULL, NULL);
|
||||||
|
AddCommand(pSics, "hvali", GetHdbValIgnoreError, NULL, NULL);
|
||||||
AddCommand(pSics, "hzipget", ZipGetHdbNode, NULL, NULL);
|
AddCommand(pSics, "hzipget", ZipGetHdbNode, NULL, NULL);
|
||||||
AddCommand(pSics, "hzipread", ZipReadHdbNode, NULL, NULL);
|
AddCommand(pSics, "hzipread", ZipReadHdbNode, NULL, NULL);
|
||||||
AddCommand(pSics, "hbinread", BinReadHdbNode, NULL, NULL);
|
AddCommand(pSics, "hbinread", BinReadHdbNode, NULL, NULL);
|
||||||
@ -4277,7 +4309,6 @@ int InstallSICSHipadaba(SConnection * pCon, SicsInterp * pSics,
|
|||||||
AddCommand(pSics, "hdelcb", RemoveHdbCallback, NULL, NULL);
|
AddCommand(pSics, "hdelcb", RemoveHdbCallback, NULL, NULL);
|
||||||
AddCommand(pSics, "hlink", LinkHdbNode, NULL, NULL);
|
AddCommand(pSics, "hlink", LinkHdbNode, NULL, NULL);
|
||||||
AddCommand(pSics, "hinfo", HdbNodeInfo, NULL, NULL);
|
AddCommand(pSics, "hinfo", HdbNodeInfo, NULL, NULL);
|
||||||
/* AddCommand(pSics, "hval", HdbNodeVal, NULL, NULL);*/
|
|
||||||
AddCommand(pSics, "hchain", ChainHdbNode, NULL, NULL);
|
AddCommand(pSics, "hchain", ChainHdbNode, NULL, NULL);
|
||||||
AddCommand(pSics, "hcommand", SicsCommandNode, NULL, NULL);
|
AddCommand(pSics, "hcommand", SicsCommandNode, NULL, NULL);
|
||||||
AddCommand(pSics, "harray", HdbArrayNode, NULL, NULL);
|
AddCommand(pSics, "harray", HdbArrayNode, NULL, NULL);
|
||||||
|
Reference in New Issue
Block a user