我对数据源中设置的参数有疑问。我支持的项目非常老,并且将Sybase与ColdFusion 11一起使用。我在本地计算机上更新了一些代码,一切正常。将相同的代码滚动到开发服务器后,我收到一条错误消息。很快,我意识到这与cfqueryparams
有关。我一删除它们,代码就可以正常工作。然后,我在开发服务器上的数据源中找到了它:
jdbc:sybase:Tds:example.com:5000/devtest?SQLINITSTRING=set QUOTED_IDENTIFIER off
我想知道此参数的目的是什么?这是否使我们的系统受益于附加的安全层?团队中没有人对此一无所知,他们也不想触及该代码。我想更多地了解这一点,并了解其用途。
更新
根据@Ageax的建议,我尝试转储cfsavecontent,这是输出:
<cfquery name="saveDtCk" datasource="testDB">
INSERT INTO formDetails (
recid,
formid,
refid,
status,
comment,
userid,
lastupdate
) VALUES (
<cfqueryparam cfsqltype="cf_sql_numeric" value="87550861491">,
<cfqueryparam cfsqltype="cf_sql_numeric" value="8755086149">,
1,
<cfqueryparam cfsqltype="cf_sql_tinyint" value="1">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="Test 1" maxlength="8000" null="NO">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="T54645" maxlength="6" null="NO">,
{ts '2019-02-25 10:32:52'}
)
INSERT INTO formDetails (
recid,
formid,
refid,
status,
comment,
userid,
lastupdate
) VALUES (
<cfqueryparam cfsqltype="cf_sql_numeric" value="87550861494">,
<cfqueryparam cfsqltype="cf_sql_numeric" value="8755086149">,
4,
<cfqueryparam cfsqltype="cf_sql_tinyint" value="1">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="Test 3" maxlength="8000" null="NO">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="T54645" maxlength="6" null="NO">,
{ts '2019-02-25 10:32:52'}
)
INSERT INTO formDetails (
recid,
formid,
refid,
status,
comment,
userid,
lastupdate
) VALUES (
<cfqueryparam cfsqltype="cf_sql_numeric" value="87550861493">,
<cfqueryparam cfsqltype="cf_sql_numeric" value="8755086149">,
3,
<cfqueryparam cfsqltype="cf_sql_tinyint" value="1">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="" maxlength="8000" null="YES">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="T54645" maxlength="6" null="NO">,
{ts '2019-02-25 10:32:52'}
)
</cfquery>
我尝试运行上面的代码,就像在cffunction
中一样,这是错误消息:
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.
我不确定原因是什么,什么原因会导致问题,因为一切似乎都非常简单。