dbms: addition to prev. revision [#METR-15934].

This commit is contained in:
Alexey Milovidov 2015-04-11 06:34:37 +03:00
parent aa726b203d
commit d09991bd87

View File

@ -17,6 +17,7 @@
#include <DB/DataTypes/DataTypesNumberFixed.h> #include <DB/DataTypes/DataTypesNumberFixed.h>
#include <DB/Parsers/ParserSelectQuery.h> #include <DB/Parsers/ParserSelectQuery.h>
#include <DB/Parsers/parseQuery.h>
#include <DB/Interpreters/ExpressionAnalyzer.h> #include <DB/Interpreters/ExpressionAnalyzer.h>
@ -31,21 +32,10 @@ int main(int argc, char ** argv)
{ {
size_t n = argc == 2 ? parse<UInt64>(argv[1]) : 10ULL; size_t n = argc == 2 ? parse<UInt64>(argv[1]) : 10ULL;
ParserSelectQuery parser;
ASTPtr ast;
std::string input = "SELECT number, number / 3, number * number"; std::string input = "SELECT number, number / 3, number * number";
Expected expected = "";
const char * begin = input.data(); ParserSelectQuery parser;
const char * end = begin + input.size(); ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
const char * pos = begin;
if (!parser.parse(pos, end, ast, max_parsed_pos, expected))
{
std::cout << "Failed at position " << (pos - begin) << ": "
<< mysqlxx::quote << input.substr(pos - begin, 10)
<< ", expected " << expected << "." << std::endl;
}
Context context; Context context;
context.getColumns().push_back(NameAndTypePair("number", new DataTypeUInt64)); context.getColumns().push_back(NameAndTypePair("number", new DataTypeUInt64));