这里真是一头雾水。
我正在解析来自 Bing 的 XML 地理编码——我似乎得到了这个变量就好了。但是,当我在查询中使用该变量时——我没有得到变量的值——而是整个 XML 字符串?!
<cfset variables.BingXML = xmlparse(cfhttp.filecontent)>
<cfset variable.Bing.Lat = "#variables.BingXML.Response.ResourceSets.ResourceSet.Resources.Location.Point.Latitude#">
<cfset variable.Bing.Lon = "#variables.BingXML.Response.ResourceSets.ResourceSet.Resources.Location.Point.Longitude#">
<cfoutput>
#variable.Bing.Lat#
#variable.Bing.Lon#
</cfoutput>
这将返回正确的数字:
38.4935302734375
-101.35395050048828
但在cfquery
我得到:
SELECT NATSS_Locations.*, NATSS_PaymentTypes.PTName, NATSS_PaymentTypes.PTImage, NATSS_PaymentTypeLinks.NPTLID,
NATSS_NationalAccounts.NNAImage, NATSS_NationalAccounts.NNAName, NATSS_LocNationalAcctLink.NLNALID,
((3963.191 * ACOS((SIN(PI() * '#variable.Bing.Lat#' / 180) * SIN(PI() * NATSS_Locations.LocationLat / 180)) + (COS(PI() * #variable.Bing.Lat# /180) * cos(PI() * NATSS_Locations.LocationLat / 180) * COS(PI() * NATSS_Locations.LocationLong / 180 - PI() * #variable.Bing.Lon# / 180)) )) * 1) as Distance
变成:
SELECT NATSS_Locations.*, NATSS_PaymentTypes.PTName, NATSS_PaymentTypes.PTImage, NATSS_PaymentTypeLinks.NPTLID,
NATSS_NationalAccounts.NNAImage, NATSS_NationalAccounts.NNAName, NATSS_LocNationalAcctLink.NLNALID,
((3963.191 * ACOS((SIN(PI() * '<?xml version="1.0" encoding="UTF-8"?><Latitude xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">38.4935302734375</Latitude>' / 180) * SIN(PI() * NATSS_Locations.LocationLat / 180)) + (COS(PI() * <?xml version="1.0" encoding="UTF-8"?><Latitude xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">38.4935302734375</Latitude> /180) * cos(PI() * NATSS_Locations.LocationLat / 180) * COS(PI() * NATSS_Locations.LocationLong / 180 - PI() * <?xml version="1.0" encoding="UTF-8"?><Longitude xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">-101.35395050048828</Longitude> / 180)) )) * 1) as Distance
有人对此有解决方案或想法吗?