是否可以使用 SQL 查询来查明 Mirth 频道是否被禁用?

问题描述 投票:0回答:2

是否可以使用 SQL 查询来查明 Mirth 频道是否被禁用?我知道这可以通过 API 调用来完成,但我正在尝试使用纯数据库方法。

sql mirth
2个回答
1
投票

是的,你可以。

SELECT * FROM public.configuration where name = 'channelMetadata';
将返回一个 XML 字符串,其中包含具有启用/禁用状态、上次修改时间戳和修剪选项的通道元数据。

这些条目看起来像:

  <entry>
    <string>C88749A7-BDF5-45D8-AC41-DF0884B15098</string>
    <com.mirth.connect.model.ChannelMetadata>
      <enabled>false</enabled>
      <lastModified>
        <time>1621527614990</time>
        <timezone>America/Chicago</timezone>
      </lastModified>
      <pruningSettings>
        <pruneMetaDataDays>3</pruneMetaDataDays>
        <archiveEnabled>false</archiveEnabled>
      </pruningSettings>
    </com.mirth.connect.model.ChannelMetadata>
  </entry>

它们是序列化的 Java

Map<String, com.mirth.connect.model.ChannelMetadata>
。关键是通道 ID,您可以在
channel
表中查找名称、通道定义本身等

请注意,这显示启用/禁用,与启动/停止不同。启动/停止状态只能通过 API 调用获得,因为它是 MC 的运行状态并保存在内存中。


0
投票
xpath

例如,以下是对 Postgresql 的查询,其中列出了通道 ID 和名称以及该通道的“启用”值:

select c.id, c.name, cfg.enabled from (select cfg.cid, cfg.enabled from (select value from configuration where name='channelMetadata') as x, LATERAL ( SELECT (xpath('./string/text()', cvalue.node::xml))[1]::text AS cid, (xpath('./*/enabled/text()', cvalue.node::xml))[1]::text AS enabled FROM unnest(CAST(xpath('/map/entry', value::xml) as text)::text[]) as cvalue(node) ) as cfg) as cfg, channel c where cfg.cid=c.id order by 2;

© www.soinside.com 2019 - 2024. All rights reserved.