EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: dbreport or similar?
From: Andrew Johnson <[email protected]>
To: <[email protected]>
Date: Fri, 21 Apr 2017 11:40:02 -0500
Hi Steve,

On 04/21/2017 09:07 AM, Steve Kinder wrote:
> Does dbreport still exist or anything similar to parse a database and
> list say record names, desc fields etc to a text and/or html file?

The tricky thing about "parsing a database" is that the majority of IOC
database files are loaded using macro substitution parameters, and you
would need to pass exactly the same sets of macros into such a parser to
get the same list of database records and field values out as the IOC,
given the same input files.

Any modern scripting language should be able to extract record names and
field values out of a DB file if you're OK with being fairly simplistic
about it though (i.e. you don't care about expanding macros or include
statements, or about checking record types and field values against the
IOC's DBD file). The syntax is described in the Application Developers
Guide Chapter 6 (Database Definition).

However if you need to know the values of fields that are unset (i.e.
get the default value for that record type) you will have to parse and
understand the IOC's DBD file as well, which is rather more complex. I
have some unreleased Perl code which can help with doing the latter
(derived from the DBD file parser that comes with Base-3.15.x) although
it would need some work to extract and generate the output you're
looking for (for reasonably experienced Perl programmers only though).

You could also write your own C program that uses the dbStatic library
from Base to generate what you're after, which will similarly need to
load the IOC's DBD file as well as the DB file(s) you want to extract
data from. There are a couple of examples showing how to do this here:

http://www.aps.anl.gov/epics/base/R3-14/12-docs/AppDevGuide/node15.html#SECTION0015160000000000000000
Note however that the dbStatic APIs are no longer supported for host
tools in Base-3.15 and later, so this isn't a recommended approach.

HTH,

- Andrew

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon

Replies:
Re: dbreport or similar? Michael Davidsaver
References:
dbreport or similar? Steve Kinder

Navigate by Date:
Prev: dbreport or similar? Steve Kinder
Next: Re: dbreport or similar? Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: dbreport or similar? Steve Kinder
Next: Re: dbreport or similar? Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024