new error code for empty arrays

This commit is contained in:
2020-05-07 15:42:51 +02:00
committed by Andrew Johnson
parent afdf34b791
commit 5d808b7c02
4 changed files with 6 additions and 5 deletions

View File

@@ -958,7 +958,7 @@ long dbGet(DBADDR *paddr, short dbrType,
DBADDR localAddr = *paddr; /* Structure copy */
if (pfl->no_elements < 1) {
status = S_db_badField;
status = S_db_emptyArray;
goto done;
}

View File

@@ -205,6 +205,7 @@ struct dbr_alDouble {DBRalDouble};
#define S_db_noMemory (M_dbAccess|66) /*unable to allocate data structure from pool*/
#define S_db_notInit (M_dbAccess|67) /*Not initialized*/
#define S_db_bufFull (M_dbAccess|68) /*Buffer full*/
#define S_db_emptyArray (M_dbAccess|69) /*Array has no elements*/
struct dbEntry;

View File

@@ -206,7 +206,7 @@ static long dbDbGetValue(struct link *plink, short dbrType, void *pbuffer,
/* For the moment, empty arrays are not supported by EPICS */
if (dbChannelFinalElements(chan) <= 0) /* empty array request */
return S_db_badField;
return S_db_emptyArray;
if (ellCount(&chan->filters)) {
/* If filters are involved in a read, create field log and run filters */
@@ -227,7 +227,7 @@ static long dbDbGetValue(struct link *plink, short dbrType, void *pbuffer,
return status;
if (pnRequest && *pnRequest <= 0) /* empty array result */
return S_db_badField;
return S_db_emptyArray;
}
if (!status && precord != dbChannelRecord(chan))

View File

@@ -46,9 +46,9 @@ static void expectProcSuccess(const char *rec)
static void expectProcFailure(const char *rec)
{
char fieldname[20];
testDiag("expecting failure S_db_badField %#x from %s", S_db_badField, rec);
testDiag("expecting failure S_db_emptyArray %#x from %s", S_db_emptyArray, rec);
sprintf(fieldname, "%s.PROC", rec);
testdbPutFieldFail(S_db_badField, fieldname, DBF_LONG, 1);
testdbPutFieldFail(S_db_emptyArray, fieldname, DBF_LONG, 1);
sprintf(fieldname, "%s.SEVR", rec);
testdbGetFieldEqual(fieldname, DBF_LONG, INVALID_ALARM);
sprintf(fieldname, "%s.STAT", rec);