简体   繁体   中英

Azure Table Storage service 2.0 case sensitive filter

How to perform case sensitive filter On Azure Table storage 2.0 ?

If i do this query
TableQuery.GenerateFilterCondition("ShortUrl", QueryComparisons.Equal, "Abc");

It will returns 2 records with shortUrl "Abc" and "ABC"
The generated query show like this

/devstoreaccount1/Articles?$filter=shortUrl%20eq%20%27Abc%27&timeout=90

There is a solution for version 1.7 shown here , but this is not applicable on version 2.0. I have checked DataService Documentation and it is not mentioned there.

Since Table storage queries based on OData Protocol, why it behaves different when comparing string values. I am sure the Odata "eq" operator is supposed to be case sensitive.
Check OData Api Explorer with this query

http://services.odata.org/V3/OData/OData.svc/Products?$filter= Name eq 'Bread'

Then change it to bread.

As per documentation here :

All parts of the filter string are case-sensitive.

So I suggest that you try a real table storage, not the Development Storage. If you find this behavior on the real Storage service, please write here again, the team will be alerted!

Also please use the latest SDK/Tools (currently 2.0). If you find this behavior in development storage 2.0, update your question again, this might be a bug in the Development Storage.

But in any case, I suggest that you use real storage account when testing such "sensitive" features. I almost never use Development Storage account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM