#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace DB { namespace ErrorCodes { extern const int READONLY; extern const int UNKNOWN_TYPE_OF_QUERY; } static void throwIfReadOnly(Context & context) { if (context.getSettingsRef().limits.readonly) throw Exception("Cannot execute query in readonly mode", ErrorCodes::READONLY); } std::unique_ptr InterpreterFactory::get(ASTPtr & query, Context & context, QueryProcessingStage::Enum stage) { if (typeid_cast(query.get())) { return std::make_unique(query, context, stage); } else if (typeid_cast(query.get())) { throwIfReadOnly(context); return std::make_unique(query, context); } else if (typeid_cast(query.get())) { throwIfReadOnly(context); return std::make_unique(query, context); } else if (typeid_cast(query.get())) { throwIfReadOnly(context); return std::make_unique(query, context); } else if (typeid_cast(query.get())) { throwIfReadOnly(context); return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else if (typeid_cast(query.get())) { /// readonly is checked inside InterpreterSetQuery return std::make_unique(query, context); } else if (typeid_cast(query.get())) { throwIfReadOnly(context); return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else if (typeid_cast(query.get())) { throwIfReadOnly(context); return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else if (typeid_cast(query.get())) { return std::make_unique(query, context); } else throw Exception("Unknown type of query: " + query->getID(), ErrorCodes::UNKNOWN_TYPE_OF_QUERY); } }