Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

in と inArray SDKの挙動変更 #193

Open
kobo0908 opened this issue Jul 31, 2020 · 0 comments
Open

in と inArray SDKの挙動変更 #193

kobo0908 opened this issue Jul 31, 2020 · 0 comments

Comments

@kobo0908
Copy link
Contributor

概要

in の 配列ではない時の自動変換はエラー返すように変更

(対応は同メソッドを作成し、既存メソッドをdeprecate対応)

List<string> conditions = new List<string>();
string testString = "name5";
query.WhereContainedInArray("name", testString);
// もしくは
// query.WhereContainedIn("name", testString);

上記の場合、 "name5" ==> ["n","a","m","e","5"] に変換される
なお、以下の場合、配列の場合は正常に処理されていることを確認しました。

        List<string> conditions = new List<string>();
        conditions.Add("name5");
        conditions.Add("name2");
        query.WhereContainedIn("name", conditions);
        // もしくは
       // query.WhereContainedInArray("name", conditions);

但し、なぜか、自分環境だと403ヘッダーエラー発生している
(URLを拝見すると、エンコードされない[]が残っているのは原因ではないかと考えております。)

検証コード

  NCMBQuery<NCMBObject> query = new NCMBQuery<NCMBObject>("TestClass");
        List<string> conditions = new List<string>();
        conditions.Add("name5");
        conditions.Add("name2");
        query.WhereContainedIn("name", conditions);
        //query.WhereContainedInArray("name", conditions);
        query.FindAsync((List<NCMBObject> objList, NCMBException e) =>
        {
            if (e != null)
            {
                Debug.Log("Error: " + e.ErrorMessage);
            }
            else
            {
                string reu = JsonUtility.ToJson(objList);
                //Debug.Log("Json: " + JsonConvert.SerializeObject(objList));
                foreach (NCMBObject obj in objList)
                {
                    string uotput = "|";
                    uotput += obj.ObjectId + "|";
                    ICollection<string> keys = obj.Keys;
                    IDictionary<string, object> serverData = obj.serverData;
                    ArrayList name = (ArrayList)serverData["name"];
                    foreach (string s in name)
                    {
                        uotput += s + ",";
                    }
                    uotput += "|";
                    uotput += obj.CreateDate.ToString() + "|";
                    uotput += obj.UpdateDate.ToString() + "|";
                    Debug.Log("Object:" + uotput);
                }
            }
        });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant