记录 T-SQL *源* 文件的最佳工具?

发布于 2024-09-24 23:22:31 字数 598 浏览 1 评论 0原文

在工作中,数据库根本没有记录。此外,存储过程、函数和视图都是加密的,这排除了许多为您记录这些对象的工具。我拥有的只是生成数据库、模式、表、函数等的纯 .SQL 文件。

我想知道,是否有一个工具可以读取这些文件并生成类似 Doxygen 的文档?最好是开源或免费软件。

我发现 IzzySoft 的 HyperSQL 和 SourceForge 的项目 PLDoc 所做的事情非常接近我所需要的,尽管两者似乎都非常特定于 PL/SQL。我想要一些能够读取 SQL 源文件(理解 T-SQL 的特性)、解析它们并获取:

  • 每个文件中定义的 SP、UDF 等的列表 每个
  • 对象的列表(表/视图和过程/函数)对象依赖于(直接地,如果可能的话,也间接地)
  • 调用和依赖关系图(即什么调用什么以及被什么调用)
  • 如果可能,当SP使用表/视图时,它是如何使用它的(INSERT/DELETE/UPDATE /SELECT/mix???)

我已经开发了一个微小的 Perl 脚本,它最低限度地解析这些文件,试图获得第一点 - 但它只是一个 hack,缺乏很多修饰。我确信一定有一个工具可以完成这项工作,我相信我不必自己编写代码。

提前致谢, 乔

At work, the database is not documented at all. Furthermore, the stored procedures, functions and views are all encrypted, this rules out a lot of tools that document these objects for you. All I have are the plain .SQL files that generate the database, schemas, tables, functions and all.

I'd like to know, is there a tool that can read these files and generate a Doxygen-like documentation? Preferably open-source or freeware.

I found IzzySoft's HyperSQL and SourceForge's project PLDoc do something very close to what I'd need, though both seem to be very PL/SQL specific. I want something that reads SQL source files (that understands T-SQL's idiosyncracies), parses them, and gets me:

  • List of SPs, UDFs, etc. defined within each file
  • List of objects (both tables/views and procs/functions) each object depends on (directly and, if possible, also indirectly)
  • Calling and dependencies graphs (i.e. what calls what and is called by what)
  • If possible, when an SP uses a table/view, how's it using it (INSERT/DELETE/UPDATE/SELECT/mix???)

I've already developped a tiny Perl script that minimally parses these files attempting to get first point - but then it's just a hack and lacks a lot of polish. I'm sure there must be a tool out there which does the job, I want to believe I won't have to code it myself.

Thanks in advance,
Joe

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仲春光 2024-10-01 23:22:31

我们使用 Red Gate SQL Doc 来生成我们的。

然而,它是在数据库而不是文件上工作的:从系统表中读取所有内容(权限、依赖项、数据类型等)比解析脚本更容易。解析脚本是数据库引擎所做的...

您不能从源文件生成一个空数据库(删除加密)并从中生成吗?
或者如果你有sa权限就解密?

We use Red Gate SQL Doc to generate ours.

However, it works from a database not files: it's easier to read everything from system tables (permission, dependecies, datatypes etc) than parse scripts. Parsing scripts is what the DB engine does...

Can you not generate an empty DB from the source files (remove WITH ENCRYPTION) and generate from that?
Or decrypt if you have sa rights?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文