問題
本機調用 ArcGisServices Query 正常,其它機器調用若包含Like關鍵字則無法查詢結果(其它關鍵字均正常,in、=)
瀏覽器測試直接崩潰
http://XXX.XX.XXX.XX/ArcGIS/rest/services/ServicesName/MapServer/5/query
系統環境:ArcGis 10,Flex API 3.7
思路
檢查跨域文件
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
</cross-domain-policy>
Like 關鍵字轉碼問題
檢查URL,嘗試Get、Post提交,均異常
檢查Log
Method failed.HRESULT = 0x80040207 : This is a FACILITY_ITF error that is specific to the interface that returned this error. See the documentation of the interface that returned this error for information about this HRESULT.
GeoDatabase Error :An invalid SQL statement was used. An invalid SQL statement was used.
查詢幫助,得到如下信息:
What constitutes "valid" SQL depends on the backend database for a specific REST endpoint. The backend can be a Personal Geodatabase, File Geodatabase, Shapefile, or SDE Geodatabase (of different databases). Depending on the type and database, the SQL might be slightly different, especially for dates.
對比API
下載JS API 測試,發現最新JS API 查詢居然沒有問題。咨詢官方,可能是ArcGis 10 Flex API bugger,讓打sp1補丁試試。
唉,服務器軟件太多,補丁有風險。
終章
模糊查詢使用Text 替換 Where,規避Like 關鍵字
text Description: A literal search text. If the layer has a display field associated with it, the server searches for this text in this field. This parameter is a short hand for a where clause of:
where <displayField> like '%<text>%'. The text is case sensitive.
This parameter is ignored if the where parameter is specified.
Example: text=Los
where Description: A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed.
Example: where=POP2000 > 350000