2010-06-01 13:35:09 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Core/Types.h>
|
|
|
|
#include <IO/WriteHelpers.h>
|
|
|
|
#include <IO/WriteBufferFromOStream.h>
|
2010-06-01 13:35:09 +00:00
|
|
|
|
|
|
|
|
2017-12-01 18:36:55 +00:00
|
|
|
int main(int, char **)
|
2010-06-01 13:35:09 +00:00
|
|
|
{
|
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
|
|
|
}
|