ClickHouse/dbms/IO/tests/write_buffer.cpp
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

48 lines
943 B
C++

#include <string>
#include <iostream>
#include <sstream>
#include <Core/Types.h>
#include <IO/WriteHelpers.h>
#include <IO/WriteBufferFromOStream.h>
int main(int, char **)
{
try
{
DB::Int64 a = -123456;
DB::Float64 b = 123.456;
DB::String c = "вася пе\tтя";
DB::String d = "'xyz\\";
std::stringstream s;
{
DB::WriteBufferFromOStream out(s);
DB::writeIntText(a, out);
DB::writeChar(' ', out);
DB::writeFloatText(b, out);
DB::writeChar(' ', out);
DB::writeEscapedString(c, out);
DB::writeChar('\t', out);
DB::writeQuotedString(d, out);
DB::writeChar('\n', out);
}
std::cout << s.str();
}
catch (const DB::Exception & e)
{
std::cerr << e.what() << ", " << e.displayText() << std::endl;
return 1;
}
return 0;
}