fix dbLoadGroup

This commit is contained in:
Michael Davidsaver
2022-11-03 09:16:59 -07:00
parent 5c75fd7bfc
commit db5af06e07
3 changed files with 8 additions and 2 deletions

View File

@ -4,4 +4,6 @@ dbLoadRecords("image.db","N=TST:image1")
dbLoadRecords("table.db","N=TST:table1") dbLoadRecords("table.db","N=TST:table1")
dbLoadRecords("ntenum.db","P=TST:enum1") dbLoadRecords("ntenum.db","P=TST:enum1")
dbLoadGroup("image.json")
iocInit() iocInit()

View File

@ -239,7 +239,7 @@ struct PDBProcessor
#ifdef USE_MULTILOCK #ifdef USE_MULTILOCK
try { try {
GroupConfig::parse(json, "", conf); GroupConfig::parse(json, NULL, conf);
if(!conf.warning.empty()) if(!conf.warning.empty())
fprintf(stderr, "warning(s) from dbGroup file \"%s\"\n%s", it->c_str(), conf.warning.c_str()); fprintf(stderr, "warning(s) from dbGroup file \"%s\"\n%s", it->c_str(), conf.warning.c_str());
}catch(std::exception& e){ }catch(std::exception& e){

View File

@ -40,19 +40,23 @@ namespace pva = epics::pvAccess;
DBCH::DBCH(dbChannel *ch) :chan(ch) DBCH::DBCH(dbChannel *ch) :chan(ch)
{ {
if(!chan)
throw std::invalid_argument("NULL channel");
prepare(); prepare();
} }
DBCH::DBCH(const std::string& name) DBCH::DBCH(const std::string& name)
:chan(dbChannelCreate(name.c_str())) :chan(dbChannelCreate(name.c_str()))
{ {
if(!chan)
throw std::invalid_argument(SB()<<"invalid channel: "<<name);
prepare(); prepare();
} }
void DBCH::prepare() void DBCH::prepare()
{ {
if(!chan) if(!chan)
throw std::invalid_argument("NULL channel"); throw std::invalid_argument(SB()<<"NULL channel");
if(dbChannelOpen(chan)) { if(dbChannelOpen(chan)) {
dbChannelDelete(chan); dbChannelDelete(chan);
throw std::invalid_argument(SB()<<"Failed to open channel "<<dbChannelName(chan)); throw std::invalid_argument(SB()<<"Failed to open channel "<<dbChannelName(chan));