gpt4 book ai didi

tsql - cfquery 在有 tsql 注释时崩溃

转载 作者:行者123 更新时间:2023-12-04 16:07:06 27 4
gpt4 key购买 nike

这不会在 ColdFusion 11 中崩溃,但会在 ColdFusion 2016 中崩溃

SELECT  *
FROM dbo.Roles WITH (NOLOCK)
WHERE Code IS NOT NULL
AND Active = 1
AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK)) -- It's ok to look at termed employees

enter image description here

这在两者中都可以正常工作
SELECT  *
FROM dbo.Roles WITH (NOLOCK)
WHERE Code IS NOT NULL
AND Active = 1
AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK))

是否有设置可以恢复原始行为?

更新

我以为我有一个关于这个问题的最小例子,但我没有。这是完整的查询
    SELECT '<ul>' + STUFF (
(
SELECT MIN(Role) AS "li/code", Code AS "li/span/b", 'Unsorted' AS "li/span/var"
FROM dbo.Roles WITH (NOLOCK)
WHERE Code IS NOT NULL
AND Active = 1
AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK)) -- It's ok to look at termed employees
GROUP BY Code
FOR XML PATH ('')
),
1,0,''

) + '</ul>' AS xmlRole

当我打开数据库调试时:我得到:
spy(http-nio-8500-exec-5)(2016/02/17 10:21:13.807)>> OK

spy(http-nio-8500-exec-5)(2016/02/17 10:21:13.807)>> Statement[4].execute(String sql, int autoGeneratedKeys)
spy(http-nio-8500-exec-5)(2016/02/17 10:21:13.807)>> sql = SELECT '<ul>' + STUFF ( ( SELECT MIN(Role) AS "li/code", Code AS "li/span/b", 'Unsorted' AS "li/span/var" FROM dbo.Roles WITH (NOLOCK) WHERE Code IS NOT NULL AND Active = 1 AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK)) -- It's ok to look at termed employees GROUP BY Code FOR XML PATH ('') ), 1,0,'' ) + '</ul>' AS xmlRole
spy(http-nio-8500-exec-5)(2016/02/17 10:21:13.807)>> autoGeneratedKeys = 1
spy(http-nio-8500-exec-5)(2016/02/17 10:21:13.807)>>
java.sql.SQLException: [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near ')'. ErrorCode=102 SQLState=HY000
java.sql.SQLException: [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near ')'.
at macromedia.jdbc.sqlserverbase.ddcw.b(Unknown Source)
at macromedia.jdbc.sqlserverbase.ddcw.a(Unknown Source)

请注意,SQL 字符串位于一行中。评论开始时,并没有结束。 -- 之后的所有内容仍然作为注释掉。

空白管理已打开。关闭它不会改变行为。生成的SQL是一样的

最佳答案

根据 Adob​​e 的说法,添加 Update 1 将解决此问题

更新 1 中修补的问题列表:
https://helpx.adobe.com/coldfusion/kb/bugs-fixed-coldfusion-2016-update-1.html#main-pars_minitoc

更新 1 的详细信息:
https://helpx.adobe.com/coldfusion/kb/coldfusion-2016-update-1.html

关于tsql - cfquery 在有 tsql 注释时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37062966/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com