2010-06-01 13:35:09 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
|
2010-06-04 18:32:37 +00:00
|
|
|
#include <DB/Core/Types.h>
|
|
|
|
#include <DB/IO/WriteHelpers.h>
|
2010-06-04 18:25:25 +00:00
|
|
|
#include <DB/IO/WriteBufferFromOStream.h>
|
2010-06-01 13:35:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
DB::Int64 a = -123456;
|
|
|
|
DB::Float64 b = 123.456;
|
|
|
|
DB::String c = "вася пе\tтя";
|
|
|
|
DB::String d = "'xyz\\";
|
2010-06-01 13:35:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::stringstream s;
|
2010-06-01 13:35:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
DB::WriteBufferFromOStream out(s);
|
2010-06-01 13:35:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
DB::writeIntText(a, out);
|
|
|
|
DB::writeChar(' ', out);
|
2017-03-31 16:00:30 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
DB::writeFloatText(b, out);
|
|
|
|
DB::writeChar(' ', out);
|
2017-03-31 16:00:30 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
DB::writeEscapedString(c, out);
|
|
|
|
DB::writeChar('\t', out);
|
2010-06-01 13:35:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
DB::writeQuotedString(d, out);
|
|
|
|
DB::writeChar('\n', out);
|
|
|
|
}
|
2010-06-01 13:35:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::cout << s.str();
|
|
|
|
}
|
|
|
|
catch (const DB::Exception & e)
|
|
|
|
{
|
|
|
|
std::cerr << e.what() << ", " << e.displayText() << std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
2010-06-01 13:35:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
return 0;
|
2010-06-01 13:35:09 +00:00
|
|
|
}
|