Remove obsolete functions
This commit is contained in:
@@ -74,22 +74,9 @@ void RegisterTF(DatabaseInstance &instance, const char *name) {
|
|||||||
ExtensionUtil::RegisterFunction(instance, tf);
|
ExtensionUtil::RegisterFunction(instance, tf);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Func, Func func>
|
|
||||||
void RegisterTFWithArgs(DatabaseInstance &instance, const char *name,
|
|
||||||
vector<LogicalType> arguments,
|
|
||||||
table_function_bind_t bind) {
|
|
||||||
TableFunction tf(name, arguments, internal::TableFunc<Func, func>, bind,
|
|
||||||
RunOnceTableFunctionState::Init);
|
|
||||||
ExtensionUtil::RegisterFunction(instance, tf);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
#define RESISTER_TF(name, func) \
|
#define RESISTER_TF(name, func) \
|
||||||
internal::RegisterTF<decltype(&func), &func>(instance, name)
|
internal::RegisterTF<decltype(&func), &func>(instance, name)
|
||||||
|
|
||||||
#define RESISTER_TF_ARGS(name, args, func, bind) \
|
|
||||||
internal::RegisterTFWithArgs<decltype(&func), &func>(instance, name, args, \
|
|
||||||
bind)
|
|
||||||
|
|
||||||
} // namespace duckdb
|
} // namespace duckdb
|
||||||
|
|||||||
@@ -70,39 +70,6 @@ std::string StopUIServerFunction(ClientContext &context) {
|
|||||||
: "UI server already stopped";
|
: "UI server already stopped";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connected notification
|
|
||||||
struct NotifyConnectedFunctionData : public TableFunctionData {
|
|
||||||
NotifyConnectedFunctionData(std::string _token) : token(_token) {}
|
|
||||||
|
|
||||||
std::string token;
|
|
||||||
};
|
|
||||||
|
|
||||||
static unique_ptr<FunctionData>
|
|
||||||
NotifyConnectedBind(ClientContext &, TableFunctionBindInput &input,
|
|
||||||
vector<LogicalType> &out_types, vector<string> &out_names) {
|
|
||||||
if (input.inputs[0].IsNull()) {
|
|
||||||
throw BinderException("Must provide a token");
|
|
||||||
}
|
|
||||||
|
|
||||||
out_names.emplace_back("result");
|
|
||||||
out_types.emplace_back(LogicalType::VARCHAR);
|
|
||||||
return make_uniq<NotifyConnectedFunctionData>(input.inputs[0].ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string NotifyConnectedFunction(ClientContext &context,
|
|
||||||
TableFunctionInput &input) {
|
|
||||||
auto &inputs = input.bind_data->Cast<NotifyConnectedFunctionData>();
|
|
||||||
ui::HttpServer::GetInstance(context)->SendConnectedEvent(inputs.token);
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string NotifyCatalogChangedFunction(ClientContext &context) {
|
|
||||||
ui::HttpServer::GetInstance(context)->SendCatalogChangedEvent();
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
// - connected notification
|
|
||||||
|
|
||||||
unique_ptr<FunctionData> SingleBoolResultBind(ClientContext &,
|
unique_ptr<FunctionData> SingleBoolResultBind(ClientContext &,
|
||||||
TableFunctionBindInput &,
|
TableFunctionBindInput &,
|
||||||
vector<LogicalType> &out_types,
|
vector<LogicalType> &out_types,
|
||||||
@@ -151,9 +118,6 @@ static void LoadInternal(DatabaseInstance &instance) {
|
|||||||
RESISTER_TF("start_ui", StartUIFunction);
|
RESISTER_TF("start_ui", StartUIFunction);
|
||||||
RESISTER_TF("start_ui_server", StartUIServerFunction);
|
RESISTER_TF("start_ui_server", StartUIServerFunction);
|
||||||
RESISTER_TF("stop_ui_server", StopUIServerFunction);
|
RESISTER_TF("stop_ui_server", StopUIServerFunction);
|
||||||
RESISTER_TF("notify_ui_catalog_changed", NotifyCatalogChangedFunction);
|
|
||||||
RESISTER_TF_ARGS("notify_ui_connected", {LogicalType::VARCHAR},
|
|
||||||
NotifyConnectedFunction, NotifyConnectedBind);
|
|
||||||
{
|
{
|
||||||
TableFunction tf("ui_is_started", {}, IsUIStartedTableFunc,
|
TableFunction tf("ui_is_started", {}, IsUIStartedTableFunc,
|
||||||
SingleBoolResultBind, RunOnceTableFunctionState::Init);
|
SingleBoolResultBind, RunOnceTableFunctionState::Init);
|
||||||
|
|||||||
Reference in New Issue
Block a user