Пример #1
0
        public void Write(ICdlRecord row)
        {
            if (_insertSeparatorAfterRows.HasValue && _rowsAfterSeparator > _insertSeparatorAfterRows.Value)
            {
                _stream.Write("GO\n");
                _rowsAfterSeparator = 0;
            }
            var fmt = _factory.CreateLiteralFormatter();

            _stream.Write("INSERT INTO [TABLE_NAME] (");
            _stream.Write(row.GetFieldNames().Select(x => "[" + x + "]").CreateDelimitedText(", "));
            _stream.Write(") VALUES (");
            for (int i = 0; i < row.FieldCount; i++)
            {
                if (i > 0)
                {
                    _stream.Write(", ");
                }
                row.ReadValue(i);
                fmt.ReadFrom(row);
                _stream.Write(fmt.GetText());
            }
            _stream.Write(");\n");
            _rowsAfterSeparator++;
        }
Пример #2
0
 public void Write(ICdlRecord row)
 {
     var fmt = _factory.CreateLiteralFormatter();
     _stream.Write("INSERT INTO [TABLE_NAME] (");
     _stream.Write(row.GetFieldNames().Select(x => "[" + x + "]").CreateDelimitedText(", "));
     _stream.Write(") VALUES (");
     for (int i = 0; i < row.FieldCount; i++)
     {
         if (i > 0) _stream.Write(", ");
         row.ReadValue(i);
         fmt.ReadFrom(row);
         _stream.Write(fmt.GetText());
     }
     _stream.Write(");\n");
 }