Esempio n. 1
0
        private IEnumerable <BatchCommand> GetCommandTextBatches(string commandBatch)
        {
            var lineNumber = 1;
            var command    = new BatchCommand(lineNumber, commandBatch.Length);

            foreach (var line in commandBatch.Split(new[] { "\n", "\r\n" }, StringSplitOptions.None))
            {
                if (line.Trim().Equals("GO", StringComparison.OrdinalIgnoreCase))
                {
                    var batch = command;
                    command = new BatchCommand(lineNumber + 1, commandBatch.Length);
                    yield return(batch);
                }
                else
                {
                    command.AppendCommandBatchLine(line.Trim());
                }
                lineNumber++;
            }

            yield return(command);
        }
    private IEnumerable<BatchCommand> GetCommandTextBatches (string commandBatch)
    {
      var lineNumber = 1;
      var command = new BatchCommand (lineNumber, commandBatch.Length);
      foreach (var line in commandBatch.Split (new[] { "\n", "\r\n" }, StringSplitOptions.None))
      {
        if (line.Trim ().Equals ("GO", StringComparison.OrdinalIgnoreCase))
        {
          var batch = command;
          command = new BatchCommand (lineNumber + 1, commandBatch.Length);
          yield return batch;
        }
        else
          command.AppendCommandBatchLine (line.Trim ());
        lineNumber++;
      }

      yield return command;
    }