如何避免问号字符的 ODBC 参数化?在文字和注释中?
我遇到了一个问题,其中有问号字符“?”在我的 SQL 脚本中,注释引起了问题。当我使用 Visual FoxPro SQLEXEC 函数通过 ODBC 连接运行这些语句时,这些字符被视为参数,并且 VFP 提示输入值。
使用 SQLEXEC 时,我可以选择哪些选项来处理注释中的问号字符?我希望我可以了解如何关闭参数化,或者了解如何在将字符串作为命令传递之前转义这些字符。到目前为止,我还没有找到这种解决方案的任何证据,因此看起来我可能必须删除所有不需要的注释,因为它们通常是为存储过程创建语句,我们希望保留这些注释。我希望有人能有一个比完全删除评论更令人满意的解决方案。
I'm running into an issue where I have question mark characters '?' within my SQL scripts inside comments is causing problems. When I run these statements through an ODBC connection using the Visual FoxPro SQLEXEC function these characters are being seen as parameters and VFP prompts for values.
What are my options for dealing with question mark characters within comments when using SQLEXEC? I'm hoping that I may be either to some how turn off parameterization or alternatively to some how escape these characters before passing the strings as commands. So far I haven't found any evidence of such a solution so it looks like I may have to strip out all comments which is undesirable because they are generally create statements for stored procedures and we would like to preserve these comments. I'm hoping somebody might have a more pleasing solution than stripping out the comments completely.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来这可能是一个已知问题,SQLEXEC 在遇到问题时不考虑 SQL 命令中的注释标记字符 ?通常代表 ODBC 中的参数,同样也代表 VFP 中的参数。
It appears that it may be a known issue that SQLEXEC has no regard for comments in the SQL command when encountering question mark characters ? which normally represent parameters in ODBC and likewise in VFP.
你试过用ascii代码替换它吗?类似于:“+chr(63)+”
have you tried replacing it with the ascii code? Something like: '+chr(63)+'