Esempio n. 1
0
 public IEnumerable <ISqlContent> Read(ISqlOptions options)
 {
     foreach (IndexedBuffer buffer in this.innerBuffers.NotNull())
     {
         foreach (ISqlContent batch in this.Read(buffer, options))
         {
             yield return(batch);
         }
     }
 }
Esempio n. 2
0
 IEnumerable <QueryData> ISqlSerializer <QueryData> .Serialize(ISqlOptions options)
 {
     foreach (ISqlContent content in this.Read(options))
     {
         yield return(new QueryData()
         {
             QueryText = content.Text,
             Parameters = content.Parameters.ToList(),
         });
     }
 }
Esempio n. 3
0
 IEnumerable <CommandData> ISqlSerializer <CommandData> .Serialize(ISqlOptions options)
 {
     foreach (ISqlContent content in this.Read(options))
     {
         yield return(new CommandData()
         {
             CommandText = content.Text,
             Parameters = content.Parameters.ToList(),
             Bindings = content.Bindings.ToList(),
         });
     }
 }
Esempio n. 4
0
        public IEnumerable <ISqlContent> Read(ISqlOptions options)
        {
            if (options == null || (options.MaxParameters <= 0 && options.MaxSql <= 0) || (options.MaxParameters >= this.parameters.Count && options.MaxSql >= this.text.Length))
            {
                yield return(this.ReadToEnd());

                yield break;
            }

            int yieldedParams   = 0;
            int yieldedBindings = 0;
            int yieldedText     = 0;

            int maxSql    = options.MaxSql <= 0 ? int.MaxValue : options.MaxSql;
            int maxParams = options.MaxParameters <= 0 ? int.MaxValue : options.MaxParameters;

            SqlOffset[] offsets = this.offsets.Concat(new[] { this.GetCurrentOffset() }).ToArray();

            for (int i = 0; i < offsets.Length - 1; i++)
            {
                SqlOffset offset     = offsets[i];
                SqlOffset nextOffset = offsets[i + 1];

                if (nextOffset.NumberOfParams - yieldedParams > maxParams || nextOffset.Text - yieldedText > maxSql)
                {
                    yield return(new SqlContent()
                    {
                        Bindings = this.bindings.Skip(yieldedBindings).Take(offset.NumberOfBindings - yieldedBindings),
                        Parameters = this.parameters.Skip(yieldedParams).Take(offset.NumberOfParams - yieldedParams),
                        Text = this.text.ToString(yieldedText, offset.Text - yieldedText),
                    });

                    yieldedParams   += offset.NumberOfParams - yieldedParams;
                    yieldedText     += offset.Text - yieldedText;
                    yieldedBindings += offset.NumberOfBindings - yieldedBindings;
                }
            }

            if (yieldedParams < this.parameters.Count || yieldedText < this.text.Length || yieldedBindings < this.bindings.Count)
            {
                string newText = this.text.ToString(yieldedText, this.text.Length - yieldedText);

                if (!string.IsNullOrWhiteSpace(newText))
                {
                    yield return(new SqlContent()
                    {
                        Bindings = this.bindings.Skip(yieldedBindings),
                        Parameters = this.parameters.Skip(yieldedParams),
                        Text = newText,
                    });
                }
            }
        }
Esempio n. 5
0
 public StatusLogger(ISqlOptions options)
 {
     _options = options;
 }
Esempio n. 6
0
 public RunManager(
     ISqlOptions sqlOptions
     )
 {
     _sqlOptions = sqlOptions;
 }
Esempio n. 7
0
 public RunOptions(ISqlOptions sqlOptions, Guid processId)
     : base(sqlOptions.Server, sqlOptions.Database, sqlOptions.UserName)
 {
     this.ProcessId = processId;
 }