mirror of https://gitee.com/bigwinds/arangodb
parent
c50d346453
commit
4bbd6a02bb
|
@ -119,6 +119,12 @@ void AqlFunctionFeature::toVelocyPack(VPackBuilder& builder) {
|
||||||
builder.close();
|
builder.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AqlFunctionFeature::exists(std::string const& name) const {
|
||||||
|
auto it = _functionNames.find(name);
|
||||||
|
|
||||||
|
return it != _functionNames.end();
|
||||||
|
}
|
||||||
|
|
||||||
Function const* AqlFunctionFeature::byName(std::string const& name) {
|
Function const* AqlFunctionFeature::byName(std::string const& name) {
|
||||||
auto it = _functionNames.find(name);
|
auto it = _functionNames.find(name);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,8 @@ class AqlFunctionFeature final : public application_features::ApplicationFeature
|
||||||
void toVelocyPack(arangodb::velocypack::Builder&);
|
void toVelocyPack(arangodb::velocypack::Builder&);
|
||||||
Function const* byName(std::string const& name);
|
Function const* byName(std::string const& name);
|
||||||
|
|
||||||
|
bool exists(std::string const& name) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Internal functions
|
// Internal functions
|
||||||
void addTypeCheckFunctions();
|
void addTypeCheckFunctions();
|
||||||
|
|
|
@ -90,17 +90,19 @@ void ServerState::findHost(std::string const& fallback) {
|
||||||
|
|
||||||
// Now look at the contents of the file /etc/machine-id, if it exists:
|
// Now look at the contents of the file /etc/machine-id, if it exists:
|
||||||
std::string name = "/etc/machine-id";
|
std::string name = "/etc/machine-id";
|
||||||
try {
|
if (arangodb::basics::FileUtils::exists(name)) {
|
||||||
_host = arangodb::basics::FileUtils::slurp(name);
|
try {
|
||||||
while (!_host.empty() &&
|
_host = arangodb::basics::FileUtils::slurp(name);
|
||||||
(_host.back() == '\r' || _host.back() == '\n' ||
|
while (!_host.empty() &&
|
||||||
_host.back() == ' ')) {
|
(_host.back() == '\r' || _host.back() == '\n' ||
|
||||||
_host.erase(_host.size() - 1);
|
_host.back() == ' ')) {
|
||||||
}
|
_host.erase(_host.size() - 1);
|
||||||
if (!_host.empty()) {
|
}
|
||||||
return;
|
if (!_host.empty()) {
|
||||||
}
|
return;
|
||||||
} catch (...) { }
|
}
|
||||||
|
} catch (...) { }
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
static_assert(sizeof(uuid_t) == 16, "");
|
static_assert(sizeof(uuid_t) == 16, "");
|
||||||
|
|
|
@ -35,7 +35,7 @@ bool addFunction(
|
||||||
) {
|
) {
|
||||||
// check that a function by the given name is not registred to avoid
|
// check that a function by the given name is not registred to avoid
|
||||||
// triggering an assert inside AqlFunctionFeature::add(...)
|
// triggering an assert inside AqlFunctionFeature::add(...)
|
||||||
if (getFunction(functions, function.name)) {
|
if (functions.exists(function.name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue