public IEnumerable <ISqlContent> Read(ISqlOptions options) { foreach (IndexedBuffer buffer in this.innerBuffers.NotNull()) { foreach (ISqlContent batch in this.Read(buffer, options)) { yield return(batch); } } }
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(), }); } }
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(), }); } }
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, }); } } }
public StatusLogger(ISqlOptions options) { _options = options; }
public RunManager( ISqlOptions sqlOptions ) { _sqlOptions = sqlOptions; }
public RunOptions(ISqlOptions sqlOptions, Guid processId) : base(sqlOptions.Server, sqlOptions.Database, sqlOptions.UserName) { this.ProcessId = processId; }