如何读取 Oracle Forms .FMT 文件中的 PL/SQL 代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/230248/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:35:15  来源:igfitidea点击:

How to read the PL/SQL code in an Oracle Forms .FMT file?

oracleoracle10goracleforms

提问by Aurelio Martin Massoni

Oracle Forms10g provides a tool to convert the Oracle Forms modules, from the binary format (.FMB) that Oracle Forms Builder works with, to text format (.FMT).

Oracle Forms10g 提供了一个工具来将 Oracle Forms 模块从 Oracle Forms Builder 使用的二进制格式 (.FMB) 转换为文本格式 (.FMT)。

For example, if you create a module called mymodule.fmbwith Oracle Forms Builder, and then invoke

例如,如果您使用 Oracle Forms Builder创建一个名为mymodule.fmb的模块,然后调用

frmcmp module=mymodule.fmb script=yes batch=yes logon=no

from the command line, the Oracle Forms Convert utility will create a file named mymodule.fmtfrom the file mymodule.fmb. This text file is supposed to be "readable" by humans, except for the PL/SQL code of triggers and program units, which is codified.

在命令行中,甲骨文表单转换工具将创建一个名为mymodule.fmt从文件mymodule.fmb。除了触发器和程序单元的 PL/SQL 代码被编码外,这个文本文件应该是人类“可读的”。

For example, this is a snippet of a .FMT file with a chunk of codified PL/SQL code

例如,这是一个 .FMT 文件的片段,其中包含一段编码的 PL/SQL 代码

DEFINE  F50P
BEGIN
   PP = 10
   PI = 3
   PN = 464
   PL = 1138
   PV = (BLONG)
<<"
00000049 00800000 00440000 00000000 00000031 0000000d 00000002 a0011519 
00002420 0000045e 001f0000 00165030 5f32335f 4f43545f 32303038 31365f33 
375f3039 00000006 42454749 4e0a0000 0042676f 5f626c6f 636b2820 27504149 
53455327 20293b0a 69662066 6f726d5f 73756363 65737320 7468656e 0a096578 
65637574 655f7175 6572793b 0a656e64 2069663b 00000005 0a454e44 3b000000 
1d574845 4e2d4e45 572d464f 524d2d49 4e535441 4e434520 28466f72 6d290000 

Have you ever tried to decode this kind of files, to be able to extract the PL/SQL code of a form ?

您是否尝试过解码此类文件,以便能够提取表单的 PL/SQL 代码?

It would be very useful to be able to search a string in the PL/SQL code of a lot of .FMT files, instead of using Oracle Forms Builder to manually open each of the corresponding .FMB files, and search the string in each one of them.

能够在大量 .FMT 文件的 PL/SQL 代码中搜索字符串将非常有用,而不是使用 Oracle Forms Builder 手动打开每个相应的 .FMB 文件,并在每个文件中搜索字符串其中。

Thanks!

谢谢!

回答by Jim Hudson

Along with the API, note that if you're working at the start of this process you'll probably be better off generating the XML version than the FMT version. The FMT is an older format kept for backward compatibility, and tools like the recently announced Forms -> Oracle APEX converter will want the XML. It's also easier to read.

与 API 一起,请注意,如果您在此过程开始时工作,则生成 XML 版本可能比生成 FMT 版本更好。FMT 是一种为向后兼容而保留的旧格式,而最近发布的 Forms -> Oracle APEX 转换器等工具将需要 XML。它也更容易阅读。

In "Forms 10g release 1" (9.0.4) the XML converter is a separate command line program. forms2xml. I think that's still true for 10.1

在“Forms 10g 第 1 版”(9.0.4) 中,XML 转换器是一个单独的命令行程序。表单2xml。我认为 10.1 仍然如此

Plus, the XML is easier to read and interpret.

此外,XML 更易于阅读和解释。

回答by hamishmcn

The bytes are just hex values of the characters. for example: taking the 4th line and putting it into the following python code:

字节只是字符的十六进制值。例如:取第4行并将其放入以下python代码中:

[chr(x) for x in [0x53,0x45,0x53,0x27 ,0x20,0x29,0x3b,0x0a ,0x69,0x66,0x20,0x66 ,0x6f,0x72,0x6d,0x5f ,0x73,0x75,0x63,0x63 ,0x65,0x73,0x73,0x20 ,0x74,0x68,0x65,0x6e ,0x0a,0x09,0x65,0x78]]

gives the following output:

给出以下输出:

['S', 'E', 'S', "'", ' ', ')', ';', '\n', 'i', 'f', ' ', 'f', 'o', 'r', 'm', '_', 's', 'u', 'c', 'c', 'e', 's', 's', ' ', 't', 'h', 'e', 'n', '\n', '\t', 'e', 'x']

which is recognisable forms pl/sql. So it looks like it wouldn't be too much work to create a script that would take a directory of FMT files and produce corresponding files with text that could be searched.
Have fun!

这是可识别的形式 pl/sql。因此,创建一个脚本来获取 FMT 文件的目录并生成带有可以搜索的文本的相应文件,看起来工作量不会太大。
玩得开心!

回答by Thomas Jones-Low

The Oracle Forms 9i and later has an Programming API to allow you to do exactly what you describe. You will need to review your Forms documentation to do this, but it may be faster than trying to extract binary strings.

Oracle Forms 9i 及更高版本具有编程 API,可让您完全按照您的描述进行操作。您需要查看您的 Forms 文档才能执行此操作,但这可能比尝试提取二进制字符串要快。

If you are willing to pay for an existing tool, use the following:

如果您愿意为现有工具付费,请使用以下方法:

http://www.orcl-toolbox.com/

http://www.orcl-toolbox.com/

Their formsAPI and FormsTools let you do extractions, diffs, changes and updates to your forms.

他们的 formsAPI 和 FormsTools 可让您对表单进行提取、差异、更改和更新。

回答by hamishmcn

According to thispage the author has a perl script to convert the hex back to ascii text (he says to send him an email and he will send it)

根据这个页面,作者有一个 perl 脚本将十六进制转换回 ascii 文本(他说给他发一封电子邮件,他会发送)