ODBC 挂钩/垫片
我有一个旧应用程序需要它才能正常运行。现在它使用了一些无效的 SQL。它使用 ODBC 连接到数据库。我只想对 ODBC 进行填充,这样我就可以监视无效的 SQL 并用一些有效的命令替换它。
有什么想法吗?
如果 MySQL 代理可以通过 ODBC 运行,那么它就符合要求。
I have an old app that I need to get functioning. Right now it uses some invalid SQL. It connects to the db using ODBC. I would just like to shim the ODBC so I could watch for the invalid SQL and replace it with some valid commands.
Any ideas?
MySQL proxy would fit the bill if it would fly over ODBC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法是自己编写一个填充程序,然后让旧版应用程序加载您的填充程序,然后将除 SQLPrepare 和 SQLExecDirect 之外的所有 ODBC 函数调用代理到原始 ODBC 驱动程序。然后,您可以更改通过这两个函数传入的任何相关 SQL 查询。所有其他函数都不变地传递参数。
您需要将垫片作为 ODBC 驱动程序“安装”在注册表中(如果在 Windows 上),位于 HKLM\SOFTWARE\ODBC\ODBCINST.INI(对于驱动程序)和 ODBC.INI(对于 DSN)下。然后,您可以将旧应用程序指向垫片,这将动态加载原始驱动程序。
Easiest way is to write a shim yourself, and have the legacy app load your shim which then proxies all ODBC function calls except SQLPrepare and SQLExecDirect to the original ODBC driver. You can then alter any relevant SQL queries passed in through these two functions. All other functions pass arguments through unchanged.
You'll need to "install" your shim as an ODBC driver in the registry (if on Windows) under HKLM\SOFTWARE\ODBC\ODBCINST.INI (for the driver) and ODBC.INI (for the DSN). You can then point your old app to your shim, which will load the original driver dynamically.