dbms: added copyData function for Read/Write buffers.

This commit is contained in:
Alexey Milovidov 2011-05-16 16:31:19 +00:00
parent 74e423663a
commit cb45d49d11
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#ifndef DBMS_IO_COPY_DATA_H
#define DBMS_IO_COPY_DATA_H
#include <DB/IO/ReadBuffer.h>
#include <DB/IO/WriteBuffer.h>
namespace DB
{
/** Копирует данные из ReadBuffer в WriteBuffer
*/
void copyData(ReadBuffer & from, WriteBuffer & to);
}
#endif

16
dbms/src/IO/copyData.cpp Normal file
View File

@ -0,0 +1,16 @@
#include <DB/IO/copyData.h>
namespace DB
{
void copyData(ReadBuffer & from, WriteBuffer & to)
{
while (!from.eof())
{
to.write(from.buffer().begin(), from.buffer().end() - from.buffer().begin());
from.position() = from.buffer().end();
}
}
}