Less code [#MOBMET-3953].

This commit is contained in:
Alexey Milovidov 2016-08-07 01:31:58 +03:00
parent 0630debf11
commit 9fd26e381a
11 changed files with 11 additions and 49 deletions

View File

@ -7,7 +7,6 @@
#include <DB/IO/WriteHelpers.h>
#include <DB/IO/ReadHelpers.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/DataTypes/DataTypesNumberFixed.h>
#include <DB/DataTypes/DataTypeString.h>

View File

@ -26,10 +26,8 @@
#include <DB/IO/ReadBufferFromFileDescriptor.h>
#include <DB/IO/WriteBufferFromFileDescriptor.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/ReadHelpers.h>
#include <DB/IO/WriteHelpers.h>
#include <DB/IO/copyData.h>
#include <DB/DataStreams/RemoteBlockInputStream.h>

View File

@ -28,8 +28,6 @@
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/ReadHelpers.h>
#include <DB/IO/WriteHelpers.h>
#include <DB/IO/copyData.h>
#include <DB/IO/ReadBufferFromIStream.h>
#include <DB/DataStreams/AsynchronousBlockInputStream.h>
#include <DB/DataStreams/BlockInputStreamFromRowInputStream.h>
@ -525,8 +523,7 @@ private:
*/
ReadBufferFromFileDescriptor in(STDIN_FILENO);
WriteBufferFromString out(line);
copyData(in, out);
readStringUntilEOF(line, in);
}
process(line);

View File

@ -1,9 +1,8 @@
#include <common/JSON.h>
#include <Poco/Path.h>
#include <DB/IO/WriteBufferFromFile.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/ReadBufferFromFile.h>
#include <DB/IO/copyData.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/Common/escapeForFileName.h>
#include <DB/Common/FileChecker.h>

View File

@ -8,3 +8,6 @@ add_executable (field field.cpp)
target_link_libraries (field dbms)
add_executable (rvo_test rvo_test.cpp)
add_executable (string_ref_hash string_ref_hash.cpp)
target_link_libraries (string_ref_hash dbms)

View File

@ -12,7 +12,6 @@
#include <DB/Interpreters/InterpreterCreateQuery.h>
#include <DB/IO/WriteBufferFromFile.h>
#include <DB/IO/ReadBufferFromFile.h>
#include <DB/IO/copyData.h>
namespace DB
@ -51,8 +50,7 @@ static void loadTable(
{
char in_buf[METADATA_FILE_BUFFER_SIZE];
ReadBufferFromFile in(table_metadata_path, METADATA_FILE_BUFFER_SIZE, -1, in_buf);
WriteBufferFromString out(s);
copyData(in, out);
readStringUntilEOF(s, in);
}
/** Пустые файлы с метаданными образуются после грубого перезапуска сервера.
@ -356,8 +354,7 @@ static ASTPtr getCreateQueryImpl(const String & path, const String & table_name)
String query;
{
ReadBufferFromFile in(table_metadata_path, 4096);
WriteBufferFromString out(query);
copyData(in, out);
readStringUntilEOF(query, in);
}
ParserCreateQuery parser;
@ -451,8 +448,7 @@ void DatabaseOrdinary::alterTable(
{
char in_buf[METADATA_FILE_BUFFER_SIZE];
ReadBufferFromFile in(table_metadata_path, METADATA_FILE_BUFFER_SIZE, -1, in_buf);
WriteBufferFromString out(statement);
copyData(in, out);
readStringUntilEOF(statement, in);
}
ParserCreateQuery parser;

View File

@ -7,10 +7,8 @@
#include <DB/Common/StringUtils.h>
#include <DB/IO/Operators.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/ReadBufferFromString.h>
#include <DB/IO/ReadBufferFromFileDescriptor.h>
#include <DB/IO/copyData.h>
#include <DB/IO/WriteBufferFromFile.h>
#include <DB/Interpreters/Compiler.h>
@ -205,12 +203,7 @@ void Compiler::compile(
{
auto process = ShellCommand::execute(command.str());
{
WriteBufferFromString res(compile_result);
copyData(process->out, res);
}
readStringUntilEOF(compile_result, process->out);
process->wait();
}

View File

@ -33,8 +33,6 @@
#include <DB/Interpreters/QueryLog.h>
#include <DB/Interpreters/Context.h>
#include <DB/IO/ReadBufferFromFile.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/copyData.h>
#include <DB/IO/UncompressedCache.h>
#include <DB/Parsers/ASTCreateQuery.h>
#include <DB/Parsers/ParserCreateQuery.h>

View File

@ -1,20 +1,5 @@
#include <Poco/File.h>
#include <Poco/FileStream.h>
#include <DB/Common/escapeForFileName.h>
#include <DB/IO/ReadBufferFromFile.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/copyData.h>
#include <DB/Parsers/ASTRenameQuery.h>
#include <DB/Parsers/ASTCreateQuery.h>
#include <DB/Parsers/ParserCreateQuery.h>
#include <DB/Parsers/formatAST.h>
#include <DB/Parsers/parseQuery.h>
#include <DB/Databases/IDatabase.h>
#include <DB/Interpreters/InterpreterRenameQuery.h>

View File

@ -15,8 +15,6 @@
#include <DB/Interpreters/loadMetadata.h>
#include <DB/IO/ReadBufferFromFile.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/copyData.h>
#include <DB/Common/escapeForFileName.h>
#include <DB/Common/Stopwatch.h>
@ -74,8 +72,7 @@ void loadMetadata(Context & context)
if (Poco::File(database_metadata_file).exists())
{
ReadBufferFromFile in(database_metadata_file, 1024);
WriteBufferFromString out(database_attach_query);
copyData(in, out);
readStringUntilEOF(database_attach_query, in);
}
else
database_attach_query = "ATTACH DATABASE " + backQuoteIfNeed(database);

View File

@ -10,10 +10,8 @@
#include <common/ClickHouseRevision.h>
#include <common/LocalDateTime.h>
#include <DB/IO/copyData.h>
#include <DB/IO/ReadBufferFromFile.h>
#include <DB/IO/LimitReadBuffer.h>
#include <DB/IO/WriteBufferFromString.h>
#include <DB/IO/WriteBufferFromFileDescriptor.h>
#include <DB/IO/Operators.h>
@ -32,8 +30,7 @@ StatusFile::StatusFile(const std::string & path_)
{
ReadBufferFromFile in(path, 1024);
LimitReadBuffer limit_in(in, 1024);
WriteBufferFromString out(contents);
copyData(limit_in, out);
readStringUntilEOF(contents, limit_in);
}
if (!contents.empty())