| 1 | #include <IO/Operators.h> |
|---|---|
| 2 | #include <IO/WriteBufferFromFileDescriptor.h> |
| 3 | #include <IO/WriteBufferFromString.h> |
| 4 | |
| 5 | |
| 6 | int main(int, char **) |
| 7 | { |
| 8 | { |
| 9 | DB::WriteBufferFromFileDescriptor buf(STDOUT_FILENO); |
| 10 | buf |
| 11 | << "Hello, world!"<< '\n' |
| 12 | << DB::escape << "Hello, world!"<< '\n' |
| 13 | << DB::quote << "Hello, world!"<< '\n' |
| 14 | << DB::double_quote << "Hello, world!"<< '\n' |
| 15 | << DB::binary << "Hello, world!"<< '\n' |
| 16 | << LocalDateTime(time(nullptr)) << '\n' |
| 17 | << LocalDate(time(nullptr)) << '\n' |
| 18 | << 1234567890123456789UL << '\n' |
| 19 | << DB::flush; |
| 20 | } |
| 21 | |
| 22 | { |
| 23 | std::string hello; |
| 24 | { |
| 25 | DB::WriteBufferFromString buf(hello); |
| 26 | buf << "Hello"; |
| 27 | std::cerr << hello.size() << '\n'; |
| 28 | } |
| 29 | |
| 30 | std::cerr << hello.size() << '\n'; |
| 31 | std::cerr << hello << '\n'; |
| 32 | } |
| 33 | |
| 34 | { |
| 35 | DB::WriteBufferFromFileDescriptor buf(STDOUT_FILENO); |
| 36 | size_t x = 11; |
| 37 | buf << "Column "<< x << ", \n"; |
| 38 | } |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 |