public virtual DataSourceInfoArgs GetDataSourceInfo(UpdateEntry entry)
        {
            DataSourceInfoArgs res = new DataSourceInfoArgs();

            try
            {
                using (MdxDomProvider provider = MdxDomProvider.CreateProvider())
                {
                    StringBuilder sb = new StringBuilder();
                    provider.GenerateMdxFromDom(this.CreateWrappedStatement(), sb, new MdxGeneratorOptions());

                    String new_Query = sb.ToString();

                    res.MDXQuery           = new_Query;
                    res.MovedAxes_MDXQuery = MoveAxes(new_Query);
                }
            }
            catch (Exception ex)
            {
                res.MDXQuery = ex.ToString();
            }

            //res.ConnectionString = Connection.ConnectionID;
            res.UpdateScript = UpdateScript;

            return(res);
        }
SET "; //({1}) = {2}
        public static List <string> GetUpdateScripts(
            string cubeName,
            string updeteScript,
            List <UpdateEntry> entries)
        {
            string commandText = string.Empty;

            if (string.IsNullOrEmpty(updeteScript))
            {
                commandText = string.Format(UPDATE_COMMAND_TEMPLATE, cubeName);
            }

            List <string> commands = new List <string>();

            for (int i = 0; i < entries.Count; i++)
            {
                UpdateEntry   entry = entries[i];
                StringBuilder sb    = new StringBuilder();
                foreach (var mi in entry.Tuple)
                {
                    if (sb.Length > 0)
                    {
                        sb.Append(',');
                    }
                    sb.Append(mi.Value);
                }
                string tuple = sb.ToString();
                sb = null;

                string lexeme = Environment.NewLine;
                if (i > 0)
                {
                    if (string.IsNullOrEmpty(updeteScript))
                    {
                        lexeme += ',';
                    }
                }

                if (string.IsNullOrEmpty(updeteScript))
                {
                    lexeme      += string.Format("({0}) = {1}", tuple, entry.NewValue);
                    commandText += lexeme;
                }
                else
                {
                    string cmd = updeteScript;
                    ParseHierarchies(ref cmd, entry.Tuple, entry.NewValue, entry.OldValue);
                    lexeme += cmd;
                    commands.Add(lexeme);
                }
            }

            if (string.IsNullOrEmpty(updeteScript))
            {
                commands.Add(commandText);
            }

            return(commands);
        }
Esempio n. 3
0
        public object Clone()
        {
            var clone = new UpdateEntry();

            clone.Error    = Error;
            clone.NewValue = NewValue;
            clone.OldValue = OldValue;
            foreach (var t in Tuple)
            {
                clone.Tuple.Add(t.Key, t.Value);
            }
            return(clone);
        }
 /// <summary>
 /// Ищет в кэше изменений ячейку
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public UpdateEntry FindChange(UpdateEntry args)
 {
     foreach (UpdateEntry arg in CellChanges)
     {
         if(CompareTuples(arg.Tuple, args.Tuple))
             return arg;
     }
     return null;
 }
 public void Add(UpdateEntry args)
 {
     RemoveChange(args);
     CellChanges.Add(args);
 }
 public void RemoveChange(CellInfo cell)
 {
     if (cell != null)
     {
         UpdateEntry entry = new UpdateEntry(cell);
         RemoveChange(entry);
     }
 }
 public void RemoveChange(UpdateEntry args)
 {
     UpdateEntry change = FindChange(args);
     if (change != null)
     {
         CellChanges.Remove(change);
     }
 }
 /// <summary>
 /// Ищет в кэше изменений ячейку
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public UpdateEntry FindChange(CellInfo cell)
 {
     if (cell != null)
     {
         UpdateEntry entry = new UpdateEntry(cell);
         return FindChange(entry);
     }
     return null;
 }
 public object Clone()
 {
     var clone = new UpdateEntry();
     clone.Error = Error;
     clone.NewValue = NewValue;
     clone.OldValue = OldValue;
     foreach(var t in Tuple)
     {
         clone.Tuple.Add(t.Key, t.Value);
     }
     return clone;
 }