Use system tables for formats, engines, functions, collations, types

This commit is contained in:
morty 2018-08-02 17:57:57 +03:00
parent fac492a3e4
commit 69f7948bbd
2 changed files with 17 additions and 89 deletions

View File

@ -204,8 +204,23 @@ public:
std::vector<Block> blocks; std::vector<Block> blocks;
//preload all functions //preload all functions, table engines, formats, table functions, data types, combinators, collations
sendQuery("SELECT name FROM system.functions", blocks); sendQuery(
"SELECT name FROM system.functions"
" UNION ALL "
"SELECT name FROM system.table_engines"
" UNION ALL "
"SELECT name FROM system.formats"
" UNION ALL "
"SELECT name FROM system.table_functions"
" UNION ALL "
"SELECT name FROM system.data_type_families"
" UNION ALL "
"SELECT name FROM system.aggregate_function_combinators"
" UNION ALL "
"SELECT name FROM system.collations",
blocks
);
for (const auto &block : blocks) { for (const auto &block : blocks) {
size_t size = block.rows(); size_t size = block.rows();
for (size_t i = size; i--;) { for (size_t i = size; i--;) {

View File

@ -111,11 +111,6 @@ QUERYPART queryParts[] = {
{(const char *)"AND"}, {(const char *)"AND"},
{(const char *)"OR"}, {(const char *)"OR"},
{(const char *)"ASC"}, {(const char *)"ASC"},
//TABLE FUNCTIONS
{(const char *)"file"},
{(const char *)"merge"},
{(const char *)"numbers"},
{(const char *)"remote"},
//IN //IN
{(const char *)"IN"}, {(const char *)"IN"},
//KILL QUERY //KILL QUERY
@ -124,88 +119,6 @@ QUERYPART queryParts[] = {
{(const char *)"SYNC"}, {(const char *)"SYNC"},
{(const char *)"ASYNC"}, {(const char *)"ASYNC"},
{(const char *)"TEST"}, {(const char *)"TEST"},
//TABLE ENGINES
{(const char *)"TinyLog"},
{(const char *)"Log"},
{(const char *)"Memory"},
{(const char *)"MergeTree"},
{(const char *)"ReplacingMergeTree"},
{(const char *)"SummingMergeTree"},
{(const char *)"AggregateFunction"},
{(const char *)"CollapsingMergeTree"},
{(const char *)"GraphiteMergeTree"},
{(const char *)"ReplicatedMergeTree"},
{(const char *)"ReplicatedSummingMergeTree"},
{(const char *)"ReplicatedReplacingMergeTree"},
{(const char *)"ReplicatedAggregatingMergeTree"},
{(const char *)"ReplicatedCollapsingMergeTree"},
{(const char *)"ReplicatedGraphiteMergeTree"},
{(const char *)"Distributed"},
{(const char *)"Dictionary"},
{(const char *)"Merge"},
{(const char *)"Buffer"},
{(const char *)"File"},
{(const char *)"Null"},
{(const char *)"Set"},
{(const char *)"Join"},
{(const char *)"View"},
{(const char *)"MaterializedView"},
{(const char *)"Kafka"},
{(const char *)"MySQL"},
//FORMATS
{(const char *)"TabSeparated"},
{(const char *)"TabSeparatedRaw"},
{(const char *)"TabSeparatedWithNames"},
{(const char *)"TSVWithNames"},
{(const char *)"TabSeparatedWithNamesAndTypes"},
{(const char *)"TSVWithNamesAndTypes"},
{(const char *)"CSV"},
{(const char *)"CSVWithNames"},
{(const char *)"Values"},
{(const char *)"Vertical"},
{(const char *)"VerticalRaw"},
{(const char *)"JSON"},
{(const char *)"JSONCompact"},
{(const char *)"JSONEachRow"},
{(const char *)"TSKV"},
{(const char *)"Pretty"},
{(const char *)"PrettyCompact"},
{(const char *)"PrettyCompactMonoBlock"},
{(const char *)"PrettyNoEscapes"},
{(const char *)"PrettySpace"},
{(const char *)"RowBinary"},
{(const char *)"Native"},
{(const char *)"XML"},
{(const char *)"CapnProto"},
{(const char *)"ODBCDriver"},
{(const char *)"PrettyCompactNoEscapes"},
{(const char *)"PrettySpaceNoEscapes"},
{(const char *)"TSVRaw"},
//TYPES
{(const char *)"Int8"},
{(const char *)"Int16"},
{(const char *)"Int32"},
{(const char *)"Int64"},
{(const char *)"UInt8"},
{(const char *)"UInt16"},
{(const char *)"UInt32"},
{(const char *)"UInt64"},
{(const char *)"Float32"},
{(const char *)"Float64"},
{(const char *)"Boolean"},
{(const char *)"String"},
{(const char *)"FixedString"},
{(const char *)"Date"},
{(const char *)"DateTime"},
{(const char *)"Enum8"},
{(const char *)"Enum16"},
{(const char *)"Array"},
{(const char *)"Tuple"},
{(const char *)"Nested"},
{(const char *)"Expression"},
{(const char *)"Set"},
{(const char *)"Nullable"},
{(const char *)"tuple"},
//END OF LIST //END OF LIST
{(const char *)nullptr}, {(const char *)nullptr},
}; };