mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-13 17:23:02 -05:00
add logging for export results operations (#2102)
* add logging * Update src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> --------- Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -532,12 +532,20 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
using (var fileReader = fileFactory.GetReader(outputFileName))
|
||||
using (var fileWriter = fileFactory.GetWriter(saveParams.FilePath, Columns))
|
||||
{
|
||||
Logger.Verbose($"Started exporting {RowCount} rows to file: {outputFileName}");
|
||||
var recentLogTime = DateTime.Now;
|
||||
// Iterate over the rows that are in the selected row set
|
||||
for (long i = rowStartIndex; i < rowEndIndex; ++i)
|
||||
{
|
||||
var row = fileReader.ReadRow(fileOffsets[i], i, Columns);
|
||||
fileWriter.WriteRow(row, Columns);
|
||||
if (DateTime.Now.Subtract(recentLogTime).TotalSeconds > 1)
|
||||
{
|
||||
Logger.Verbose($"Export progress: {i - rowStartIndex + 1}/{RowCount}.");
|
||||
recentLogTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
Logger.Verbose($"Exported {RowCount} rows to file: {outputFileName}");
|
||||
if (successHandler != null)
|
||||
{
|
||||
await successHandler(saveParams);
|
||||
|
||||
Reference in New Issue
Block a user