mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/ArangoDB into JHMH
This commit is contained in:
commit
2d5d2d881e
|
@ -51,8 +51,8 @@ if ENABLE_V8_DEBUG
|
|||
CXX="$(CXX)" \
|
||||
CXX.host="$(CXX)" \
|
||||
LINK="$(CXX)" \
|
||||
CFLAGS="-O0 -ggdb -fsigned-char -march=armv6 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS)" \
|
||||
CXXFLAGS="-O0 -ggdb -fsigned-char -march=armv6 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS)" \
|
||||
CFLAGS="-O0 -ggdb -fsigned-char -march=armv6 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
CXXFLAGS="-O0 -ggdb -fsigned-char -march=armv6 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
LDFLAGS="-march=armv6" \
|
||||
debug=on v8_optimized_debug=0 v8_enable_backtrace=on \
|
||||
library=static strictaliasing=off snapshot=off werror=no hardfp=on @V8_TARGET@
|
||||
|
@ -65,8 +65,8 @@ else
|
|||
CXX="$(CXX)" \
|
||||
CXX.host="$(CXX)" \
|
||||
LINK="$(CXX)" \
|
||||
CFLAGS="-O2 -g -fsigned-char -march=armv6 $(GOLD_V8_FLAGS)" \
|
||||
CXXFLAGS="-O2 -g -fsigned-char -march=armv6 $(GOLD_V8_FLAGS)" \
|
||||
CFLAGS="-O2 -g -fsigned-char -march=armv6 $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
CXXFLAGS="-O2 -g -fsigned-char -march=armv6 $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
LDFLAGS="-march=armv6" \
|
||||
library=static strictaliasing=off snapshot=off werror=no hardfp=on @V8_TARGET@
|
||||
endif
|
||||
|
@ -86,8 +86,8 @@ if ENABLE_V8_DEBUG
|
|||
CXX="$(CXX)" \
|
||||
CXX.host="$(CXX)" \
|
||||
LINK="$(CXX)" \
|
||||
CFLAGS="-O0 -ggdb -fsigned-char -march=armv7 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS)" \
|
||||
CXXFLAGS="-O0 -ggdb -fsigned-char -march=armv7 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS)" \
|
||||
CFLAGS="-O0 -ggdb -fsigned-char -march=armv7 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
CXXFLAGS="-O0 -ggdb -fsigned-char -march=armv7 $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
LDFLAGS="-march=armv7" \
|
||||
debug=on v8_optimized_debug=0 v8_enable_backtrace=on \
|
||||
library=static strictaliasing=off snapshot=off werror=no @V8_TARGET@
|
||||
|
@ -100,8 +100,8 @@ else
|
|||
CXX="$(CXX)" \
|
||||
CXX.host="$(CXX)" \
|
||||
LINK="$(CXX)" \
|
||||
CFLAGS="-O2 -g -fsigned-char -march=armv7 $(GOLD_V8_FLAGS)" \
|
||||
CXXFLAGS="-O2 -g -fsigned-char -march=armv7 $(GOLD_V8_FLAGS)" \
|
||||
CFLAGS="-O2 -g -fsigned-char -march=armv7 $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
CXXFLAGS="-O2 -g -fsigned-char -march=armv7 $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
LDFLAGS="-march=armv7" \
|
||||
library=static strictaliasing=off snapshot=off werror=no @V8_TARGET@
|
||||
endif
|
||||
|
@ -160,8 +160,8 @@ if ENABLE_V8_DEBUG
|
|||
CXX="$(CXX)" \
|
||||
CXX.host="$(CXX)" \
|
||||
LINK="$(CXX)" \
|
||||
CFLAGS="-O0 -ggdb $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS)" \
|
||||
CXXFLAGS="-O0 -ggdb $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS)" \
|
||||
CFLAGS="-O0 -ggdb $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
CXXFLAGS="-O0 -ggdb $(DEBUG_V8_FLAGS) $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
debug=on v8_optimized_debug=0 v8_enable_backtrace=on \
|
||||
library=static strictaliasing=off snapshot=off werror=no @V8_TARGET@
|
||||
else # ! ENABLE_V8_DEBUG
|
||||
|
@ -173,8 +173,8 @@ else # ! ENABLE_V8_DEBUG
|
|||
CXX="$(CXX)" \
|
||||
CXX.host="$(CXX)" \
|
||||
LINK="$(CXX)" \
|
||||
CFLAGS="-O3 -fomit-frame-pointer -g $(GOLD_V8_FLAGS)" \
|
||||
CXXFLAGS="-O3 -fomit-frame-pointer -g $(GOLD_V8_FLAGS)" \
|
||||
CFLAGS="-O3 -fomit-frame-pointer -g $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
CXXFLAGS="-O3 -fomit-frame-pointer -g $(GOLD_V8_FLAGS) $(STDLIB_FLAGS)" \
|
||||
library=static strictaliasing=off snapshot=off werror=no @V8_TARGET@
|
||||
endif # ENABLE_V8_DEBUG
|
||||
endif # ENABLE_DARWIN
|
||||
|
|
|
@ -58,6 +58,7 @@ extern "C" {
|
|||
int linenoiseHistoryLoad(const char* filename);
|
||||
void linenoiseHistoryFree(void);
|
||||
void linenoiseClearScreen(void);
|
||||
int linenoiseInstallWindowChangeHandler(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ using namespace linenoise_ng;
|
|||
|
||||
typedef unsigned char char8_t;
|
||||
|
||||
ConversionResult copyString8to32 (char32_t* dst, size_t dstSize, size_t& dstCount, const char* src) {
|
||||
static ConversionResult copyString8to32 (char32_t* dst, size_t dstSize, size_t& dstCount, const char* src) {
|
||||
const UTF8* sourceStart = reinterpret_cast<const UTF8*>(src);
|
||||
const UTF8* sourceEnd = sourceStart + strlen(src);
|
||||
UTF32* targetStart = reinterpret_cast<UTF32*>(dst);
|
||||
|
@ -149,11 +149,11 @@ ConversionResult copyString8to32 (char32_t* dst, size_t dstSize, size_t& dstCoun
|
|||
return res;
|
||||
}
|
||||
|
||||
ConversionResult copyString8to32 (char32_t* dst, size_t dstSize, size_t& dstCount, const char8_t* src) {
|
||||
static ConversionResult copyString8to32 (char32_t* dst, size_t dstSize, size_t& dstCount, const char8_t* src) {
|
||||
return copyString8to32(dst, dstSize, dstCount, reinterpret_cast<const char*>(src));
|
||||
}
|
||||
|
||||
size_t strlen32 (const char32_t* str) {
|
||||
static size_t strlen32 (const char32_t* str) {
|
||||
const char32_t* ptr = str;
|
||||
|
||||
while (*ptr) {
|
||||
|
@ -163,15 +163,16 @@ size_t strlen32 (const char32_t* str) {
|
|||
return ptr - str;
|
||||
}
|
||||
|
||||
size_t strlen8 (const char8_t* str) {
|
||||
static size_t strlen8 (const char8_t* str) {
|
||||
return strlen(reinterpret_cast<const char*>(str));
|
||||
}
|
||||
|
||||
char8_t* strdup8 (const char* src) {
|
||||
static char8_t* strdup8 (const char* src) {
|
||||
return reinterpret_cast<char8_t*>(strdup(src));
|
||||
}
|
||||
|
||||
void copyString32to16(char16_t* dst, size_t dstSize, size_t* dstCount, const char32_t* src, size_t srcSize) {
|
||||
#ifdef _WIN32
|
||||
static void copyString32to16(char16_t* dst, size_t dstSize, size_t* dstCount, const char32_t* src, size_t srcSize) {
|
||||
const UTF32* sourceStart = reinterpret_cast<const UTF32*>(src);
|
||||
const UTF32* sourceEnd = sourceStart + srcSize;
|
||||
char16_t* targetStart = reinterpret_cast<char16_t*>(dst);
|
||||
|
@ -187,8 +188,9 @@ void copyString32to16(char16_t* dst, size_t dstSize, size_t* dstCount, const cha
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void copyString32to8 (char* dst, size_t dstSize, size_t* dstCount, const char32_t* src, size_t srcSize) {
|
||||
static void copyString32to8 (char* dst, size_t dstSize, size_t* dstCount, const char32_t* src, size_t srcSize) {
|
||||
const UTF32* sourceStart = reinterpret_cast<const UTF32*>(src);
|
||||
const UTF32* sourceEnd = sourceStart + srcSize;
|
||||
UTF8* targetStart = reinterpret_cast<UTF8*>(dst);
|
||||
|
@ -205,12 +207,12 @@ void copyString32to8 (char* dst, size_t dstSize, size_t* dstCount, const char32_
|
|||
}
|
||||
}
|
||||
|
||||
void copyString32to8 (char* dst, size_t dstLen, const char32_t* src) {
|
||||
static void copyString32to8 (char* dst, size_t dstLen, const char32_t* src) {
|
||||
size_t dstCount = 0;
|
||||
copyString32to8 (dst, dstLen, &dstCount, src, strlen32(src));
|
||||
}
|
||||
|
||||
void copyString32 (char32_t* dst, const char32_t* src, size_t len) {
|
||||
static void copyString32 (char32_t* dst, const char32_t* src, size_t len) {
|
||||
while (*src && 1 < len) {
|
||||
*dst++ = *src++;
|
||||
--len;
|
||||
|
@ -219,7 +221,7 @@ void copyString32 (char32_t* dst, const char32_t* src, size_t len) {
|
|||
*dst = 0;
|
||||
}
|
||||
|
||||
int strncmp32 (const char32_t* left, const char32_t* right, size_t len) {
|
||||
static int strncmp32 (const char32_t* left, const char32_t* right, size_t len) {
|
||||
while (0 < len && *left) {
|
||||
if (*left != *right) {
|
||||
return *left - * right;
|
||||
|
@ -233,7 +235,7 @@ int strncmp32 (const char32_t* left, const char32_t* right, size_t len) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int write32 (int fd, char32_t* text32, int len32) {
|
||||
static int write32 (int fd, char32_t* text32, int len32) {
|
||||
#ifdef _WIN32
|
||||
if (_isatty(fd)) {
|
||||
size_t len16 = 2 * len32 + 1;
|
||||
|
@ -464,6 +466,7 @@ struct PromptBase { // a convenience struct for grouping prompt inf
|
|||
Utf32String promptText; // our copy of the prompt text, edited
|
||||
char* promptCharWidths; // character widths from mk_wcwidth()
|
||||
int promptChars; // chars in promptText
|
||||
int promptBytes; // bytes in promptText
|
||||
int promptExtraLines; // extra lines (beyond 1) occupied by prompt
|
||||
int promptIndentation; // column offset to end of prompt
|
||||
int promptLastLinePosition; // index into promptText where last line begins
|
||||
|
@ -474,6 +477,13 @@ struct PromptBase { // a convenience struct for grouping prompt inf
|
|||
int promptErrorCode; // error code (invalid UTF-8) or zero
|
||||
|
||||
PromptBase() : promptPreviousInputLen(0) {}
|
||||
|
||||
bool write() {
|
||||
if (write32(1, promptText.get(), promptBytes) == -1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct PromptInfo : public PromptBase {
|
||||
|
@ -487,37 +497,78 @@ struct PromptInfo : public PromptBase {
|
|||
// strip control characters from the prompt -- we do allow newline
|
||||
char32_t* pIn = tempUnicode.get();
|
||||
char32_t* pOut = pIn;
|
||||
|
||||
int len = 0;
|
||||
int x = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
bool const strip = true;
|
||||
#else
|
||||
bool const strip = (isatty(1) != 1);
|
||||
#endif
|
||||
|
||||
while (*pIn) {
|
||||
char32_t c = *pIn;
|
||||
if ('\n' == c || !isControlChar(c)) {
|
||||
*pOut = c;
|
||||
++pOut;
|
||||
}
|
||||
++pIn;
|
||||
}
|
||||
*pOut = 0;
|
||||
promptChars = static_cast<int>(pOut - tempUnicode.get());
|
||||
promptText = tempUnicode;
|
||||
|
||||
int x = 0;
|
||||
for (int i = 0; i < promptChars; ++i) {
|
||||
char32_t c = promptText[i];
|
||||
if ('\n' == c) {
|
||||
x = 0;
|
||||
++promptExtraLines;
|
||||
promptLastLinePosition = i + 1;
|
||||
} else {
|
||||
++x;
|
||||
if (x >= promptScreenColumns) {
|
||||
++pIn;
|
||||
++len;
|
||||
if ('\n' == c || ++x >= promptScreenColumns) {
|
||||
x = 0;
|
||||
++promptExtraLines;
|
||||
promptLastLinePosition = i + 1;
|
||||
promptLastLinePosition = len;
|
||||
}
|
||||
}
|
||||
else if (c == '\x1b') {
|
||||
if (strip) {
|
||||
// jump over control chars
|
||||
++pIn;
|
||||
if (*pIn == '[') {
|
||||
++pIn;
|
||||
while (*pIn && ((*pIn == ';') || ((*pIn >= '0' && *pIn <= '9')))) {
|
||||
++pIn;
|
||||
}
|
||||
if (*pIn == 'm') {
|
||||
++pIn;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// copy control chars
|
||||
*pOut = *pIn;
|
||||
++pOut;
|
||||
++pIn;
|
||||
if (*pIn == '[') {
|
||||
*pOut = *pIn;
|
||||
++pOut;
|
||||
++pIn;
|
||||
while (*pIn && ((*pIn == ';') || ((*pIn >= '0' && *pIn <= '9')))) {
|
||||
*pOut = *pIn;
|
||||
++pOut;
|
||||
++pIn;
|
||||
}
|
||||
if (*pIn == 'm') {
|
||||
*pOut = *pIn;
|
||||
++pOut;
|
||||
++pIn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
++pIn;
|
||||
}
|
||||
}
|
||||
promptIndentation = promptChars - promptLastLinePosition;
|
||||
*pOut = 0;
|
||||
promptChars = len;
|
||||
promptBytes = static_cast<int>(pOut - tempUnicode.get());
|
||||
promptText = tempUnicode;
|
||||
|
||||
promptIndentation = len - promptLastLinePosition;
|
||||
promptCursorRowOffset = promptExtraLines;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Used with DynamicPrompt (history search)
|
||||
|
@ -545,6 +596,7 @@ struct DynamicPrompt : public PromptBase {
|
|||
(direction > 0) ? &forwardSearchBasePrompt : &reverseSearchBasePrompt;
|
||||
size_t promptStartLength = basePrompt->length();
|
||||
promptChars = static_cast<int>(promptStartLength + endSearchBasePrompt.length());
|
||||
promptBytes = promptChars;
|
||||
promptLastLinePosition =
|
||||
promptChars; // TODO fix this, we are asssuming that the history prompt won't wrap (!)
|
||||
promptPreviousLen = promptChars;
|
||||
|
@ -564,6 +616,7 @@ struct DynamicPrompt : public PromptBase {
|
|||
(direction > 0) ? &forwardSearchBasePrompt : &reverseSearchBasePrompt;
|
||||
size_t promptStartLength = basePrompt->length();
|
||||
promptChars = static_cast<int>(promptStartLength + searchTextLen + endSearchBasePrompt.length());
|
||||
promptBytes = promptChars;
|
||||
Utf32String tempUnicode(promptChars + 1);
|
||||
memcpy(tempUnicode.get(), basePrompt->get(), sizeof(char32_t) * promptStartLength);
|
||||
memcpy(&tempUnicode[promptStartLength], searchText.get(), sizeof(char32_t) * searchTextLen);
|
||||
|
@ -787,7 +840,7 @@ static int enableRawMode(void) {
|
|||
#else
|
||||
struct termios raw;
|
||||
|
||||
if (!isatty(0))
|
||||
if (!isatty(STDIN_FILENO))
|
||||
goto fatal;
|
||||
if (!atexit_registered) {
|
||||
atexit(linenoiseAtExit);
|
||||
|
@ -955,7 +1008,7 @@ static void dynamicRefresh(PromptBase& pi, char32_t* buf32, int len, int pos) {
|
|||
pi.promptPreviousInputLen = len;
|
||||
|
||||
// display the prompt
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
return;
|
||||
|
||||
// display the input line
|
||||
|
@ -981,7 +1034,7 @@ static void dynamicRefresh(PromptBase& pi, char32_t* buf32, int len, int pos) {
|
|||
return;
|
||||
|
||||
// display the prompt
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
return;
|
||||
|
||||
// display the input line
|
||||
|
@ -1919,7 +1972,7 @@ int InputBuffer::completeLine(PromptBase& pi) {
|
|||
if (write(1, "\n", 1) == -1)
|
||||
return 0;
|
||||
}
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
return 0;
|
||||
#ifndef _WIN32
|
||||
// we have to generate our own newline on line wrap on Linux
|
||||
|
@ -1952,7 +2005,7 @@ void linenoiseClearScreen(void) {
|
|||
|
||||
void InputBuffer::clearScreen(PromptBase& pi) {
|
||||
linenoiseClearScreen();
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
return;
|
||||
#ifndef _WIN32
|
||||
// we have to generate our own newline on line wrap on Linux
|
||||
|
@ -2190,8 +2243,10 @@ int InputBuffer::incrementalHistorySearch(PromptBase& pi, int startChar) {
|
|||
// leaving history search, restore previous prompt, maybe make searched line current
|
||||
PromptBase pb;
|
||||
pb.promptChars = pi.promptIndentation;
|
||||
Utf32String tempUnicode(pb.promptChars + 1);
|
||||
copyString32(tempUnicode.get(), &pi.promptText[pi.promptLastLinePosition], pb.promptChars + 1);
|
||||
pb.promptBytes = pi.promptBytes;
|
||||
Utf32String tempUnicode(pb.promptBytes + 1);
|
||||
|
||||
copyString32(tempUnicode.get(), &pi.promptText[pi.promptLastLinePosition], pb.promptBytes + 1);
|
||||
tempUnicode.initFromBuffer();
|
||||
pb.promptText = tempUnicode;
|
||||
pb.promptExtraLines = 0;
|
||||
|
@ -2221,6 +2276,10 @@ static bool isCharacterAlphanumeric(char32_t testChar) {
|
|||
return (iswalnum(testChar) != 0 ? true : false);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
static bool gotResize = false;
|
||||
#endif
|
||||
|
||||
int InputBuffer::getInputLine(PromptBase& pi) {
|
||||
// The latest history entry is always our current buffer
|
||||
if (len > 0) {
|
||||
|
@ -2235,7 +2294,7 @@ int InputBuffer::getInputLine(PromptBase& pi) {
|
|||
historyRecallMostRecent = false;
|
||||
|
||||
// display the prompt
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
return -1;
|
||||
|
||||
#ifndef _WIN32
|
||||
|
@ -2264,11 +2323,22 @@ int InputBuffer::getInputLine(PromptBase& pi) {
|
|||
int c;
|
||||
if (terminatingKeystroke == -1) {
|
||||
c = linenoiseReadChar(); // get a new keystroke
|
||||
|
||||
#ifndef _WIN32
|
||||
if (c == 0 && gotResize) {
|
||||
// caught a window resize event
|
||||
// now redraw the prompt and line
|
||||
gotResize = false;
|
||||
pi.promptScreenColumns = getScreenColumns();
|
||||
dynamicRefresh(pi, buf32, len, pos); // redraw the original prompt with current input
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
c = terminatingKeystroke; // use the terminating keystroke from search
|
||||
terminatingKeystroke = -1; // clear it once we've used it
|
||||
}
|
||||
|
||||
|
||||
c = cleanupCtrl(c); // convert CTRL + <char> into normal ctrl
|
||||
|
||||
if (c == 0) {
|
||||
|
@ -2281,7 +2351,7 @@ int InputBuffer::getInputLine(PromptBase& pi) {
|
|||
}
|
||||
|
||||
if (c == -2) {
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
return -1;
|
||||
refreshLine(pi);
|
||||
continue;
|
||||
|
@ -2707,7 +2777,7 @@ int InputBuffer::getInputLine(PromptBase& pi) {
|
|||
disableRawMode(); // Returning to Linux (whatever) shell, leave raw mode
|
||||
raise(SIGSTOP); // Break out in mid-line
|
||||
enableRawMode(); // Back from Linux shell, re-enter raw mode
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
break; // Redraw prompt
|
||||
refreshLine(pi); // Refresh the line
|
||||
break;
|
||||
|
@ -2869,6 +2939,9 @@ void linenoisePreloadBuffer(const char* preloadText) {
|
|||
* memory leaks
|
||||
*/
|
||||
char* linenoise(const char* prompt) {
|
||||
#ifndef _WIN32
|
||||
gotResize = false;
|
||||
#endif
|
||||
if (isatty(STDIN_FILENO)) { // input is from a terminal
|
||||
char32_t buf32[LINENOISE_MAX_LINE];
|
||||
char charWidths[LINENOISE_MAX_LINE];
|
||||
|
@ -2879,7 +2952,7 @@ char* linenoise(const char* prompt) {
|
|||
}
|
||||
PromptInfo pi(prompt, getScreenColumns());
|
||||
if (isUnsupportedTerm()) {
|
||||
if (write32(1, pi.promptText.get(), pi.promptChars) == -1)
|
||||
if (! pi.write())
|
||||
return 0;
|
||||
fflush(stdout);
|
||||
if (preloadedBufferContents.empty()) {
|
||||
|
@ -3058,3 +3131,23 @@ int linenoiseHistoryLoad(const char* filename) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
static void WindowSizeChanged(int) {
|
||||
// do nothing here but setting this flag
|
||||
gotResize = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
int linenoiseInstallWindowChangeHandler(void) {
|
||||
#ifndef _WIN32
|
||||
struct sigaction sa;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = &WindowSizeChanged;
|
||||
|
||||
if (sigaction(SIGWINCH, &sa, nullptr) == -1) {
|
||||
return errno;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
v2.8.0 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* added startup option `--server.hide-product-header` to make the server not send
|
||||
the HTTP response header `"Server: ArangoDB"` in its HTTP responses. By default,
|
||||
the option is turned off so the header is still sent as usual.
|
||||
|
||||
* added new AQL function `UNSET_RECURSIVE` to recursively unset attritutes from
|
||||
objects/documents
|
||||
|
||||
|
|
|
@ -797,6 +797,12 @@ endif ()
|
|||
|
||||
if (MSVC)
|
||||
install_readme(LICENSE . LICENSE.txt)
|
||||
install_readme(LICENSES-OTHER-COMPONENTS.md . LICENSES-OTHER-COMPONENTS.md)
|
||||
else ()
|
||||
install_readme(README share/doc/arangodb README)
|
||||
install_readme(README.md share/doc/arangodb README.md)
|
||||
install_readme(LICENSE share/doc/arangodb LICENSE)
|
||||
install_readme(LICENSES-OTHER-COMPONENTS.md share/doc/arangodb LICENSES-OTHER-COMPONENTS.md)
|
||||
endif ()
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
|
@ -908,8 +914,6 @@ if (MSVC)
|
|||
SET(BITS 32)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
message(STATUS "ARANGO_IMG: ${ARANGO_IMG}")
|
||||
message(STATUS "ARANGO_ICON: ${ARANGO_ICON}")
|
||||
message(STATUS "RELATIVE_ARANGO_ICON: ${RELATIVE_ARANGO_ICON}")
|
||||
|
|
|
@ -8,24 +8,26 @@ instead.
|
|||
|
||||
!SECTION Determining direct connections
|
||||
|
||||
- *EDGES(edgecollection, startvertex, direction, edgeexamples, options)*:
|
||||
Return all edges connected to the vertex *startvertex* as an array. The possible values for
|
||||
*direction* are:
|
||||
!SUBSECTION Edges
|
||||
*EDGES(edgecollection, startvertex, direction, edgeexamples, options)*:
|
||||
|
||||
Return all edges connected to the vertex *startvertex* as an array. The possible values for
|
||||
*direction* are:
|
||||
- *outbound*: Return all outbound edges
|
||||
- *inbound*: Return all inbound edges
|
||||
- *any*: Return outbound and inbound edges
|
||||
|
||||
The *edgeexamples* parameter can optionally be used to restrict the results to specific
|
||||
edge connections only. The matching is then done via the *MATCHES* function.
|
||||
To not restrict the result to specific connections, *edgeexamples* should be left
|
||||
unspecified.
|
||||
The *edgeexamples* parameter can optionally be used to restrict the results to specific
|
||||
edge connections only. The matching is then done via the *MATCHES* function.
|
||||
To not restrict the result to specific connections, *edgeexamples* should be left
|
||||
unspecified.
|
||||
|
||||
Options is a JSON object that can contain the following properties:
|
||||
- *includeVertices*: A boolean value, when set to true the return format will be modified.
|
||||
The function will then return an object with two attributes *edge* and *vertex* containing
|
||||
the respective elements.
|
||||
Options is a JSON object that can contain the following properties:
|
||||
- *includeVertices*: A boolean value, when set to true the return format will be modified.
|
||||
The function will then return an object with two attributes *edge* and *vertex* containing
|
||||
the respective elements.
|
||||
|
||||
In order to specify only options but no *edgeExamples* set *edgeExamples* to *null*.
|
||||
In order to specify only options but no *edgeExamples* set *edgeExamples* to *null*.
|
||||
|
||||
*Examples*
|
||||
|
||||
|
@ -35,31 +37,33 @@ instead.
|
|||
EDGES(friendrelations, "friends/john", "any", null, {includeVertices: true})
|
||||
|
||||
|
||||
- *NEIGHBORS(vertexcollection, edgecollection, startvertex, direction, edgeexamples, options)*:
|
||||
Returns `_id` values of all distinct neighbors that are directly connected to the
|
||||
vertex *startvertex* as an array.
|
||||
|
||||
The possible values for *direction* are:
|
||||
- *outbound*: Return all outbound edges
|
||||
- *inbound*: Return all inbound edges
|
||||
- *any*: Return outbound and inbound edges
|
||||
!SUBSECTION Neighbors
|
||||
*NEIGHBORS(vertexcollection, edgecollection, startvertex, direction, edgeexamples, options)*:
|
||||
|
||||
The *edgeexamples* parameter can optionally be used to restrict the results to specific
|
||||
edge connections only. The matching is then done via the *MATCHES* function.
|
||||
To not restrict the result to specific connections, *edgeexamples* should be left
|
||||
unspecified.
|
||||
Returns `_id` values of all distinct neighbors that are directly connected to the
|
||||
vertex *startvertex* as an array.
|
||||
|
||||
The *options* parameter is an object and used to modify the result.
|
||||
Available options:
|
||||
The possible values for *direction* are:
|
||||
- *outbound*: Return all outbound edges
|
||||
- *inbound*: Return all inbound edges
|
||||
- *any*: Return outbound and inbound edges
|
||||
|
||||
* *includeData* is a boolean value to define if the returned documents should be extracted instead
|
||||
of returning their ids only. The default is *false*.
|
||||
The *edgeexamples* parameter can optionally be used to restrict the results to specific
|
||||
edge connections only. The matching is then done via the *MATCHES* function.
|
||||
To not restrict the result to specific connections, *edgeexamples* should be left
|
||||
unspecified.
|
||||
|
||||
Note: in ArangoDB versions prior to 2.6 *NEIGHBORS* returned the array of neighbor vertices together
|
||||
with their connecting edges including all attributes and not only the ids.
|
||||
To include the data and not only the ids set the *includeData* option to *true* in 2.6 and above.
|
||||
To create the result format of 2.5 and earlier please replace the NEIGHBORS function by EDGES
|
||||
with the option *includeVertices* set to true.
|
||||
The *options* parameter is an object and used to modify the result.
|
||||
Available options:
|
||||
|
||||
* *includeData* is a boolean value to define if the returned documents should be extracted instead
|
||||
of returning their ids only. The default is *false*.
|
||||
|
||||
Note: in ArangoDB versions prior to 2.6 *NEIGHBORS* returned the array of neighbor vertices together
|
||||
with their connecting edges including all attributes and not only the ids.
|
||||
To include the data and not only the ids set the *includeData* option to *true* in 2.6 and above.
|
||||
To create the result format of 2.5 and earlier please replace the NEIGHBORS function by EDGES
|
||||
with the option *includeVertices* set to true.
|
||||
|
||||
*Examples*
|
||||
|
||||
|
@ -70,148 +74,149 @@ instead.
|
|||
|
||||
!SECTION General-purpose traversals
|
||||
|
||||
- *TRAVERSAL(vertexcollection, edgecollection, startVertex, direction, options)*:
|
||||
Traverses the graph described by *vertexcollection* and *edgecollection*,
|
||||
starting at the vertex identified by id *startVertex*. Vertex connectivity is
|
||||
specified by the *direction* parameter:
|
||||
- *"outbound"*: Vertices are connected in *_from* to *_to* order
|
||||
- *"inbound"*: Vertices are connected in *_to* to *_from* order
|
||||
- *"any"*: Vertices are connected in both *_to* to *_from* and in
|
||||
*_from* to *_to* order
|
||||
!SUBSECTION Traversal
|
||||
*TRAVERSAL(vertexcollection, edgecollection, startVertex, direction, options)*:
|
||||
Traverses the graph described by *vertexcollection* and *edgecollection*,
|
||||
starting at the vertex identified by id *startVertex*. Vertex connectivity is
|
||||
specified by the *direction* parameter:
|
||||
- *"outbound"*: Vertices are connected in *_from* to *_to* order
|
||||
- *"inbound"*: Vertices are connected in *_to* to *_from* order
|
||||
- *"any"*: Vertices are connected in both *_to* to *_from* and in
|
||||
*_from* to *_to* order
|
||||
|
||||
Additional options for the traversal can be provided via the *options* document:
|
||||
- *strategy*: Defines the traversal strategy. Possible values are *depthfirst*
|
||||
and *breadthfirst*. Defaults to *depthfirst*
|
||||
- *order*: Defines the traversal order: Possible values are *preorder*, *postorder*,
|
||||
and *preorder-expander*. Defaults to *preorder*
|
||||
- *itemOrder*: Defines the level item order. Can be *forward* or
|
||||
*backward*. Defaults to *forward*
|
||||
- *minDepth*: Minimum path depths for vertices to be included. This can be used to
|
||||
include only vertices in the result that are found after a certain minimum depth.
|
||||
Defaults to 0
|
||||
- *maxIterations*: Maximum number of iterations in each traversal. This number can be
|
||||
set to prevent endless loops in traversal of cyclic graphs. When a traversal performs
|
||||
as many iterations as the *maxIterations* value, the traversal will abort with an
|
||||
error. If *maxIterations* is not set, a server-defined value will be used
|
||||
- *maxDepth*: Maximum path depth for sub-edges expansion. This can be used to
|
||||
limit the depth of the traversal to a sensible amount. This should especially be used
|
||||
for big graphs to limit the traversal to some sensible amount, and for graphs
|
||||
containing cycles to prevent infinite traversals. The maximum depth defaults to 256,
|
||||
with the chance of this value being non-sensical. For several graphs, a much lower
|
||||
maximum depth is sensible, whereas for other, more array-oriented graphs a higher
|
||||
depth should be used
|
||||
- *paths*: If *true*, the paths encountered during the traversal will
|
||||
also be returned along with each traversed vertex. If *false*, only the
|
||||
encountered vertices will be returned.
|
||||
- *uniqueness*: An optional document with the following attributes:
|
||||
- *vertices*:
|
||||
- *none*: No vertex uniqueness is enforced
|
||||
- *global*: A vertex may be visited at most once. This is the default.
|
||||
- *path*: A vertex is visited only if not already contained in the current
|
||||
traversal path
|
||||
- *edges*:
|
||||
- *none*: No edge uniqueness is enforced
|
||||
- *global*: An edge may be visited at most once. This is the default
|
||||
- *path*: An edge is visited only if not already contained in the current
|
||||
traversal path
|
||||
- *followEdges*: An optional array of example edge documents that the traversal will
|
||||
expand into. If no examples are given, the traversal will follow all edges. If one
|
||||
or many edge examples are given, the traversal will only follow an edge if it matches
|
||||
at least one of the specified examples. *followEdges* can also be a string with the
|
||||
name of an AQL user-defined function that should be responsible for checking if an
|
||||
edge should be followed. In this case, the AQL function will is expected to have the
|
||||
following signature:
|
||||
Additional options for the traversal can be provided via the *options* document:
|
||||
- *strategy*: Defines the traversal strategy. Possible values are *depthfirst*
|
||||
and *breadthfirst*. Defaults to *depthfirst*
|
||||
- *order*: Defines the traversal order: Possible values are *preorder*, *postorder*,
|
||||
and *preorder-expander*. Defaults to *preorder*
|
||||
- *itemOrder*: Defines the level item order. Can be *forward* or
|
||||
*backward*. Defaults to *forward*
|
||||
- *minDepth*: Minimum path depths for vertices to be included. This can be used to
|
||||
include only vertices in the result that are found after a certain minimum depth.
|
||||
Defaults to 0
|
||||
- *maxIterations*: Maximum number of iterations in each traversal. This number can be
|
||||
set to prevent endless loops in traversal of cyclic graphs. When a traversal performs
|
||||
as many iterations as the *maxIterations* value, the traversal will abort with an
|
||||
error. If *maxIterations* is not set, a server-defined value will be used
|
||||
- *maxDepth*: Maximum path depth for sub-edges expansion. This can be used to
|
||||
limit the depth of the traversal to a sensible amount. This should especially be used
|
||||
for big graphs to limit the traversal to some sensible amount, and for graphs
|
||||
containing cycles to prevent infinite traversals. The maximum depth defaults to 256,
|
||||
with the chance of this value being non-sensical. For several graphs, a much lower
|
||||
maximum depth is sensible, whereas for other, more array-oriented graphs a higher
|
||||
depth should be used
|
||||
- *paths*: If *true*, the paths encountered during the traversal will
|
||||
also be returned along with each traversed vertex. If *false*, only the
|
||||
encountered vertices will be returned.
|
||||
- *uniqueness*: An optional document with the following attributes:
|
||||
- *vertices*:
|
||||
- *none*: No vertex uniqueness is enforced
|
||||
- *global*: A vertex may be visited at most once. This is the default.
|
||||
- *path*: A vertex is visited only if not already contained in the current
|
||||
traversal path
|
||||
- *edges*:
|
||||
- *none*: No edge uniqueness is enforced
|
||||
- *global*: An edge may be visited at most once. This is the default
|
||||
- *path*: An edge is visited only if not already contained in the current
|
||||
traversal path
|
||||
- *followEdges*: An optional array of example edge documents that the traversal will
|
||||
expand into. If no examples are given, the traversal will follow all edges. If one
|
||||
or many edge examples are given, the traversal will only follow an edge if it matches
|
||||
at least one of the specified examples. *followEdges* can also be a string with the
|
||||
name of an AQL user-defined function that should be responsible for checking if an
|
||||
edge should be followed. In this case, the AQL function will is expected to have the
|
||||
following signature:
|
||||
|
||||
function (config, vertex, edge, path)
|
||||
function (config, vertex, edge, path)
|
||||
|
||||
The function is expected to return a boolean value. If it returns *true*, the edge
|
||||
will be followed. If *false* is returned, the edge will be ignored.
|
||||
The function is expected to return a boolean value. If it returns *true*, the edge
|
||||
will be followed. If *false* is returned, the edge will be ignored.
|
||||
|
||||
- *filterVertices*: An optional array of example vertex documents that the traversal will
|
||||
treat specially. If no examples are given, the traversal will handle all encountered
|
||||
vertices equally. If one or many vertex examples are given, the traversal will exclude
|
||||
any non-matching vertex from the result and/or not descend into it. Optionally,
|
||||
*filterVertices* can contain a string containing the name of a user-defined AQL function
|
||||
that should be responsible for filtering. If so, the AQL function is expected to have the
|
||||
following signature:
|
||||
- *filterVertices*: An optional array of example vertex documents that the traversal will
|
||||
treat specially. If no examples are given, the traversal will handle all encountered
|
||||
vertices equally. If one or many vertex examples are given, the traversal will exclude
|
||||
any non-matching vertex from the result and/or not descend into it. Optionally,
|
||||
*filterVertices* can contain a string containing the name of a user-defined AQL function
|
||||
that should be responsible for filtering. If so, the AQL function is expected to have the
|
||||
following signature:
|
||||
|
||||
function (config, vertex, path)
|
||||
function (config, vertex, path)
|
||||
|
||||
If a custom AQL function is used for *filterVertices*, it is expected to return one of
|
||||
the following values:
|
||||
- *[ ]*: Include the vertex in the result and descend into its connected edges
|
||||
- *[ "prune" ]*: Will include the vertex in the result but not descend into its connected edges
|
||||
- *[ "exclude" ]*: Will not include the vertex in the result but descend into its connected edges
|
||||
- *[ "prune", "exclude" ]*: Will completely ignore the vertex and its connected edges
|
||||
If a custom AQL function is used for *filterVertices*, it is expected to return one of
|
||||
the following values:
|
||||
- *[ ]*: Include the vertex in the result and descend into its connected edges
|
||||
- *[ "prune" ]*: Will include the vertex in the result but not descend into its connected edges
|
||||
- *[ "exclude" ]*: Will not include the vertex in the result but descend into its connected edges
|
||||
- *[ "prune", "exclude" ]*: Will completely ignore the vertex and its connected edges
|
||||
|
||||
- *vertexFilterMethod*: Only useful in conjunction with *filterVertices* and if no user-defined
|
||||
AQL function is used. If specified, it will influence how vertices are handled that don't match
|
||||
the examples in *filterVertices*:
|
||||
- *[ "prune" ]*: Will include non-matching vertices in the result but not descend into them
|
||||
- *[ "exclude" ]*: Will not include non-matching vertices in the result but descend into them
|
||||
- *[ "prune", "exclude" ]*: Will completely ignore the vertex and its connected edges
|
||||
- *vertexFilterMethod*: Only useful in conjunction with *filterVertices* and if no user-defined
|
||||
AQL function is used. If specified, it will influence how vertices are handled that don't match
|
||||
the examples in *filterVertices*:
|
||||
- *[ "prune" ]*: Will include non-matching vertices in the result but not descend into them
|
||||
- *[ "exclude" ]*: Will not include non-matching vertices in the result but descend into them
|
||||
- *[ "prune", "exclude" ]*: Will completely ignore the vertex and its connected edges
|
||||
|
||||
- *visitor*: If specified, must be a string containing the name of a custom AQL function that
|
||||
will be called whenever the traversal visits a vertex. The custom AQL function is expected
|
||||
to have the following signature:
|
||||
- *visitor*: If specified, must be a string containing the name of a custom AQL function that
|
||||
will be called whenever the traversal visits a vertex. The custom AQL function is expected
|
||||
to have the following signature:
|
||||
|
||||
function (config, result, vertex, path, connections)
|
||||
function (config, result, vertex, path, connections)
|
||||
|
||||
There are two modes for custom AQL visitor functions, depending on the value of the option
|
||||
*visitorReturnsResults*. If it is set to *true*, then any value returned by the visitor will
|
||||
be appended to the list of results of the TRAVERSAL function. If *visitorReturnsResults* is
|
||||
set to *false*, then any value returned by the custom visitor function will be ignored.
|
||||
Instead, the visitor function is allowed to modify its *result* function parameter value
|
||||
in-place. The contents of this variable at the end of the traversal will then be the
|
||||
results of the TRAVERSAL function.
|
||||
There are two modes for custom AQL visitor functions, depending on the value of the option
|
||||
*visitorReturnsResults*. If it is set to *true*, then any value returned by the visitor will
|
||||
be appended to the list of results of the TRAVERSAL function. If *visitorReturnsResults* is
|
||||
set to *false*, then any value returned by the custom visitor function will be ignored.
|
||||
Instead, the visitor function is allowed to modify its *result* function parameter value
|
||||
in-place. The contents of this variable at the end of the traversal will then be the
|
||||
results of the TRAVERSAL function.
|
||||
|
||||
Note: The *connections* function parameter value will contain the edges connected to the
|
||||
vertex only if *order* was set to *preorder-expander*. Otherwise, the value of this parameter
|
||||
will be *undefined*.
|
||||
Note: The *connections* function parameter value will contain the edges connected to the
|
||||
vertex only if *order* was set to *preorder-expander*. Otherwise, the value of this parameter
|
||||
will be *undefined*.
|
||||
|
||||
The following custom visitor functions are predefined and can be used by specifying the function
|
||||
name in the *visitor* attribute:
|
||||
The following custom visitor functions are predefined and can be used by specifying the function
|
||||
name in the *visitor* attribute:
|
||||
|
||||
- *"_AQL::HASATTRIBUTESVISITOR"*: this visitor will produce an object if it contains the
|
||||
attributes specified in *data.attributes* for each visited vertex. If *data.type* is *"all"*,
|
||||
then the object will only be returned if all specified attributes are present in the vertex,
|
||||
if *data.type* is *"any"*, the object will be returned if the vertex contains any of the
|
||||
specified attributes. If the optional *data.allowNull* is set to `false`, then the object
|
||||
will only be returned if an attribute is present **and** does not contain a `null` value.
|
||||
Otherwise an object will be returned already if the attribute is present.
|
||||
- *"_AQL::HASATTRIBUTESVISITOR"*: this visitor will produce an object if it contains the
|
||||
attributes specified in *data.attributes* for each visited vertex. If *data.type* is *"all"*,
|
||||
then the object will only be returned if all specified attributes are present in the vertex,
|
||||
if *data.type* is *"any"*, the object will be returned if the vertex contains any of the
|
||||
specified attributes. If the optional *data.allowNull* is set to `false`, then the object
|
||||
will only be returned if an attribute is present **and** does not contain a `null` value.
|
||||
Otherwise an object will be returned already if the attribute is present.
|
||||
|
||||
- *"_AQL::PROJECTINGVISITOR"*: this visitor will produce an object with the attributes
|
||||
specified in *data.attributes* for each visited vertex. This can be used to create a
|
||||
projection of each visited vertex' document.
|
||||
- *"_AQL::PROJECTINGVISITOR"*: this visitor will produce an object with the attributes
|
||||
specified in *data.attributes* for each visited vertex. This can be used to create a
|
||||
projection of each visited vertex' document.
|
||||
|
||||
- *"_AQL::IDVISITOR"*: this visitor will return the _id attribute of each visited vertex.
|
||||
- *"_AQL::IDVISITOR"*: this visitor will return the _id attribute of each visited vertex.
|
||||
|
||||
- *"_AQL::KEYVISITOR"*: this visitor will return the _key attribute of each visited vertex.
|
||||
- *"_AQL::KEYVISITOR"*: this visitor will return the _key attribute of each visited vertex.
|
||||
|
||||
- *"_AQL::COUNTINGVISITOR"*: this visitor will return a single number indicating the number
|
||||
of vertices visited.
|
||||
- *"_AQL::COUNTINGVISITOR"*: this visitor will return a single number indicating the number
|
||||
of vertices visited.
|
||||
|
||||
|
||||
- *visitorReturnsResults*: only useful in combination with a custom AQL visitor function. If
|
||||
set to *true*, the data returned by the visitor will be appended to the result. If set to
|
||||
*false*, any return value of the visitor function will be ignored. Instead, the visitor
|
||||
function can modify its *result* parameter value in-place. At the end of the traversal,
|
||||
*result* is expected to be an array.
|
||||
|
||||
- *data*: only useful in combination with custom AQL visitor or filter functions. This attribute can
|
||||
be used to pass arbitrary data into the custom visitor function. The value contained in the
|
||||
*data* attribute will be made available to the *visitor* and *filterVertices* functions in the *config.data*
|
||||
attribute.
|
||||
|
||||
By default, the result of the TRAVERSAL function is an array of traversed points. Each point
|
||||
is an object consisting of the following attributes:
|
||||
- *visitorReturnsResults*: only useful in combination with a custom AQL visitor function. If
|
||||
set to *true*, the data returned by the visitor will be appended to the result. If set to
|
||||
*false*, any return value of the visitor function will be ignored. Instead, the visitor
|
||||
function can modify its *result* parameter value in-place. At the end of the traversal,
|
||||
*result* is expected to be an array.
|
||||
|
||||
- *vertex*: The vertex at the traversal point
|
||||
- *path*: The path history for the traversal point. The path is a document with the
|
||||
attributes *vertices* and *edges*, which are both arrays. Note that *path* is only present
|
||||
in the result if the *paths* attribute is set in the *options*
|
||||
- *data*: only useful in combination with custom AQL visitor or filter functions. This attribute can
|
||||
be used to pass arbitrary data into the custom visitor function. The value contained in the
|
||||
*data* attribute will be made available to the *visitor* and *filterVertices* functions in the *config.data*
|
||||
attribute.
|
||||
|
||||
When using a custom AQL function as a visitor, the result may have a different structure.
|
||||
By default, the result of the TRAVERSAL function is an array of traversed points. Each point
|
||||
is an object consisting of the following attributes:
|
||||
|
||||
- *vertex*: The vertex at the traversal point
|
||||
- *path*: The path history for the traversal point. The path is a document with the
|
||||
attributes *vertices* and *edges*, which are both arrays. Note that *path* is only present
|
||||
in the result if the *paths* attribute is set in the *options*
|
||||
|
||||
When using a custom AQL function as a visitor, the result may have a different structure.
|
||||
|
||||
|
||||
*Examples*
|
||||
|
@ -317,17 +322,17 @@ instead.
|
|||
data: { attributes: [ "_id", "_key", "name" ] }
|
||||
})
|
||||
|
||||
!SUBSECTION Traversal Tree
|
||||
*TRAVERSAL_TREE(vertexcollection, edgecollection, startVertex, direction, connectName, options)*:
|
||||
Traverses the graph described by *vertexcollection* and *edgecollection*,
|
||||
starting at the vertex identified by id *startVertex* and creates a hierarchical result.
|
||||
Vertex connectivity is establish by inserted an attribute which has the name specified via
|
||||
the *connectName* parameter. Connected vertices will be placed in this attribute as an
|
||||
array.
|
||||
|
||||
- *TRAVERSAL_TREE(vertexcollection, edgecollection, startVertex, direction, connectName, options)*:
|
||||
Traverses the graph described by *vertexcollection* and *edgecollection*,
|
||||
starting at the vertex identified by id *startVertex* and creates a hierarchical result.
|
||||
Vertex connectivity is establish by inserted an attribute which has the name specified via
|
||||
the *connectName* parameter. Connected vertices will be placed in this attribute as an
|
||||
array.
|
||||
|
||||
The *options* are the same as for the *TRAVERSAL* function, except that the result will
|
||||
be set up in a way that resembles a depth-first, pre-order visitation result. Thus, the
|
||||
*strategy* and *order* attributes of the *options* attribute will be ignored.
|
||||
The *options* are the same as for the *TRAVERSAL* function, except that the result will
|
||||
be set up in a way that resembles a depth-first, pre-order visitation result. Thus, the
|
||||
*strategy* and *order* attributes of the *options* attribute will be ignored.
|
||||
|
||||
*Examples*
|
||||
|
||||
|
@ -335,113 +340,113 @@ instead.
|
|||
itemOrder: "forward"
|
||||
})
|
||||
|
||||
!SUBSECTION Shortest Path
|
||||
*SHORTEST_PATH(vertexcollection, edgecollection, startVertex, endVertex, direction, options)*:
|
||||
Determines the first shortest path from the *startVertex* to the *endVertex*.
|
||||
Both vertices must be present in the vertex collection specified in *vertexcollection*,
|
||||
and any connecting edges must be present in the collection specified by *edgecollection*.
|
||||
Vertex connectivity is specified by the *direction* parameter:
|
||||
- *"outbound"*: Vertices are connected in *_from* to *_to* order
|
||||
- *"inbound"*: Vertices are connected in *_to* to *_from* order
|
||||
- *"any"*: Vertices are connected in both *_to* to *_from* and in
|
||||
*_from* to *_to* order
|
||||
The search is aborted when a shortest path is found. Only the first shortest path will be
|
||||
returned. Any vertex will be visited at most once by the search.
|
||||
|
||||
- *SHORTEST_PATH(vertexcollection, edgecollection, startVertex, endVertex, direction, options)*:
|
||||
Determines the first shortest path from the *startVertex* to the *endVertex*.
|
||||
Both vertices must be present in the vertex collection specified in *vertexcollection*,
|
||||
and any connecting edges must be present in the collection specified by *edgecollection*.
|
||||
Vertex connectivity is specified by the *direction* parameter:
|
||||
- *"outbound"*: Vertices are connected in *_from* to *_to* order
|
||||
- *"inbound"*: Vertices are connected in *_to* to *_from* order
|
||||
- *"any"*: Vertices are connected in both *_to* to *_from* and in
|
||||
*_from* to *_to* order
|
||||
The search is aborted when a shortest path is found. Only the first shortest path will be
|
||||
returned. Any vertex will be visited at most once by the search.
|
||||
Additional options for the shortest path can be provided via the *options* document:
|
||||
- *maxIterations*: Maximum number of iterations in the search. This number can be
|
||||
set to bound long-running searches. When a search performs as many iterations as the
|
||||
*maxIterations* value, the search will abort with an error. If *maxIterations* is not
|
||||
set, a server-defined value may be used.
|
||||
- *includeData*: Defines if the documents found on the path should be extracted or not.
|
||||
Default *false*, will only return the *\_id* values.
|
||||
- *distance*: This option can have two different types of values.
|
||||
It can either be the name of an attribute.
|
||||
If so this specific attribute will be examined on every edge on the path and will
|
||||
be used as a distance. In order to let this work properly you have to make sure
|
||||
to store only numerical values in this attribute. If the attribute is not present
|
||||
on any edge the value given in the *defaultDistance* option is used as a replacement.
|
||||
Using a distance attribute is only allowed in combination with *defaultDistance*.
|
||||
The second type of value for this option is a custom function with the following signature:
|
||||
|
||||
Additional options for the shortest path can be provided via the *options* document:
|
||||
- *maxIterations*: Maximum number of iterations in the search. This number can be
|
||||
set to bound long-running searches. When a search performs as many iterations as the
|
||||
*maxIterations* value, the search will abort with an error. If *maxIterations* is not
|
||||
set, a server-defined value may be used.
|
||||
- *includeData*: Defines if the documents found on the path should be extracted or not.
|
||||
Default *false*, will only return the *\_id* values.
|
||||
- *distance*: This option can have two different types of values.
|
||||
It can either be the name of an attribute.
|
||||
If so this specific attribute will be examined on every edge on the path and will
|
||||
be used as a distance. In order to let this work properly you have to make sure
|
||||
to store only numerical values in this attribute. If the attribute is not present
|
||||
on any edge the value given in the *defaultDistance* option is used as a replacement.
|
||||
Using a distance attribute is only allowed in combination with *defaultDistance*.
|
||||
The second type of value for this option is a custom function with the following signature:
|
||||
function (config, vertex1, vertex2, edge)
|
||||
|
||||
function (config, vertex1, vertex2, edge)
|
||||
Both vertices and the connecting edge will be passed into the function. The function
|
||||
is expected to return a numeric value that expresses the distance between the two
|
||||
vertices. Higher values will mean higher distances, giving the connection a lower
|
||||
priority in further analysis.
|
||||
If this options is not specified all vertices are assumed to have the
|
||||
same distance (1) to each other. If a function name is specified, it must have been
|
||||
registered as a regular user-defined AQL function.
|
||||
|
||||
Both vertices and the connecting edge will be passed into the function. The function
|
||||
is expected to return a numeric value that expresses the distance between the two
|
||||
vertices. Higher values will mean higher distances, giving the connection a lower
|
||||
priority in further analysis.
|
||||
If this options is not specified all vertices are assumed to have the
|
||||
same distance (1) to each other. If a function name is specified, it must have been
|
||||
registered as a regular user-defined AQL function.
|
||||
- *defaultDistance*: Only useful in combination with an attribute name given in *distance*.
|
||||
If any edge does not have the attribute required for *distance* the numeric value
|
||||
defined by this option is used.
|
||||
|
||||
- *defaultDistance*: Only useful in combination with an attribute name given in *distance*.
|
||||
If any edge does not have the attribute required for *distance* the numeric value
|
||||
defined by this option is used.
|
||||
- *followEdges*: An optional array of example edge documents that the search will
|
||||
expand into. If no examples are given, the search will follow all edges. If one
|
||||
or many edge examples are given, the search will only follow an edge if it matches
|
||||
at least one of the specified examples. *followEdges* can also be a string with the
|
||||
name of an AQL user-defined function that should be responsible for checking if an
|
||||
edge should be followed. In this case, the AQL function will is expected to have the
|
||||
following signature:
|
||||
|
||||
- *followEdges*: An optional array of example edge documents that the search will
|
||||
expand into. If no examples are given, the search will follow all edges. If one
|
||||
or many edge examples are given, the search will only follow an edge if it matches
|
||||
at least one of the specified examples. *followEdges* can also be a string with the
|
||||
name of an AQL user-defined function that should be responsible for checking if an
|
||||
edge should be followed. In this case, the AQL function will is expected to have the
|
||||
following signature:
|
||||
function (config, vertex, edge, path)
|
||||
|
||||
function (config, vertex, edge, path)
|
||||
The function is expected to return a boolean value. If it returns *true*, the edge
|
||||
will be followed. If *false* is returned, the edge will be ignored.
|
||||
|
||||
The function is expected to return a boolean value. If it returns *true*, the edge
|
||||
will be followed. If *false* is returned, the edge will be ignored.
|
||||
- *filterVertices*: An optional array of example vertex documents that the search will
|
||||
treat specially. If no examples are given, the search will handle all encountered
|
||||
vertices equally. If one or many vertex examples are given, the search will exclude
|
||||
the vertex from the result and/or not descend into it. Optionally, *filterVertices* can
|
||||
be a string containing the name of a user-defined AQL function that should be responsible
|
||||
for filtering. If so, the custom AQL function is expected to have the following signature:
|
||||
|
||||
- *filterVertices*: An optional array of example vertex documents that the search will
|
||||
treat specially. If no examples are given, the search will handle all encountered
|
||||
vertices equally. If one or many vertex examples are given, the search will exclude
|
||||
the vertex from the result and/or not descend into it. Optionally, *filterVertices* can
|
||||
be a string containing the name of a user-defined AQL function that should be responsible
|
||||
for filtering. If so, the custom AQL function is expected to have the following signature:
|
||||
function (config, vertex, path)
|
||||
|
||||
function (config, vertex, path)
|
||||
If a custom AQL function is used, it is expected to return one of the following values:
|
||||
|
||||
If a custom AQL function is used, it is expected to return one of the following values:
|
||||
- *[ ]*: Include the vertex in the result and descend into its connected edges
|
||||
- *[ "prune" ]*: Will include the vertex in the result but not descend into its connected edges
|
||||
- *[ "exclude" ]*: Will not include the vertex in the result but descend into its connected edges
|
||||
- *[ "prune", "exclude" ]*: Will completely ignore the vertex and its connected edges
|
||||
|
||||
- *[ ]*: Include the vertex in the result and descend into its connected edges
|
||||
- *[ "prune" ]*: Will include the vertex in the result but not descend into its connected edges
|
||||
- *[ "exclude" ]*: Will not include the vertex in the result but descend into its connected edges
|
||||
- *[ "prune", "exclude" ]*: Will completely ignore the vertex and its connected edges
|
||||
|
||||
- *visitor*: If specified, must be a string containing the name of a custom AQL function that
|
||||
will be called whenever the traversal visits a vertex. The custom AQL function is expected
|
||||
to have the following signature:
|
||||
- *visitor*: If specified, must be a string containing the name of a custom AQL function that
|
||||
will be called whenever the traversal visits a vertex. The custom AQL function is expected
|
||||
to have the following signature:
|
||||
|
||||
function (config, result, vertex, path, connections)
|
||||
function (config, result, vertex, path, connections)
|
||||
|
||||
There are two modes for custom AQL visitor functions, depending on the value of the option
|
||||
*visitorReturnsResults*. If it is set to *true*, then any value returned by the visitor will
|
||||
be appended to the list of results of the TRAVERSAL function. If *visitorReturnsResults* is
|
||||
set to *false*, then any value returned by the custom visitor function will be ignored.
|
||||
Instead, the visitor function is allowed to modify its *result* function parameter value
|
||||
in-place. The contents of this variable at the end of the traversal will then be the
|
||||
results of the TRAVERSAL function.
|
||||
There are two modes for custom AQL visitor functions, depending on the value of the option
|
||||
*visitorReturnsResults*. If it is set to *true*, then any value returned by the visitor will
|
||||
be appended to the list of results of the TRAVERSAL function. If *visitorReturnsResults* is
|
||||
set to *false*, then any value returned by the custom visitor function will be ignored.
|
||||
Instead, the visitor function is allowed to modify its *result* function parameter value
|
||||
in-place. The contents of this variable at the end of the traversal will then be the
|
||||
results of the TRAVERSAL function.
|
||||
|
||||
Note: The *connections* function parameter value will contain the edges connected to the
|
||||
vertex only if *order* was set to *preorder-expander*. Otherwise, the value of this parameter
|
||||
will be *undefined*.
|
||||
Note: The *connections* function parameter value will contain the edges connected to the
|
||||
vertex only if *order* was set to *preorder-expander*. Otherwise, the value of this parameter
|
||||
will be *undefined*.
|
||||
|
||||
- *visitorReturnsResults*: only useful in combination with a custom AQL visitor function. If
|
||||
set to *true*, the data returned by the visitor will be appended to the result. If set to
|
||||
*false*, any return value of the visitor function will be ignored. Instead, the visitor
|
||||
function can modify its *result* parameter value in-place. At the end of the traversal,
|
||||
*result* is expected to be an array.
|
||||
- *visitorReturnsResults*: only useful in combination with a custom AQL visitor function. If
|
||||
set to *true*, the data returned by the visitor will be appended to the result. If set to
|
||||
*false*, any return value of the visitor function will be ignored. Instead, the visitor
|
||||
function can modify its *result* parameter value in-place. At the end of the traversal,
|
||||
*result* is expected to be an array.
|
||||
|
||||
- *data*: only useful in combination with custom AQL visitor or filter functions. This attribute can
|
||||
be used to pass arbitrary data into the custom visitor function. The value contained in the
|
||||
*data* attribute will be made available to the *visitor* and *filterVertices* functions in the *config.data*
|
||||
attribute.
|
||||
- *data*: only useful in combination with custom AQL visitor or filter functions. This attribute can
|
||||
be used to pass arbitrary data into the custom visitor function. The value contained in the
|
||||
*data* attribute will be made available to the *visitor* and *filterVertices* functions in the *config.data*
|
||||
attribute.
|
||||
|
||||
By default, the result of the SHORTEST_PATH function is an object consisting of the following attributes:
|
||||
- *vertices*: The list of all vertices encountered on the path.
|
||||
- *edges*: The list of all edges encountered on the path.
|
||||
- *distance*: The total distance needed on this path. Using the given distance computation.
|
||||
By default, the result of the SHORTEST_PATH function is an object consisting of the following attributes:
|
||||
- *vertices*: The list of all vertices encountered on the path.
|
||||
- *edges*: The list of all edges encountered on the path.
|
||||
- *distance*: The total distance needed on this path. Using the given distance computation.
|
||||
|
||||
When using a custom AQL function as a visitor, the result may have a different structure.
|
||||
When using a custom AQL function as a visitor, the result may have a different structure.
|
||||
|
||||
|
||||
*Examples*
|
||||
|
@ -474,30 +479,30 @@ instead.
|
|||
return (edge.underConstruction === false); // don't follow these edges
|
||||
}, false);
|
||||
|
||||
|
||||
!SECTION Other functions
|
||||
|
||||
- *PATHS(vertexcollection, edgecollection, direction, options)*:
|
||||
returns an array of paths through the graph defined by the nodes in the collection
|
||||
*vertexcollection* and edges in the collection *edgecollection*. For each vertex
|
||||
in *vertexcollection*, it will determine the paths through the graph depending on the
|
||||
value of *direction*:
|
||||
- *"outbound"*: Follow all paths that start at the current vertex and lead to another vertex
|
||||
- *"inbound"*: Follow all paths that lead from another vertex to the current vertex
|
||||
- *"any"*: Combination of *"outbound"* and *"inbound"*
|
||||
The default value for *direction* is *"outbound"*.
|
||||
If specified, *options* must be a JavaScript object with the following optional attributes:
|
||||
- *minLength*: specifies the minimum length of the paths to be returned. The default is 0.
|
||||
- *maxLength*: specifies the maximum length of the paths to be returned. The default is 10.
|
||||
- *followcycles*: if true, cyclic paths will be followed as well. This is turned off by
|
||||
default.
|
||||
!SUBSECTION Paths
|
||||
*PATHS(vertexcollection, edgecollection, direction, options)*:
|
||||
returns an array of paths through the graph defined by the nodes in the collection
|
||||
*vertexcollection* and edges in the collection *edgecollection*. For each vertex
|
||||
in *vertexcollection*, it will determine the paths through the graph depending on the
|
||||
value of *direction*:
|
||||
- *"outbound"*: Follow all paths that start at the current vertex and lead to another vertex
|
||||
- *"inbound"*: Follow all paths that lead from another vertex to the current vertex
|
||||
- *"any"*: Combination of *"outbound"* and *"inbound"*
|
||||
The default value for *direction* is *"outbound"*.
|
||||
If specified, *options* must be a JavaScript object with the following optional attributes:
|
||||
- *minLength*: specifies the minimum length of the paths to be returned. The default is 0.
|
||||
- *maxLength*: specifies the maximum length of the paths to be returned. The default is 10.
|
||||
- *followcycles*: if true, cyclic paths will be followed as well. This is turned off by
|
||||
default.
|
||||
|
||||
The result of the function is an array of paths. Paths of length 0 will also be returned. Each
|
||||
path is a document consisting of the following attributes:
|
||||
- *vertices*: array of vertices visited along the path
|
||||
- *edges*: array of edges visited along the path (may be empty)
|
||||
- *source*: start vertex of path
|
||||
- *destination*: destination vertex of path
|
||||
The result of the function is an array of paths. Paths of length 0 will also be returned. Each
|
||||
path is a document consisting of the following attributes:
|
||||
- *vertices*: array of vertices visited along the path
|
||||
- *edges*: array of edges visited along the path (may be empty)
|
||||
- *source*: start vertex of path
|
||||
- *destination*: destination vertex of path
|
||||
|
||||
*Examples*
|
||||
|
||||
|
@ -507,6 +512,18 @@ instead.
|
|||
FILTER p.source._id == "users/123456"
|
||||
RETURN p.vertices[*].name
|
||||
|
||||
!SECTION Graph consistency
|
||||
When [using the graph management functions to remove vertices](../GeneralGraphs/Management.md#remove-a-vertex)
|
||||
you have the guaranty that all referencing edges are also removed.
|
||||
However, if you use document features alone to remove vertices, no edge collections will be adjusted.
|
||||
This results in an edge with its `_from` or `_to` attribute referring to vanished vertices.
|
||||
|
||||
Now we query such a graph using the [neighbors](#neighbors) or the [shortest path](#shortest-path) functions.
|
||||
If *includeData* wasn't enabled, the referred missing vertex will not be queried, and thus the result
|
||||
set will contain the referral to this missing vertex.
|
||||
If *includeData* is enabled, these missing vertices will be touched by the query.
|
||||
|
||||
In order to keep the result set consistent between *includeData* enabled or disabled, a `null` will be padded to fill the gap for each missing vertex.
|
||||
|
||||
!SECTION Performance notes
|
||||
|
||||
|
@ -525,3 +542,5 @@ process is specified by the optional *maxIterations* configuration value. If the
|
|||
vertices processed in a traversal reaches this cap will, the traversal will abort and throw
|
||||
a *too many iterations* exception.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
@startDocuBlock serverDefaultApi
|
||||
|
||||
|
||||
!SUBSECTION Hide Product header
|
||||
@startDocuBlock serverHideProductHeader
|
||||
|
||||
|
||||
!SUBSECTION Allow method override
|
||||
@startDocuBlock serverAllowMethod
|
||||
|
||||
|
|
|
@ -93,55 +93,55 @@ These collections are called orphan collections.
|
|||
If the graph is extended with an edge definition using one of the orphans,
|
||||
it will be removed from the set of orphan collection automatically.
|
||||
|
||||
!SUBSUBSECTION Add
|
||||
!SUBSUBSECTION Add a vertex collection
|
||||
|
||||
@startDocuBlock JSF_general_graph__addVertexCollection
|
||||
|
||||
!SUBSUBSECTION Get
|
||||
!SUBSUBSECTION Get the orphaned collections
|
||||
|
||||
@startDocuBlock JSF_general_graph__orphanCollections
|
||||
|
||||
!SUBSUBSECTION Remove
|
||||
!SUBSUBSECTION Remove a vertex collection
|
||||
|
||||
@startDocuBlock JSF_general_graph__removeVertexCollection
|
||||
|
||||
|
||||
!SECTION Vertex
|
||||
!SECTION Maniuplating Vertices
|
||||
|
||||
!SUBSECTION Save
|
||||
!SUBSECTION Save a vertex
|
||||
|
||||
@startDocuBlock JSF_general_graph_vertex_collection_save
|
||||
|
||||
!SUBSECTION Replace
|
||||
!SUBSECTION Replace a vertex
|
||||
|
||||
@startDocuBlock JSF_general_graph_vertex_collection_replace
|
||||
|
||||
!SUBSECTION Update
|
||||
!SUBSECTION Update a vertex
|
||||
|
||||
@startDocuBlock JSF_general_graph_vertex_collection_update
|
||||
|
||||
!SUBSECTION Remove
|
||||
!SUBSECTION Remove a vertex
|
||||
|
||||
@startDocuBlock JSF_general_graph_vertex_collection_remove
|
||||
|
||||
!SECTION Edge
|
||||
!SECTION Manipulating Edges
|
||||
|
||||
!SUBSECTION Save
|
||||
!SUBSECTION Save a new edge
|
||||
|
||||
@startDocuBlock JSF_general_graph_edge_collection_save
|
||||
|
||||
!SUBSECTION Replace
|
||||
!SUBSECTION Replace an edge
|
||||
|
||||
@startDocuBlock JSF_general_graph_edge_collection_replace
|
||||
|
||||
!SUBSECTION Update
|
||||
!SUBSECTION Update an edge
|
||||
|
||||
@startDocuBlock JSF_general_graph_edge_collection_update
|
||||
|
||||
!SUBSECTION Remove
|
||||
!SUBSECTION Remove an edge
|
||||
|
||||
@startDocuBlock JSF_general_graph_edge_collection_remove
|
||||
|
||||
!SUBSECTION Connect
|
||||
!SUBSECTION Connect edges
|
||||
|
||||
@startDocuBlock JSF_general_graph_connectingEdges
|
||||
@startDocuBlock JSF_general_graph_connectingEdges
|
||||
|
|
21
GNUmakefile
21
GNUmakefile
|
@ -98,7 +98,9 @@ pack-dmg:
|
|||
rm -rf Build && mkdir Build
|
||||
|
||||
./configure \
|
||||
--prefix=/opt/arangodb
|
||||
--prefix=/opt/arangodb \
|
||||
CPPFLAGS="-I`brew --prefix`/opt/openssl/include" \
|
||||
LDFLAGS="-L`brew --prefix`/opt/openssl/lib"
|
||||
|
||||
${MAKE} pack-dmg-cmake
|
||||
|
||||
|
@ -111,6 +113,9 @@ pack-dmg-cmake:
|
|||
-D "CPACK_PACKAGE_VERSION_MINOR=${VERSION_MINOR}" \
|
||||
-D "CPACK_PACKAGE_VERSION_PATCH=${VERSION_PATCH}" \
|
||||
-D "LIBEV_VERSION=${LIBEV_VERSION}" \
|
||||
-D "OPENSSL_INCLUDE=`brew --prefix`/opt/openssl/include" \
|
||||
-D "OPENSSL_LIB_PATH=`brew --prefix`/opt/openssl/lib" \
|
||||
-D "OPENSSL_LIBS=`brew --prefix`/opt/openssl/lib/libssl.a;`brew --prefix`/opt/openssl/lib/libcrypto.a" \
|
||||
-D "V8_VERSION=${V8_VERSION}" \
|
||||
-D "ZLIB_VERSION=${ZLIB_VERSION}" \
|
||||
..
|
||||
|
@ -145,7 +150,9 @@ pack-macosxcode:
|
|||
rm -rf Build && mkdir Build
|
||||
|
||||
./configure \
|
||||
--prefix=/opt/arangodb
|
||||
--prefix=/opt/arangodb \
|
||||
CPPFLAGS="-I`brew --prefix`/opt/openssl/include" \
|
||||
LDFLAGS="-L`brew --prefix`/opt/openssl/lib"
|
||||
|
||||
${MAKE} -f GNUMakefile pack-macosxcode-cmake MOREOPTS='$(MOREOPTS)'
|
||||
|
||||
|
@ -159,6 +166,9 @@ pack-macosxcode-cmake:
|
|||
-D "CPACK_PACKAGE_VERSION_MINOR=${VERSION_MINOR}" \
|
||||
-D "CPACK_PACKAGE_VERSION_PATCH=${VERSION_PATCH}" \
|
||||
-D "LIBEV_VERSION=${LIBEV_VERSION}" \
|
||||
-D "OPENSSL_INCLUDE=`brew --prefix`/opt/openssl/include" \
|
||||
-D "OPENSSL_LIB_PATH=`brew --prefix`/opt/openssl/lib" \
|
||||
-D "OPENSSL_LIBS=`brew --prefix`/opt/openssl/lib/libssl.a;`brew --prefix`/opt/openssl/lib/libcrypto.a" \
|
||||
-D "V8_VERSION=${V8_VERSION}" \
|
||||
-D "ZLIB_VERSION=${ZLIB_VERSION}" \
|
||||
-G Xcode \
|
||||
|
@ -180,7 +190,9 @@ pack-macosx:
|
|||
rm -rf Build && mkdir Build
|
||||
|
||||
./configure \
|
||||
--prefix=/opt/arangodb
|
||||
--prefix=/opt/arangodb \
|
||||
CPPFLAGS="-I`brew --prefix`/opt/openssl/include" \
|
||||
LDFLAGS="-L`brew --prefix`/opt/openssl/lib"
|
||||
|
||||
${MAKE} pack-macosx-cmake MOREOPTS='$(MOREOPTS)'
|
||||
|
||||
|
@ -193,6 +205,9 @@ pack-macosx-cmake:
|
|||
-D "CPACK_PACKAGE_VERSION_MINOR=${VERSION_MINOR}" \
|
||||
-D "CPACK_PACKAGE_VERSION_PATCH=${VERSION_PATCH}" \
|
||||
-D "LIBEV_VERSION=${LIBEV_VERSION}" \
|
||||
-D "OPENSSL_INCLUDE=`brew --prefix`/opt/openssl/include" \
|
||||
-D "OPENSSL_LIB_PATH=`brew --prefix`/opt/openssl/lib" \
|
||||
-D "OPENSSL_LIBS=`brew --prefix`/opt/openssl/lib/libssl.a;`brew --prefix`/opt/openssl/lib/libcrypto.a" \
|
||||
-D "V8_VERSION=${V8_VERSION}" \
|
||||
-D "ZLIB_VERSION=${ZLIB_VERSION}" \
|
||||
$(MOREOPTS) \
|
||||
|
|
|
@ -253,15 +253,16 @@ CLEANUP += @srcdir@/.file-list-js
|
|||
### @brief /var data
|
||||
################################################################################
|
||||
|
||||
#if ENABLE_RELATIVE
|
||||
#else
|
||||
|
||||
install-data-local:
|
||||
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb
|
||||
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb-apps || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb-apps
|
||||
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/log/arangodb || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/log/arangodb
|
||||
|
||||
#endif
|
||||
################################################################################
|
||||
### @brief /doc
|
||||
################################################################################
|
||||
|
||||
dist_doc_DATA = README README.md LICENSE LICENSES-OTHER-COMPONENTS.md
|
||||
|
||||
################################################################################
|
||||
### @brief symbolic links
|
||||
|
|
|
@ -156,7 +156,7 @@ describe ArangoDB do
|
|||
|
||||
# run a HTTP HEAD query on the existing document, with wrong precondition
|
||||
cmd = "/_api/document/" + did
|
||||
doc = ArangoDB.log_head("#{prefix}-head-check-documentq", cmd, :header => { :"if-match" => "1" })
|
||||
doc = ArangoDB.log_head("#{prefix}-head-check-document", cmd, :header => { :"if-match" => "1" })
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.response.body.should be_nil
|
||||
|
|
|
@ -2292,10 +2292,18 @@ AqlValue Functions::Neighbors (triagens::aql::Query* query,
|
|||
}
|
||||
|
||||
std::string const collectionName = vertexId.substr(0, split);
|
||||
if (collectionName.compare(vColName) != 0) {
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_GRAPH_INVALID_PARAMETER,
|
||||
"you specified vertex collection `%s` for start vertext from `%s`",
|
||||
vColName.c_str(),
|
||||
collectionName.c_str());
|
||||
}
|
||||
auto coli = resolver->getCollectionStruct(collectionName);
|
||||
|
||||
if (coli == nullptr || collectionName.compare(vColName) != 0) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
if (coli == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"`%s`",
|
||||
collectionName.c_str());
|
||||
}
|
||||
|
||||
VertexId v(coli->_cid, const_cast<char*>(str + split + 1));
|
||||
|
@ -2320,10 +2328,18 @@ AqlValue Functions::Neighbors (triagens::aql::Query* query,
|
|||
}
|
||||
|
||||
std::string const collectionName = vertexId.substr(0, split);
|
||||
if (collectionName.compare(vColName) != 0) {
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_GRAPH_INVALID_PARAMETER,
|
||||
"you specified vertex collection `%s` for start vertext from `%s`",
|
||||
vColName.c_str(),
|
||||
collectionName.c_str());
|
||||
}
|
||||
auto coli = resolver->getCollectionStruct(collectionName);
|
||||
|
||||
if (coli == nullptr || collectionName.compare(vColName) != 0) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
if (coli == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"`%s`",
|
||||
collectionName.c_str());
|
||||
}
|
||||
|
||||
VertexId v(coli->_cid, const_cast<char*>(str + split + 1));
|
||||
|
@ -2512,21 +2528,25 @@ AqlValue Functions::Near (triagens::aql::Query* query,
|
|||
true,
|
||||
true);
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION(res);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(res, "`%s`", colName.c_str());
|
||||
}
|
||||
|
||||
TRI_EnsureCollectionsTransaction(trx->getInternals());
|
||||
collection = trx->trxCollection(cid);
|
||||
|
||||
if (collection == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"`%s`",
|
||||
colName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
auto document = trx->documentCollection(cid);
|
||||
|
||||
if (document == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"`%s`",
|
||||
colName.c_str());
|
||||
}
|
||||
|
||||
triagens::arango::Index* index = nullptr;
|
||||
|
@ -2678,21 +2698,23 @@ AqlValue Functions::Within (triagens::aql::Query* query,
|
|||
true,
|
||||
true);
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION(res);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(res, "`%s`", colName.c_str());
|
||||
}
|
||||
|
||||
TRI_EnsureCollectionsTransaction(trx->getInternals());
|
||||
collection = trx->trxCollection(cid);
|
||||
|
||||
if (collection == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"`%s`",
|
||||
colName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
auto document = trx->documentCollection(cid);
|
||||
|
||||
if (document == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND); /// TODO
|
||||
}
|
||||
|
||||
triagens::arango::Index* index = nullptr;
|
||||
|
@ -2965,7 +2987,9 @@ static void RegisterCollectionInTransaction (triagens::arango::AqlTransaction* t
|
|||
TRI_ASSERT(collection == nullptr);
|
||||
cid = trx->resolver()->getCollectionId(collectionName);
|
||||
if (cid == 0) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"`%s`",
|
||||
collectionName.c_str());
|
||||
}
|
||||
// ensure the collection is loaded
|
||||
collection = trx->trxCollection(cid);
|
||||
|
@ -2978,7 +3002,7 @@ static void RegisterCollectionInTransaction (triagens::arango::AqlTransaction* t
|
|||
true,
|
||||
true);
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION(res);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(res, "`%s`", collectionName.c_str());
|
||||
}
|
||||
TRI_EnsureCollectionsTransaction(trx->getInternals());
|
||||
collection = trx->trxCollection(cid);
|
||||
|
@ -3219,7 +3243,9 @@ AqlValue Functions::Edges (triagens::aql::Query* query,
|
|||
|
||||
TRI_voc_cid_t startCid = resolver->getCollectionId(parts[0]);
|
||||
if (startCid == 0) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"`%s`",
|
||||
parts[0].c_str());
|
||||
}
|
||||
|
||||
char* key = const_cast<char*>(parts[1].c_str());
|
||||
|
|
|
@ -285,7 +285,7 @@ void RestSimpleHandler::removeByKeys (TRI_json_t const* json) {
|
|||
{
|
||||
auto const* value = TRI_LookupObjectJson(json, "options");
|
||||
if (TRI_IsObjectJson(value)) {
|
||||
value = TRI_LookupObjectJson(json, "waitForSync");
|
||||
value = TRI_LookupObjectJson(value, "waitForSync");
|
||||
if (TRI_IsBooleanJson(value)) {
|
||||
waitForSync = value->_value._boolean;
|
||||
}
|
||||
|
|
|
@ -601,6 +601,7 @@ void ArangoServer::buildApplicationServer () {
|
|||
("server.allow-use-database", &ALLOW_USE_DATABASE_IN_REST_ACTIONS, "allow change of database in REST actions, only needed for unittests")
|
||||
("server.threads", &_dispatcherThreads, "number of threads for basic operations")
|
||||
("server.additional-threads", &_additionalThreads, "number of threads in additional queues")
|
||||
("server.hide-product-header", &HttpResponse::HideProductHeader, "do not expose \"Server: ArangoDB\" header in HTTP responses")
|
||||
("server.foxx-queues", &_foxxQueues, "enable Foxx queues")
|
||||
("server.foxx-queues-poll-interval", &_foxxQueuesPollInterval, "Foxx queue manager poll interval (in seconds)")
|
||||
("server.session-timeout", &VocbaseContext::ServerSessionTtl, "timeout of web interface server sessions (in seconds)")
|
||||
|
|
|
@ -604,7 +604,7 @@ namespace triagens {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool _foxxQueues;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief poll interval for Foxx queues
|
||||
/// @startDocuBlock foxxQueuesPollInterval
|
||||
|
|
|
@ -1728,7 +1728,7 @@ static bool RunScripts (v8::Isolate* isolate,
|
|||
current->ForceSet(TRI_V8_ASCII_STRING("__dirname"), TRI_V8_STRING(dirname));
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, dirname);
|
||||
|
||||
TRI_ExecuteGlobalJavaScriptFile(isolate, scripts[i].c_str());
|
||||
ok = TRI_ExecuteGlobalJavaScriptFile(isolate, scripts[i].c_str());
|
||||
|
||||
// restore old values for __dirname and __filename
|
||||
if (oldFilename.IsEmpty() || oldFilename->IsUndefined()) {
|
||||
|
@ -1757,6 +1757,9 @@ static bool RunScripts (v8::Isolate* isolate,
|
|||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (!ok) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BaseClient.flushLog();
|
||||
|
|
|
@ -148,9 +148,6 @@ case $target in
|
|||
armv7l-*-linux-gnueabihf)
|
||||
tr_ARM="yes"
|
||||
tr_ARM7="yes"
|
||||
CFLAGS="$CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS"
|
||||
;;
|
||||
|
||||
armv6l-*-linux-gnueabihf)
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -7697,7 +7697,7 @@ var lessons = [
|
|||
},
|
||||
{
|
||||
title: "Creating Documents",
|
||||
text: "Now we have a collection, but it is still empty. So let's create some documents!\n\n" +
|
||||
text: "Now we have a collection, but it is empty. So let's create some documents!\n\n" +
|
||||
" db.places.save({ _key : \"foo\", city : \"foo-city\" });\n" +
|
||||
" for (i = 0; i <= 10; i++) { db.places.save({ _key: \"example\" + i, zipcode: i }) };"
|
||||
},
|
||||
|
@ -21639,7 +21639,7 @@ global.aqlQuery = function () {
|
|||
for (i = 1; i < arguments.length; i++) {
|
||||
value = arguments[i];
|
||||
name = 'value' + (i - 1);
|
||||
if (value.constructor && value.constructor.name === 'ArangoCollection') {
|
||||
if (value && value.constructor && value.constructor.name === 'ArangoCollection') {
|
||||
name = '@' + name;
|
||||
value = value.name();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<script src="sharedLibs.js?version=1446219679364"></script>
|
||||
<script src="libs.js?version=1446219679364"></script>
|
||||
<script src="app.js?version=1446219679364"></script>
|
||||
<script src="sharedLibs.js?version=1446837686877"></script>
|
||||
<script src="libs.js?version=1446837686877"></script>
|
||||
<script src="app.js?version=1446837686877"></script>
|
||||
|
|
|
@ -2290,6 +2290,10 @@ if (list.length > 0) {
|
|||
</div>
|
||||
|
||||
<div id="aqlEditor" class='aql-editor'></div>
|
||||
<div id="varsEditorHeader" class='vars-editor-header'>Bind parameters:
|
||||
<i title='Example: </br> { </br>"@collection": "mycollection", </br>"key": "testkey"</br> } </br> Use bind parameters with @@collection and @key in your query' class="fa fa-info-circle"></i>
|
||||
</div>
|
||||
<div id="varsEditor" class='vars-editor'></div>
|
||||
|
||||
|
||||
<div id="wideButtonDiv" class="wide-button-div">
|
||||
|
@ -2612,4 +2616,4 @@ var cutByResolution = function (str) {
|
|||
<% }); %>
|
||||
</ul>
|
||||
</div>
|
||||
<% } %></script></head><body><nav class="navbar"><div class="resizecontainer"><div class="navlogo"><a class="logo" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a></div><div id="progressPlaceholderIcon"></div><div class="statmenu" id="statisticBar"></div><div class="usermenu" id="userBar" style="float:right"></div><div class="notificationmenu" id="notificationBar" style="float:right"></div><div class="navmenu" id="navigationBar"></div></div></nav><div class="centralRow resizecontainer"><div id="content" class="centralContent"></div></div><div id="modalPlaceholder"></div><div id="progressPlaceholder" style="display:none"></div><footer class="footer"><div class="resizecontainer" id="footerBar"></div></footer><script src="sharedLibs.js?version=1446219679364"></script><script src="libs.js?version=1446219679364"></script><script src="app.js?version=1446219679364"></script></body></html>
|
||||
<% } %></script></head><body><nav class="navbar"><div class="resizecontainer"><div class="navlogo"><a class="logo" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a></div><div id="progressPlaceholderIcon"></div><div class="statmenu" id="statisticBar"></div><div class="usermenu" id="userBar" style="float:right"></div><div class="notificationmenu" id="notificationBar" style="float:right"></div><div class="navmenu" id="navigationBar"></div></div></nav><div class="centralRow resizecontainer"><div id="content" class="centralContent"></div></div><div id="modalPlaceholder"></div><div id="progressPlaceholder" style="display:none"></div><footer class="footer"><div class="resizecontainer" id="footerBar"></div></footer><script src="sharedLibs.js?version=1446837686877"></script><script src="libs.js?version=1446837686877"></script><script src="app.js?version=1446837686877"></script></body></html>
|
Binary file not shown.
|
@ -2467,6 +2467,10 @@ if (list.length > 0) {
|
|||
</div>
|
||||
|
||||
<div id="aqlEditor" class='aql-editor'></div>
|
||||
<div id="varsEditorHeader" class='vars-editor-header'>Bind parameters:
|
||||
<i title='Example: </br> { </br>"@collection": "mycollection", </br>"key": "testkey"</br> } </br> Use bind parameters with @@collection and @key in your query' class="fa fa-info-circle"></i>
|
||||
</div>
|
||||
<div id="varsEditor" class='vars-editor'></div>
|
||||
|
||||
|
||||
<div id="wideButtonDiv" class="wide-button-div">
|
||||
|
@ -2859,9 +2863,9 @@ var cutByResolution = function (str) {
|
|||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="sharedLibs.js?version=1446219679364"></script>
|
||||
<script src="libs.js?version=1446219679364"></script>
|
||||
<script src="app.js?version=1446219679364"></script>
|
||||
<script src="sharedLibs.js?version=1446837686877"></script>
|
||||
<script src="libs.js?version=1446837686877"></script>
|
||||
<script src="app.js?version=1446837686877"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -6199,7 +6199,25 @@ toolbar {
|
|||
.queryMethods button a {
|
||||
color: #fff; }
|
||||
|
||||
.aql-editor {
|
||||
.vars-editor-header {
|
||||
border-top: 1px solid rgba(140, 138, 137, 0.25);
|
||||
margin-top: -5px;
|
||||
padding-left: 5px; }
|
||||
.vars-editor-header i {
|
||||
border-radius: 2px;
|
||||
color: #666;
|
||||
height: 15px;
|
||||
margin-left: 5px;
|
||||
padding-left: 3px;
|
||||
padding-top: 1px;
|
||||
width: 15px; }
|
||||
.vars-editor-header i:hover {
|
||||
background-color: #8aa051;
|
||||
color: #fff;
|
||||
cursor: pointer; }
|
||||
|
||||
.aql-editor,
|
||||
.vars-editor {
|
||||
border-color: #a0a0a0;
|
||||
border-left: 0 !important;
|
||||
border-top: 1px solid rgba(140, 138, 137, 0.25) !important;
|
||||
|
@ -6209,7 +6227,9 @@ toolbar {
|
|||
min-width: 99.8%;
|
||||
width: auto; }
|
||||
.aql-editor .ace_error,
|
||||
.aql-editor .ace_info {
|
||||
.aql-editor .ace_info,
|
||||
.vars-editor .ace_error,
|
||||
.vars-editor .ace_info {
|
||||
background: none; }
|
||||
|
||||
.queryTH {
|
||||
|
@ -6424,7 +6444,8 @@ toolbar {
|
|||
position: relative;
|
||||
top: 0;
|
||||
width: 25px; }
|
||||
.editor-toolbar span:hover {
|
||||
.editor-toolbar span:hover,
|
||||
.editor-toolbar .vars-editor-header i {
|
||||
background-color: #8aa051;
|
||||
color: #fff; }
|
||||
.editor-toolbar i {
|
||||
|
@ -6433,11 +6454,13 @@ toolbar {
|
|||
.editor-toolbar i:hover {
|
||||
cursor: pointer; }
|
||||
.editor-toolbar .fa {
|
||||
color: #666;
|
||||
margin-left: 1px;
|
||||
margin-top: 2px; }
|
||||
.editor-toolbar .fa.fa-upload {
|
||||
margin-top: 1px; }
|
||||
.editor-toolbar .icon_arangodb {
|
||||
color: #666;
|
||||
font-size: 14pt; }
|
||||
.editor-toolbar .icon_arangodb:first-child {
|
||||
margin-right: 10px; }
|
||||
|
|
Binary file not shown.
|
@ -53,8 +53,10 @@
|
|||
var queries = [];
|
||||
|
||||
this.each(function(query) {
|
||||
console.log(query.attributes);
|
||||
queries.push({
|
||||
value: query.attributes.value,
|
||||
parameter: query.attributes.parameter,
|
||||
name: query.attributes.name
|
||||
});
|
||||
});
|
||||
|
@ -100,6 +102,7 @@
|
|||
processData: false,
|
||||
success: function() {
|
||||
window.progressView.hide();
|
||||
arangoHelper.arangoNotification("Queries successfully imported.");
|
||||
callback();
|
||||
},
|
||||
error: function() {
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
</div>
|
||||
|
||||
<div id="aqlEditor" class='aql-editor'></div>
|
||||
<div id="varsEditorHeader" class='vars-editor-header'>Bind parameters:
|
||||
<i title='Example: </br> { </br>"@collection": "mycollection", </br>"key": "testkey"</br> } </br> Use bind parameters with @@collection and @key in your query' class="fa fa-info-circle"></i>
|
||||
</div>
|
||||
<div id="varsEditor" class='vars-editor'></div>
|
||||
|
||||
|
||||
<div id="wideButtonDiv" class="wide-button-div">
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
"click #result-switch": "switchTab",
|
||||
"click #query-switch": "switchTab",
|
||||
'click #customs-switch': "switchTab",
|
||||
// 'click #explain-switch': "switchTab",
|
||||
'click #submitQueryButton': 'submitQuery',
|
||||
'click #explainQueryButton': 'explainQuery',
|
||||
'click #commentText': 'commentText',
|
||||
|
@ -87,6 +86,9 @@
|
|||
_.each(this.tableDescription.rows, function(k) {
|
||||
k.thirdRow = '<a class="deleteButton"><span class="icon_arangodb_roundminus"' +
|
||||
' title="Delete query"></span></a>';
|
||||
if (k.hasOwnProperty('parameter')) {
|
||||
delete k.parameter;
|
||||
}
|
||||
});
|
||||
|
||||
// escape all columns but the third (which contains HTML)
|
||||
|
@ -96,9 +98,12 @@
|
|||
},
|
||||
|
||||
editCustomQuery: function(e) {
|
||||
var queryName = $(e.target).parent().children().first().text();
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var queryName = $(e.target).parent().children().first().text(),
|
||||
inputEditor = ace.edit("aqlEditor"),
|
||||
varsEditor = ace.edit("varsEditor");
|
||||
inputEditor.setValue(this.getCustomQueryValueByName(queryName));
|
||||
varsEditor.setValue(this.getCustomQueryParameterByName(queryName));
|
||||
this.deselect(varsEditor);
|
||||
this.deselect(inputEditor);
|
||||
$('#querySelect').val(queryName);
|
||||
this.switchTab("query-switch");
|
||||
|
@ -147,9 +152,11 @@
|
|||
},
|
||||
|
||||
clearInput: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
this.setCachedQuery(inputEditor.getValue());
|
||||
var inputEditor = ace.edit("aqlEditor"),
|
||||
varsEditor = ace.edit("varsEditor");
|
||||
this.setCachedQuery(inputEditor.getValue(), varsEditor.getValue());
|
||||
inputEditor.setValue('');
|
||||
varsEditor.setValue('');
|
||||
},
|
||||
|
||||
smallOutput: function () {
|
||||
|
@ -176,7 +183,6 @@
|
|||
|
||||
customQueries: [],
|
||||
|
||||
|
||||
tableDescription: {
|
||||
id: "arangoQueryTable",
|
||||
titles: ["Name", "Content", ""],
|
||||
|
@ -220,17 +226,34 @@
|
|||
multiSelectAction: "forEach"
|
||||
});
|
||||
|
||||
var varsEditor = ace.edit("varsEditor");
|
||||
varsEditor.getSession().setMode("ace/mode/aql");
|
||||
varsEditor.setFontSize("13px");
|
||||
varsEditor.commands.addCommand({
|
||||
name: "togglecomment",
|
||||
bindKey: {win: "Ctrl-Shift-C", linux: "Ctrl-Shift-C", mac: "Command-Shift-C"},
|
||||
exec: function (editor) {
|
||||
editor.toggleCommentLines();
|
||||
},
|
||||
multiSelectAction: "forEach"
|
||||
});
|
||||
|
||||
//get cached query if available
|
||||
var query = this.getCachedQuery();
|
||||
if (query !== null && query !== undefined && query !== "") {
|
||||
inputEditor.setValue(query);
|
||||
var queryObject = this.getCachedQuery();
|
||||
if (queryObject !== null && queryObject !== undefined && queryObject !== "") {
|
||||
inputEditor.setValue(queryObject.query);
|
||||
if (queryObject.parameter === '' || queryObject === undefined) {
|
||||
varsEditor.setValue('{}');
|
||||
}
|
||||
else {
|
||||
varsEditor.setValue(queryObject.parameter);
|
||||
}
|
||||
}
|
||||
|
||||
inputEditor.getSession().selection.on('changeCursor', function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var session = inputEditor.getSession();
|
||||
var cursor = inputEditor.getCursorPosition();
|
||||
var token = session.getTokenAt(cursor.row, cursor.column);
|
||||
var changedFunction = function() {
|
||||
var session = inputEditor.getSession(),
|
||||
cursor = inputEditor.getCursorPosition(),
|
||||
token = session.getTokenAt(cursor.row, cursor.column);
|
||||
if (token) {
|
||||
if (token.type === "comment") {
|
||||
$("#commentText i")
|
||||
|
@ -245,8 +268,27 @@
|
|||
}
|
||||
}
|
||||
//cache query in localstorage
|
||||
self.setCachedQuery(inputEditor.getValue());
|
||||
var a = inputEditor.getValue(),
|
||||
b = varsEditor.getValue();
|
||||
|
||||
if (a.length === 1) {
|
||||
a = "";
|
||||
}
|
||||
if (b.length === 1) {
|
||||
b = "";
|
||||
}
|
||||
|
||||
self.setCachedQuery(a, b);
|
||||
};
|
||||
|
||||
inputEditor.getSession().selection.on('changeCursor', function () {
|
||||
changedFunction();
|
||||
});
|
||||
|
||||
varsEditor.getSession().selection.on('changeCursor', function () {
|
||||
changedFunction();
|
||||
});
|
||||
|
||||
$('#queryOutput').resizable({
|
||||
handles: "s",
|
||||
ghost: true,
|
||||
|
@ -258,12 +300,13 @@
|
|||
}
|
||||
});
|
||||
|
||||
arangoHelper.fixTooltips(".queryTooltips, .icon_arangodb", "top");
|
||||
arangoHelper.fixTooltips(".vars-editor-header i, .queryTooltips, .icon_arangodb", "top");
|
||||
|
||||
$('#aqlEditor .ace_text-input').focus();
|
||||
|
||||
var windowHeight = $(window).height() - 295;
|
||||
$('#aqlEditor').height(windowHeight - 19);
|
||||
$('#aqlEditor').height(windowHeight - 100 - 29);
|
||||
$('#varsEditor').height(100);
|
||||
$('#queryOutput').height(windowHeight);
|
||||
|
||||
inputEditor.resize();
|
||||
|
@ -271,6 +314,7 @@
|
|||
|
||||
this.initTabArray();
|
||||
this.renderSelectboxes();
|
||||
this.deselect(varsEditor);
|
||||
this.deselect(outputEditor);
|
||||
this.deselect(inputEditor);
|
||||
|
||||
|
@ -294,9 +338,13 @@
|
|||
}
|
||||
},
|
||||
|
||||
setCachedQuery: function(query) {
|
||||
if(typeof(Storage) !== "undefined") {
|
||||
localStorage.setItem("cachedQuery", JSON.stringify(query));
|
||||
setCachedQuery: function(query, vars) {
|
||||
if (typeof(Storage) !== "undefined") {
|
||||
var myObject = {
|
||||
query: query,
|
||||
parameter: vars
|
||||
};
|
||||
localStorage.setItem("cachedQuery", JSON.stringify(myObject));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -345,7 +393,7 @@
|
|||
exportCustomQueries: function () {
|
||||
var name, toExport = {}, exportArray = [];
|
||||
_.each(this.customQueries, function(value, key) {
|
||||
exportArray.push({name: value.name, value: value.value});
|
||||
exportArray.push({name: value.name, value: value.value, parameter: value.parameter});
|
||||
});
|
||||
toExport = {
|
||||
"extra": {
|
||||
|
@ -446,7 +494,8 @@
|
|||
this.collection.each(function(model) {
|
||||
self.customQueries.push({
|
||||
name: model.get("name"),
|
||||
value: model.get("value")
|
||||
value: model.get("value"),
|
||||
parameter: model.get("parameter")
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -457,8 +506,10 @@
|
|||
//update queries first, before writing
|
||||
this.refreshAQL();
|
||||
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var saveName = $('#new-query-name').val();
|
||||
var inputEditor = ace.edit("aqlEditor"),
|
||||
varsEditor = ace.edit("varsEditor"),
|
||||
saveName = $('#new-query-name').val(),
|
||||
bindVars = varsEditor.getValue();
|
||||
|
||||
if ($('#new-query-name').hasClass('invalid-input')) {
|
||||
return;
|
||||
|
@ -469,9 +520,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var content = inputEditor.getValue();
|
||||
var content = inputEditor.getValue(),
|
||||
//check for already existing entry
|
||||
var quit = false;
|
||||
quit = false;
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (v.name === saveName) {
|
||||
v.value = content;
|
||||
|
@ -482,14 +533,21 @@
|
|||
|
||||
if (quit === true) {
|
||||
//Heiko: Form-Validator - name already taken
|
||||
window.modalView.hide();
|
||||
return;
|
||||
// Update model and save
|
||||
this.collection.findWhere({name: saveName}).set("value", content);
|
||||
}
|
||||
else {
|
||||
if (bindVars === '' || bindVars === undefined) {
|
||||
bindVars = '{}';
|
||||
}
|
||||
|
||||
this.collection.add({
|
||||
name: saveName,
|
||||
parameter: bindVars,
|
||||
value: content
|
||||
});
|
||||
}
|
||||
|
||||
this.collection.add({
|
||||
name: saveName,
|
||||
value: content
|
||||
});
|
||||
this.collection.saveCollectionQueries();
|
||||
|
||||
window.modalView.hide();
|
||||
|
@ -518,13 +576,11 @@
|
|||
},
|
||||
|
||||
getCustomQueryValueByName: function (qName) {
|
||||
var returnVal;
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (qName === v.name) {
|
||||
returnVal = v.value;
|
||||
}
|
||||
});
|
||||
return returnVal;
|
||||
return this.collection.findWhere({name: qName}).get("value");
|
||||
},
|
||||
|
||||
getCustomQueryParameterByName: function (qName) {
|
||||
return this.collection.findWhere({name: qName}).get("parameter");
|
||||
},
|
||||
|
||||
refreshAQL: function(select) {
|
||||
|
@ -540,7 +596,8 @@
|
|||
},
|
||||
|
||||
importSelected: function (e) {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var inputEditor = ace.edit("aqlEditor"),
|
||||
varsEditor = ace.edit("varsEditor");
|
||||
$.each(this.queries, function (k, v) {
|
||||
if ($('#' + e.currentTarget.id).val() === v.name) {
|
||||
inputEditor.setValue(v.value);
|
||||
|
@ -549,6 +606,16 @@
|
|||
$.each(this.customQueries, function (k, v) {
|
||||
if ($('#' + e.currentTarget.id).val() === v.name) {
|
||||
inputEditor.setValue(v.value);
|
||||
|
||||
if (v.hasOwnProperty('parameter')) {
|
||||
if (v.parameter === '' || v.parameter === undefined) {
|
||||
v.parameter = '{}';
|
||||
}
|
||||
varsEditor.setValue(v.parameter);
|
||||
}
|
||||
else {
|
||||
varsEditor.setValue('{}');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -593,23 +660,9 @@
|
|||
this.customQueries = _.sortBy(this.customQueries, 'name');
|
||||
},
|
||||
|
||||
abortQuery: function () {
|
||||
/*
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/_api/cursor/currentFrontendQuery",
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
},
|
||||
error: function (data) {
|
||||
}
|
||||
});
|
||||
*/
|
||||
},
|
||||
|
||||
readQueryData: function() {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var varsEditor = ace.edit("varsEditor");
|
||||
var selectedText = inputEditor.session.getTextRange(inputEditor.getSelectionRange());
|
||||
var sizeBox = $('#querySize');
|
||||
var data = {
|
||||
|
@ -617,6 +670,19 @@
|
|||
batchSize: parseInt(sizeBox.val(), 10),
|
||||
id: "currentFrontendQuery"
|
||||
};
|
||||
|
||||
var bindVars = varsEditor.getValue();
|
||||
if (bindVars.length > 0) {
|
||||
try {
|
||||
var params = JSON.parse(bindVars);
|
||||
if (Object.keys(params).length !== 0) {
|
||||
data.bindVars = params;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
arangoHelper.arangoError("Query error", "Could not parse bind parameters.");
|
||||
}
|
||||
}
|
||||
return JSON.stringify(data);
|
||||
},
|
||||
|
||||
|
@ -848,7 +914,6 @@
|
|||
error: function (errObj) {
|
||||
var res = errObj.responseJSON;
|
||||
// Display ErrorMessage
|
||||
console.log("Error:", res.errorMessage);
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
@ -931,7 +996,7 @@
|
|||
try {
|
||||
var temp = JSON.parse(data.responseText);
|
||||
outputEditor.setValue('[' + temp.errorNum + '] ' + temp.errorMessage);
|
||||
arangoHelper.arangoError("Query error", temp.errorNum, temp.errorMessage);
|
||||
//arangoHelper.arangoError("Query error", temp.errorMessage);
|
||||
}
|
||||
catch (e) {
|
||||
outputEditor.setValue('ERROR');
|
||||
|
|
|
@ -68,7 +68,31 @@ toolbar {
|
|||
@extend %toolbar;
|
||||
}
|
||||
|
||||
.aql-editor {
|
||||
.vars-editor-header {
|
||||
border-top: 1px solid $c-content-border;
|
||||
margin-top: -5px;
|
||||
padding-left: 5px;
|
||||
|
||||
i {
|
||||
border-radius: 2px;
|
||||
color: $c-darker-grey;
|
||||
height: 15px;
|
||||
margin-left: 5px;
|
||||
padding-left: 3px;
|
||||
padding-top: 1px;
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
i:hover {
|
||||
background-color: $c-positive;
|
||||
color: $c-white;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.aql-editor,
|
||||
.vars-editor {
|
||||
@extend %toolbar;
|
||||
border-color: $c-editor-toolbar;
|
||||
border-left: 0 !important;
|
||||
|
@ -376,7 +400,8 @@ toolbar {
|
|||
width: 25px;
|
||||
}
|
||||
|
||||
span:hover {
|
||||
span:hover,
|
||||
.vars-editor-header i {
|
||||
background-color: $c-positive;
|
||||
color: $c-white;
|
||||
}
|
||||
|
@ -391,6 +416,7 @@ toolbar {
|
|||
}
|
||||
|
||||
.fa {
|
||||
color: $c-darker-grey;
|
||||
margin-left: 1px;
|
||||
margin-top: 2px;
|
||||
|
||||
|
@ -400,6 +426,7 @@ toolbar {
|
|||
}
|
||||
|
||||
.icon_arangodb {
|
||||
color: $c-darker-grey;
|
||||
font-size: 14pt;
|
||||
|
||||
&:first-child {
|
||||
|
|
|
@ -735,7 +735,7 @@ var loadGraph = function(name) {
|
|||
}
|
||||
|
||||
dropGraph(name);
|
||||
knownGraphs[name]();
|
||||
return knownGraphs[name]();
|
||||
};
|
||||
|
||||
exports.loadGraph = loadGraph;
|
||||
|
|
|
@ -452,7 +452,7 @@ function ahuacatlQueryNeighborsTestSuite () {
|
|||
actual = getQueryResults(queryStart + theFox + queryEnd);
|
||||
assertEqual(actual, [ ]);
|
||||
|
||||
assertQueryError(errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code, queryStart + "thefox/thefox" + queryEnd);
|
||||
assertQueryError(errors.ERROR_GRAPH_INVALID_PARAMETER.code, queryStart + "thefox/thefox" + queryEnd);
|
||||
|
||||
// Including Data
|
||||
actual = getRawQueryResults(queryStart + v3 + queryEndData);
|
||||
|
@ -504,7 +504,7 @@ function ahuacatlQueryNeighborsTestSuite () {
|
|||
actual = getQueryResults(queryStart + theFox + queryEnd);
|
||||
assertEqual(actual, [ ]);
|
||||
|
||||
assertQueryError(errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code, queryStart + "thefox/thefox" + queryEnd);
|
||||
assertQueryError(errors.ERROR_GRAPH_INVALID_PARAMETER.code, queryStart + "thefox/thefox" + queryEnd);
|
||||
|
||||
// Inclunding Data
|
||||
actual = getRawQueryResults(queryStart + v3 + queryEndData);
|
||||
|
@ -555,7 +555,7 @@ function ahuacatlQueryNeighborsTestSuite () {
|
|||
actual = getQueryResults(queryStart + theFox + queryEnd);
|
||||
assertEqual(actual, [ ]);
|
||||
|
||||
assertQueryError(errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code, queryStart + "thefox/thefox" + queryEnd);
|
||||
assertQueryError(errors.ERROR_GRAPH_INVALID_PARAMETER.code, queryStart + "thefox/thefox" + queryEnd);
|
||||
|
||||
// Inclunding Data
|
||||
actual = getRawQueryResults(queryStart + v3 + queryEndData);
|
||||
|
|
|
@ -49,7 +49,6 @@ SET(LIB_ARANGO_CONSOLE
|
|||
Utilities/LinenoiseShell.cpp
|
||||
)
|
||||
|
||||
|
||||
add_library(
|
||||
${LIB_ARANGO}
|
||||
STATIC
|
||||
|
|
|
@ -47,6 +47,12 @@ using namespace std;
|
|||
|
||||
std::string const HttpResponse::BatchErrorHeader = "X-Arango-Errors";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief hide header "Server: ArangoDB" in HTTP responses
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool HttpResponse::HideProductHeader = false;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief http response string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -266,7 +272,9 @@ HttpResponse::HttpResponse (HttpResponseCode code,
|
|||
_bodySize(0),
|
||||
_freeables() {
|
||||
|
||||
_headers.insert(TRI_CHAR_LENGTH_PAIR("server"), "ArangoDB");
|
||||
if (! HideProductHeader) {
|
||||
_headers.insert(TRI_CHAR_LENGTH_PAIR("server"), "ArangoDB");
|
||||
}
|
||||
_headers.insert(TRI_CHAR_LENGTH_PAIR("connection"), "Keep-Alive");
|
||||
_headers.insert(TRI_CHAR_LENGTH_PAIR("content-type"), "text/plain; charset=utf-8");
|
||||
}
|
||||
|
|
|
@ -453,6 +453,21 @@ namespace triagens {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::string const BatchErrorHeader;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief hide the "Server: ArangoDB" header in HTTP responses
|
||||
/// @startDocuBlock serverHideProductHeader
|
||||
/// `--server.hide-product-header`
|
||||
///
|
||||
/// If *true*, the server will exclude the HTTP header "Server: ArangoDB" in
|
||||
/// HTTP responses. If set to *false*, the server will send the header in
|
||||
/// responses.
|
||||
///
|
||||
/// The default is *false*.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool HideProductHeader;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ LinenoiseShell::LinenoiseShell (std::string const& history,
|
|||
: ShellBase(history, completer) {
|
||||
COMPLETER = completer;
|
||||
linenoiseSetCompletionCallback(LinenoiseCompletionGenerator);
|
||||
linenoiseInstallWindowChangeHandler();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -101,6 +101,18 @@ namespace arangodb {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string getLine (const std::string& prompt, bool& eof) override final;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not the shell implementation supports colors
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool supportsColors () const override final {
|
||||
#ifdef _WIN32
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue