Пример #1
0
        private void RewriteActualDataSignatures(List <Dictionary <string, string> > keepers, List <Dictionary <string, string> > items)
        {
            try
            {
                DataKeepersDbConnector streaming = new DataKeepersDbConnector();
                DataKeepersDbConnector local     = new DataKeepersDbConnector();
                local.ConnectToLocalStorage();
                local.DropTableIfExists(typeof(KeeperSignature).Name);
                local.CreateTable <KeeperSignature>();
                streaming.ConnectToStreamingStorage();
                streaming.DropTableIfExists(typeof(KeeperSignature).Name);
                streaming.CreateTable <KeeperSignature>();
                // generate sql
                foreach (var keeper in keepers)
                {
                    var kSignature = new KeeperSignature
                    {
                        KeeperName = keeper["Type"],
                        ItemType   = keeper["Items"]
                    };
                    local.Insert(kSignature);
                    streaming.Insert(kSignature);
                }

                foreach (var item in items)
                {
                    local.DropTableIfExists(item["Type"]);
                    streaming.DropTableIfExists(item["Type"]);
                    var query = GenerateCreateTableQueryFromSignature(item);
//                    Debug.Log(query);
                    if (!local.Query(query))
                    {
                        Debug.Log("Error when executing creating of table " + item["Type"]);
                    }
                    if (!streaming.Query(query))
                    {
                        Debug.Log("Error when executing creating of table " + item["Type"]);
                    }
                }
                local.Close();
                streaming.Close();
                Debug.Log("Current signatures rewrited successfully!");
            }
            catch (Exception e)
            {
                Debug.LogError("Signature rewriting error: " + e.Message);
            }
        }