2014-01-28 16:45:10 +00:00
|
|
|
#include <DB/TableFunctions/TableFunctionMerge.h>
|
|
|
|
#include <DB/TableFunctions/TableFunctionRemote.h>
|
|
|
|
|
|
|
|
#include <DB/TableFunctions/TableFunctionFactory.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-01-11 21:46:36 +00:00
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int READONLY;
|
|
|
|
extern const int UNKNOWN_FUNCTION;
|
|
|
|
}
|
|
|
|
|
2014-01-28 16:45:10 +00:00
|
|
|
|
|
|
|
TableFunctionPtr TableFunctionFactory::get(
|
|
|
|
const String & name,
|
|
|
|
const Context & context) const
|
|
|
|
{
|
2015-02-27 20:35:26 +00:00
|
|
|
if (context.getSettings().limits.readonly == 1) /** Например, для readonly = 2 - разрешено. */
|
2014-02-25 17:37:50 +00:00
|
|
|
throw Exception("Table functions are forbidden in readonly mode", ErrorCodes::READONLY);
|
|
|
|
|
2014-01-28 16:45:10 +00:00
|
|
|
if (name == "merge") return new TableFunctionMerge;
|
|
|
|
else if (name == "remote") return new TableFunctionRemote;
|
|
|
|
else
|
2014-02-26 10:52:22 +00:00
|
|
|
throw Exception("Unknown table function " + name, ErrorCodes::UNKNOWN_FUNCTION);
|
2014-01-28 16:45:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|