ClickHouse/src/IO/examples/read_buffer_perf.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
912 B
C++
Raw Normal View History

2010-05-28 19:13:55 +00:00
#include <string>
#include <iostream>
2021-10-02 07:13:14 +00:00
#include <base/types.h>
#include <IO/ReadHelpers.h>
#include <IO/ReadBufferFromFile.h>
2010-05-28 19:13:55 +00:00
2017-12-01 18:36:55 +00:00
int main(int, char **)
2010-05-28 19:13:55 +00:00
{
try
{
DB::ReadBufferFromFile in("test");
2024-01-13 02:48:04 +00:00
Int64 a = 0;
Float64 b = 0;
String c, d;
2010-05-28 19:13:55 +00:00
size_t i = 0;
while (!in.eof())
{
2010-06-01 13:35:09 +00:00
DB::readIntText(a, in);
2010-05-28 19:13:55 +00:00
in.ignore();
2010-06-01 13:35:09 +00:00
DB::readFloatText(b, in);
2010-05-28 19:13:55 +00:00
in.ignore();
2010-06-01 13:35:09 +00:00
DB::readEscapedString(c, in);
2010-05-28 19:13:55 +00:00
in.ignore();
2010-06-01 13:35:09 +00:00
DB::readQuotedString(d, in);
2010-05-28 19:13:55 +00:00
in.ignore();
2010-05-28 19:13:55 +00:00
++i;
}
2010-05-28 19:13:55 +00:00
std::cout << a << ' ' << b << ' ' << c << '\t' << '\'' << d << '\'' << std::endl;
std::cout << i << std::endl;
}
catch (const DB::Exception & e)
{
2012-11-08 18:30:49 +00:00
std::cerr << e.what() << ", " << e.displayText() << std::endl;
2010-05-28 19:13:55 +00:00
return 1;
}
2010-05-28 19:13:55 +00:00
return 0;
}