From 17a8dbc2d7a8fd8673ed7cc3bc044cfeef25951e Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 12 Feb 2020 12:09:40 +0100 Subject: [PATCH] apply filters in dbDbGetValue --- modules/database/src/ioc/db/dbDbLink.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/dbDbLink.c b/modules/database/src/ioc/db/dbDbLink.c index a86272eb9..0eb3ad34f 100644 --- a/modules/database/src/ioc/db/dbDbLink.c +++ b/modules/database/src/ioc/db/dbDbLink.c @@ -61,6 +61,7 @@ #include "dbConvertFast.h" #include "dbConvert.h" #include "db_field_log.h" +#include "db_access_routines.h" #include "dbFldTypes.h" #include "dbLink.h" #include "dbLockPvt.h" @@ -184,7 +185,18 @@ static long dbDbGetValue(struct link *plink, short dbrType, void *pbuffer, if (dbrType < 0 || dbrType > DBR_ENUM || dbfType > DBF_DEVICE) return S_db_badDbrtype; - if (dbChannelFinalElements(chan) == 1 && (!pnRequest || *pnRequest == 1) + /* If filters are involved in a read, create field log and run filters */ + if (ellCount(&chan->filters)) { + db_field_log *pfl; + long options = 0; + pfl = db_create_read_log(chan); + if (pfl) { + pfl = dbChannelRunPreChain(chan, pfl); + pfl = dbChannelRunPostChain(chan, pfl); + status = dbChannelGet(chan, dbrType, pbuffer, &options, pnRequest, pfl); + db_delete_field_log(pfl); + } + } else if (dbChannelFinalElements(chan) == 1 && (!pnRequest || *pnRequest == 1) && dbChannelSpecial(chan) != SPC_DBADDR && dbChannelSpecial(chan) != SPC_ATTRIBUTE) { ppv_link->getCvt = dbFastGetConvertRoutine[dbfType][dbrType];