| 19 | |
| 20 | template <typename TCancelCallback, typename TProgressCallback> |
| 21 | void copyDataImpl(IBlockInputStream & from, IBlockOutputStream & to, TCancelCallback && is_cancelled, TProgressCallback && progress) |
| 22 | { |
| 23 | from.readPrefix(); |
| 24 | to.writePrefix(); |
| 25 | |
| 26 | while (Block block = from.read()) |
| 27 | { |
| 28 | if (is_cancelled()) |
| 29 | break; |
| 30 | |
| 31 | to.write(block); |
| 32 | progress(block); |
| 33 | } |
| 34 | |
| 35 | if (is_cancelled()) |
| 36 | return; |
| 37 | |
| 38 | /// For outputting additional information in some formats. |
| 39 | if (from.getProfileInfo().hasAppliedLimit()) |
| 40 | to.setRowsBeforeLimit(from.getProfileInfo().getRowsBeforeLimit()); |
| 41 | |
| 42 | to.setTotals(from.getTotals()); |
| 43 | to.setExtremes(from.getExtremes()); |
| 44 | |
| 45 | if (is_cancelled()) |
| 46 | return; |
| 47 | |
| 48 | from.readSuffix(); |
| 49 | to.writeSuffix(); |
| 50 | } |
| 51 | |
| 52 | void copyData(IBlockInputStream & from, IBlockOutputStream & to, const std::function<void(const Block & block)> & progress, |
| 53 | std::atomic<bool> * is_cancelled) |
no test coverage detected