/
krasninja
/
querycat
Обзор
Документация
Войти
/
krasninja
/
querycat
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/QueryCat.Backend/Commands/Insert/InsertCommandHandler.cs
42 строки
1 KB
Ivan Kozhin
Add web server simple files serve support
29 дек 2023, 15:31
29 дек 2023, 15:31
e594cd1
Код
Авторство
О чём код?
using QueryCat.Backend.Core.Data; using QueryCat.Backend.Core.Types; using QueryCat.Backend.Storage; namespace QueryCat.Backend.Commands.Insert; internal sealed class InsertCommandHandler : IFuncUnit { private readonly IRowsIterator _rowsInput; private readonly IRowsOutput _rowsOutput; /// <inheritdoc /> public DataType OutputType => DataType.Null; public InsertCommandHandler(IRowsIterator rowsInput, IRowsOutput rowsOutput) { _rowsInput = rowsInput; _rowsOutput = rowsOutput; } /// <inheritdoc /> public VariantValue Invoke() { var insertCount = 0; _rowsOutput.Open(); try { _rowsOutput.QueryContext = new RowsOutputQueryContext(_rowsInput.Columns); while (_rowsInput.MoveNext()) { _rowsOutput.WriteValues(_rowsInput.Current.Values); insertCount++; } } finally { _rowsOutput.Close(); } return new VariantValue(insertCount); } }