mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/AvocadoDB into devel
This commit is contained in:
commit
85d58ca811
|
@ -377,6 +377,7 @@ HttpHandler::status_e RestAdminLogHandler::execute () {
|
|||
}
|
||||
|
||||
TRI_FreeBufferLogging(logs);
|
||||
TRI_DestroyVector(&clean);
|
||||
|
||||
generateResult(result);
|
||||
return HANDLER_DONE;
|
||||
|
|
|
@ -630,6 +630,11 @@ static void StartFor (TRI_aql_codegen_js_t* const generator,
|
|||
static void CloseLoops (TRI_aql_codegen_js_t* const generator) {
|
||||
TRI_aql_codegen_scope_t* scope = CurrentScope(generator);
|
||||
|
||||
if (scope->_type == TRI_AQL_SCOPE_MAIN || scope->_type == TRI_AQL_SCOPE_SUBQUERY) {
|
||||
// these scopes are closed by other means
|
||||
return;
|
||||
}
|
||||
|
||||
// we are closing at least one scope
|
||||
while (true) {
|
||||
TRI_aql_codegen_scope_e type = scope->_type;
|
||||
|
@ -1471,10 +1476,18 @@ static void ProcessAssign (TRI_aql_codegen_js_t* const generator,
|
|||
|
||||
static void ProcessFilter (TRI_aql_codegen_js_t* const generator,
|
||||
const TRI_aql_node_t* const node) {
|
||||
TRI_aql_codegen_scope_t* scope = CurrentScope(generator);
|
||||
|
||||
ScopeOutput(generator, "if (!(");
|
||||
ProcessNode(generator, TRI_AQL_NODE_MEMBER(node, 0));
|
||||
ScopeOutput(generator, ")) {\n");
|
||||
ScopeOutput(generator, "continue;\n");
|
||||
if (scope->_type == TRI_AQL_SCOPE_MAIN || scope->_type == TRI_AQL_SCOPE_SUBQUERY) {
|
||||
// in these scopes, we must not generated a continue statement. this would be illegal
|
||||
ScopeOutput(generator, "return [ ];\n");
|
||||
}
|
||||
else {
|
||||
ScopeOutput(generator, "continue;\n");
|
||||
}
|
||||
ScopeOutput(generator, "}\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -69,9 +69,12 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_aql_context_t* TRI_CreateContextAql (TRI_vocbase_t* vocbase,
|
||||
const char* const query) {
|
||||
const char* const query) {
|
||||
TRI_aql_context_t* context;
|
||||
|
||||
assert(vocbase);
|
||||
assert(query);
|
||||
|
||||
context = (TRI_aql_context_t*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_aql_context_t), false);
|
||||
if (!context) {
|
||||
return NULL;
|
||||
|
@ -230,6 +233,12 @@ void TRI_FreeContextAql (TRI_aql_context_t* const context) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_ValidateQueryContextAql (TRI_aql_context_t* const context) {
|
||||
if (context->_parser->_length == 0) {
|
||||
// query is empty, no need to parse it
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_EMPTY, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
// parse the query
|
||||
if (!TRI_ParseAql(context)) {
|
||||
// lexing/parsing failed
|
||||
|
|
|
@ -93,6 +93,7 @@ char* TRI_GetErrorMessageAql (const TRI_aql_error_t* const error) {
|
|||
|
||||
if (error->_data && (NULL != strstr(message, "%s"))) {
|
||||
snprintf(buffer, sizeof(buffer), message, error->_data);
|
||||
|
||||
return TRI_DuplicateString((const char*) &buffer);
|
||||
}
|
||||
|
||||
|
@ -138,35 +139,48 @@ void TRI_FreeErrorAql (TRI_aql_error_t* const error) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char* TRI_GetContextErrorAql (const char* const query, const size_t line, const size_t column) {
|
||||
size_t currentLine = 1;
|
||||
size_t currentColumn = 1;
|
||||
const char* p = query;
|
||||
const char* p;
|
||||
char* temp;
|
||||
char* result;
|
||||
size_t offset;
|
||||
char c;
|
||||
|
||||
while ((c = *p++)) {
|
||||
// note: line numbers reported by bison/flex start at 1, columns start at 0
|
||||
size_t offset;
|
||||
size_t currentLine = 1;
|
||||
size_t currentColumn = 0;
|
||||
|
||||
assert(query);
|
||||
|
||||
p = query;
|
||||
while ((c = *p)) {
|
||||
if (currentLine > line || (currentLine >= line && currentColumn >= column)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '\n') {
|
||||
++p;
|
||||
++currentLine;
|
||||
currentColumn = 0;
|
||||
}
|
||||
else if (c == '\r') {
|
||||
++p;
|
||||
++currentLine;
|
||||
currentColumn = 0;
|
||||
|
||||
if (*p == '\n') {
|
||||
++currentLine;
|
||||
currentColumn = 0;
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
++currentColumn;
|
||||
|
||||
if (currentLine >= line && currentColumn >= column) {
|
||||
break;
|
||||
else {
|
||||
++currentColumn;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
// p is pointing at the position in the query the parse error occurred at
|
||||
assert(p >= query);
|
||||
|
||||
offset = p - query;
|
||||
|
||||
if (strlen(query) < offset + SNIPPET_LENGTH) {
|
||||
return TRI_DuplicateString2(query + offset, strlen(query) - offset);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,10 @@
|
|||
/* A Bison parser, made by GNU Bison 2.5. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
/* A Bison parser, made by GNU Bison 2.4.1. */
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -95,7 +97,7 @@
|
|||
typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 25 "Ahuacatl/ahuacatl-grammar.y"
|
||||
|
||||
TRI_aql_node_t* node;
|
||||
|
@ -105,8 +107,8 @@ typedef union YYSTYPE
|
|||
|
||||
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 110 "Ahuacatl/ahuacatl-grammar.h"
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 112 "Ahuacatl/ahuacatl-grammar.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
|
|
@ -43,7 +43,11 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_aql_node_t* ModifyNode (void*, TRI_aql_node_t*);
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief optimise nodes recursively
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_aql_node_t* ProcessNode (void*, TRI_aql_node_t*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
|
@ -382,7 +386,7 @@ static TRI_aql_node_t* OptimiseFcall (TRI_aql_context_t* const context,
|
|||
json = TRI_ExecuteResultContext(execContext);
|
||||
TRI_FreeExecutionContext(execContext);
|
||||
if (!json) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_SCRIPT, NULL);
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_SCRIPT, "function optimisation");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -468,7 +472,7 @@ static TRI_aql_node_t* OptimiseFilter (TRI_aql_context_t* const context,
|
|||
|
||||
if (changed) {
|
||||
// expression code was changed, re-optimise it
|
||||
node->_members._buffer[0] = ModifyNode((void*) context, expression);
|
||||
node->_members._buffer[0] = ProcessNode((void*) context, expression);
|
||||
expression = TRI_AQL_NODE_MEMBER(node, 0);
|
||||
|
||||
// try again if it is constant
|
||||
|
@ -828,7 +832,7 @@ static TRI_aql_node_t* OptimiseNode (TRI_aql_context_t* const context,
|
|||
/// this is the callback function used by the tree walker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_aql_node_t* ModifyNode (void* data, TRI_aql_node_t* node) {
|
||||
static TRI_aql_node_t* ProcessNode (void* data, TRI_aql_node_t* node) {
|
||||
TRI_aql_context_t* context = (TRI_aql_context_t*) data;
|
||||
TRI_aql_node_t* result = node;
|
||||
|
||||
|
@ -883,7 +887,7 @@ TRI_aql_node_t* TRI_OptimiseAql (TRI_aql_context_t* const context,
|
|||
TRI_aql_node_t* node) {
|
||||
TRI_aql_modify_tree_walker_t* walker;
|
||||
|
||||
walker = TRI_CreateModifyTreeWalkerAql((void*) context, &ModifyNode);
|
||||
walker = TRI_CreateModifyTreeWalkerAql((void*) context, &ProcessNode);
|
||||
if (!walker) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
|
||||
return node;
|
||||
|
|
|
@ -73,7 +73,13 @@ void TRI_SetErrorParseAql (TRI_aql_context_t* const context,
|
|||
const int line,
|
||||
const int column) {
|
||||
char buffer[1024];
|
||||
char* region = TRI_GetContextErrorAql(context->_query, line, column);
|
||||
char* region;
|
||||
|
||||
assert(context);
|
||||
assert(context->_query);
|
||||
assert(message);
|
||||
|
||||
region = TRI_GetContextErrorAql(context->_query, line, column);
|
||||
|
||||
if (!region) {
|
||||
// OOM
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef int flex_int32_t;
|
|||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
#endif /* ! C99 */
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
|
@ -83,8 +84,6 @@ typedef unsigned int flex_uint32_t;
|
|||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -158,15 +157,7 @@ typedef void* yyscan_t;
|
|||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* The state buf must be large enough to hold one state per character in the main buffer.
|
||||
|
@ -728,12 +719,7 @@ static int input (yyscan_t yyscanner );
|
|||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Copy whatever the last rule matched to the standard output. */
|
||||
|
@ -741,7 +727,7 @@ static int input (yyscan_t yyscanner );
|
|||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
|
||||
#define ECHO fwrite( yytext, yyleng, 1, yyout )
|
||||
#endif
|
||||
|
||||
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
||||
|
@ -752,7 +738,7 @@ static int input (yyscan_t yyscanner );
|
|||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
size_t n; \
|
||||
int n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
|
@ -1991,8 +1977,8 @@ YY_BUFFER_STATE Ahuacatl_scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
|||
|
||||
/** Setup the input buffer state to scan the given bytes. The next call to Ahuacatllex() will
|
||||
* scan from a @e copy of @a bytes.
|
||||
* @param yybytes the byte buffer to scan
|
||||
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
|
||||
* @param bytes the byte buffer to scan
|
||||
* @param len the number of bytes in the buffer pointed to by @a bytes.
|
||||
* @param yyscanner The scanner object.
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
|
|
|
@ -101,34 +101,20 @@ ERROR_AVOCADO_DATAFILE_FULL,1300,"datafile full","Will be raised when the datafi
|
|||
ERROR_QUERY_KILLED,1500,"query killed","Will be raised when a running query is killed by an explicit admin command."
|
||||
ERROR_QUERY_PARSE,1501,"%s","Will be raised when query is parsed and is found to be syntactially invalid."
|
||||
ERROR_QUERY_EMPTY,1502,"query is empty","Will be raised when an empty query is specified."
|
||||
ERROR_QUERY_SPECIFICATION_INVALID,1503,"query specification invalid","Will be raised when a query is sent to the server with an incomplete or invalid query specification structure."
|
||||
ERROR_QUERY_NUMBER_OUT_OF_RANGE,1504,"number '%s' is out of range","Will be raised when a numeric value inside a query is out of the allowed value range."
|
||||
ERROR_QUERY_TOO_MANY_JOINS,1505,"too many joins.","Will be raised when the number of joins in a query is beyond the allowed value."
|
||||
ERROR_QUERY_COLLECTION_NAME_INVALID,1506,"collection name '%s' is invalid","Will be raised when an invalid collection name is used in the from clause of a query."
|
||||
ERROR_QUERY_COLLECTION_ALIAS_INVALID,1507,"collection alias '%s' is invalid","Will be raised when an invalid alias name is used for a collection."
|
||||
ERROR_QUERY_COLLECTION_ALIAS_REDECLARED,1508,"collection alias '%s' is declared multiple times in the same query","Will be raised when the same alias name is declared multiple times in the same query's from clause."
|
||||
ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED,1509,"collection alias '%s' is used but was not declared in the from clause","Will be raised when an alias not declared in the from clause is used in the query."
|
||||
ERROR_QUERY_COLLECTION_NOT_FOUND,1510,"unable to open collection '%s'","Will be raised when one of the collections referenced in the query was not found."
|
||||
ERROR_QUERY_GEO_RESTRICTION_INVALID,1511,"geo restriction for alias '%s' is invalid","Will be raised when a specified geo restriction is invalid."
|
||||
ERROR_QUERY_GEO_INDEX_MISSING,1512,"no suitable geo index found for geo restriction on '%s'","Will be raised when a geo restriction was specified but no suitable geo index is found to resolve it."
|
||||
ERROR_QUERY_BIND_PARAMETER_MISSING,1513,"no value specified for declared bind parameter '%s'","Will be raised when a bind parameter was declared in the query but the query is being executed with no value for that parameter."
|
||||
ERROR_QUERY_BIND_PARAMETER_REDECLARED,1514,"value for bind parameter '%s' is declared multiple times","Will be raised when a value gets specified multiple times for the same bind parameter."
|
||||
ERROR_QUERY_BIND_PARAMETER_UNDECLARED,1515,"bind parameter '%s' was not declared in the query","Will be raised when a value gets specified for an undeclared bind parameter."
|
||||
ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID,1516,"invalid value for bind parameter '%s'","Will be raised when an invalid value is specified for one of the bind parameters."
|
||||
ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE,1517,"bind parameter number '%s' out of range","Will be specified when the numeric index for a bind parameter of type @n is out of the allowed range."
|
||||
ERROR_QUERY_FUNCTION_NAME_UNKNOWN,1518,"usage of unknown function '%s'","Will be raised when an undefined function is called."
|
||||
ERROR_QUERY_RUNTIME_ERROR,1520,"runtime error '%s'","Will be raised when a Javascript runtime error occurs while executing a query."
|
||||
ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE,1521,"limit value '%s' is out of range","Will be raised when a limit value in the query is outside the allowed range (e. g. when passing a negative skip value)."
|
||||
ERROR_QUERY_VARIABLE_REDECLARED,1522,"variable '%s' is assigned multiple times","Will be raised when a variable gets re-assigned in a query."
|
||||
ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED,1523,"document attribute '%s' is assigned multiple times","Will be raised when a document attribute is re-assigned."
|
||||
ERROR_QUERY_VARIABLE_NAME_INVALID,1524,"variable name '%s' has an invalid format","Will be raised when an invalid variable name is used."
|
||||
ERROR_QUERY_BIND_PARAMETERS_INVALID,1525,"invalid structure of bind parameters","Will be raised when the structure of bind parameters passed has an unexpected format."
|
||||
ERROR_QUERY_COLLECTION_LOCK_FAILED,1526,"unable to read-lock collection %s","Will be raised when a read lock on the collection cannot be acquired."
|
||||
ERROR_QUERY_TOO_MANY_COLLECTIONS,1527,"too many collections","Will be raised when the number of collections in a query is beyond the allowed value."
|
||||
ERROR_QUERY_INVALID_LOGICAL_VALUE,1528,"invalid logical value","Will be raised when a non-boolean value is used in a logical operation."
|
||||
ERROR_QUERY_INVALID_ARITHMETIC_VALUE,1529,"invalid arithmetic value","Will be raised when a non-numeric value is used in an arithmetic operation."
|
||||
ERROR_QUERY_DIVISON_BY_ZERO,1530,"division by zero","Will be raised when there is an attempt to divide by zero."
|
||||
ERROR_QUERY_SCRIPT,1531,"runtime error","Will be raised when a runtime error is caused by the query."
|
||||
ERROR_QUERY_SCRIPT,1503,"runtime error '%s'","Will be raised when a runtime error is caused by the query."
|
||||
ERROR_QUERY_VARIABLE_NAME_INVALID,1510,"variable name '%s' has an invalid format","Will be raised when an invalid variable name is used."
|
||||
ERROR_QUERY_VARIABLE_REDECLARED,1511,"variable '%s' is assigned multiple times","Will be raised when a variable gets re-assigned in a query."
|
||||
ERROR_QUERY_COLLECTION_NOT_FOUND,1520,"unable to open collection '%s'","Will be raised when one of the collections referenced in the query was not found."
|
||||
ERROR_QUERY_COLLECTION_LOCK_FAILED,1521,"unable to read-lock collection %s","Will be raised when a read lock on the collection cannot be acquired."
|
||||
ERROR_QUERY_TOO_MANY_COLLECTIONS,1522,"too many collections","Will be raised when the number of collections in a query is beyond the allowed value."
|
||||
ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED,1530,"document attribute '%s' is assigned multiple times","Will be raised when a document attribute is re-assigned."
|
||||
ERROR_QUERY_FUNCTION_NAME_UNKNOWN,1540,"usage of unknown function '%s'","Will be raised when an undefined function is called."
|
||||
ERROR_QUERY_BIND_PARAMETERS_INVALID,1550,"invalid structure of bind parameters","Will be raised when the structure of bind parameters passed has an unexpected format."
|
||||
ERROR_QUERY_BIND_PARAMETER_MISSING,1551,"no value specified for declared bind parameter '%s'","Will be raised when a bind parameter was declared in the query but the query is being executed with no value for that parameter."
|
||||
ERROR_QUERY_BIND_PARAMETER_UNDECLARED,1552,"bind parameter '%s' was not declared in the query","Will be raised when a value gets specified for an undeclared bind parameter."
|
||||
ERROR_QUERY_INVALID_LOGICAL_VALUE,1560,"invalid logical value","Will be raised when a non-boolean value is used in a logical operation."
|
||||
ERROR_QUERY_INVALID_ARITHMETIC_VALUE,1561,"invalid arithmetic value","Will be raised when a non-numeric value is used in an arithmetic operation."
|
||||
ERROR_QUERY_DIVISON_BY_ZERO,1562,"division by zero","Will be raised when there is an attempt to divide by zero."
|
||||
|
||||
################################################################################
|
||||
## AvocadoDB cursor errors
|
||||
|
|
|
@ -67,34 +67,20 @@ void TRI_InitialiseErrorMessages (void) {
|
|||
REG_ERROR(ERROR_QUERY_KILLED, "query killed");
|
||||
REG_ERROR(ERROR_QUERY_PARSE, "%s");
|
||||
REG_ERROR(ERROR_QUERY_EMPTY, "query is empty");
|
||||
REG_ERROR(ERROR_QUERY_SPECIFICATION_INVALID, "query specification invalid");
|
||||
REG_ERROR(ERROR_QUERY_NUMBER_OUT_OF_RANGE, "number '%s' is out of range");
|
||||
REG_ERROR(ERROR_QUERY_TOO_MANY_JOINS, "too many joins.");
|
||||
REG_ERROR(ERROR_QUERY_COLLECTION_NAME_INVALID, "collection name '%s' is invalid");
|
||||
REG_ERROR(ERROR_QUERY_COLLECTION_ALIAS_INVALID, "collection alias '%s' is invalid");
|
||||
REG_ERROR(ERROR_QUERY_COLLECTION_ALIAS_REDECLARED, "collection alias '%s' is declared multiple times in the same query");
|
||||
REG_ERROR(ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED, "collection alias '%s' is used but was not declared in the from clause");
|
||||
REG_ERROR(ERROR_QUERY_COLLECTION_NOT_FOUND, "unable to open collection '%s'");
|
||||
REG_ERROR(ERROR_QUERY_GEO_RESTRICTION_INVALID, "geo restriction for alias '%s' is invalid");
|
||||
REG_ERROR(ERROR_QUERY_GEO_INDEX_MISSING, "no suitable geo index found for geo restriction on '%s'");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETER_MISSING, "no value specified for declared bind parameter '%s'");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETER_REDECLARED, "value for bind parameter '%s' is declared multiple times");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETER_UNDECLARED, "bind parameter '%s' was not declared in the query");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID, "invalid value for bind parameter '%s'");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE, "bind parameter number '%s' out of range");
|
||||
REG_ERROR(ERROR_QUERY_FUNCTION_NAME_UNKNOWN, "usage of unknown function '%s'");
|
||||
REG_ERROR(ERROR_QUERY_RUNTIME_ERROR, "runtime error '%s'");
|
||||
REG_ERROR(ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE, "limit value '%s' is out of range");
|
||||
REG_ERROR(ERROR_QUERY_VARIABLE_REDECLARED, "variable '%s' is assigned multiple times");
|
||||
REG_ERROR(ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED, "document attribute '%s' is assigned multiple times");
|
||||
REG_ERROR(ERROR_QUERY_SCRIPT, "runtime error '%s'");
|
||||
REG_ERROR(ERROR_QUERY_VARIABLE_NAME_INVALID, "variable name '%s' has an invalid format");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETERS_INVALID, "invalid structure of bind parameters");
|
||||
REG_ERROR(ERROR_QUERY_VARIABLE_REDECLARED, "variable '%s' is assigned multiple times");
|
||||
REG_ERROR(ERROR_QUERY_COLLECTION_NOT_FOUND, "unable to open collection '%s'");
|
||||
REG_ERROR(ERROR_QUERY_COLLECTION_LOCK_FAILED, "unable to read-lock collection %s");
|
||||
REG_ERROR(ERROR_QUERY_TOO_MANY_COLLECTIONS, "too many collections");
|
||||
REG_ERROR(ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED, "document attribute '%s' is assigned multiple times");
|
||||
REG_ERROR(ERROR_QUERY_FUNCTION_NAME_UNKNOWN, "usage of unknown function '%s'");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETERS_INVALID, "invalid structure of bind parameters");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETER_MISSING, "no value specified for declared bind parameter '%s'");
|
||||
REG_ERROR(ERROR_QUERY_BIND_PARAMETER_UNDECLARED, "bind parameter '%s' was not declared in the query");
|
||||
REG_ERROR(ERROR_QUERY_INVALID_LOGICAL_VALUE, "invalid logical value");
|
||||
REG_ERROR(ERROR_QUERY_INVALID_ARITHMETIC_VALUE, "invalid arithmetic value");
|
||||
REG_ERROR(ERROR_QUERY_DIVISON_BY_ZERO, "division by zero");
|
||||
REG_ERROR(ERROR_QUERY_SCRIPT, "runtime error");
|
||||
REG_ERROR(ERROR_CURSOR_NOT_FOUND, "cursor not found");
|
||||
REG_ERROR(ERROR_SESSION_USERHANDLER_URL_INVALID, "expecting <prefix>/user/<username>");
|
||||
REG_ERROR(ERROR_SESSION_USERHANDLER_CANNOT_CREATE_USER, "cannot create user");
|
||||
|
|
|
@ -135,80 +135,40 @@ extern "C" {
|
|||
/// invalid.
|
||||
/// - 1502: @CODE{query is empty}
|
||||
/// Will be raised when an empty query is specified.
|
||||
/// - 1503: @CODE{query specification invalid}
|
||||
/// Will be raised when a query is sent to the server with an incomplete or
|
||||
/// invalid query specification structure.
|
||||
/// - 1504: @CODE{number '\%s' is out of range}
|
||||
/// Will be raised when a numeric value inside a query is out of the allowed
|
||||
/// value range.
|
||||
/// - 1505: @CODE{too many joins.}
|
||||
/// Will be raised when the number of joins in a query is beyond the allowed
|
||||
/// value.
|
||||
/// - 1506: @CODE{collection name '\%s' is invalid}
|
||||
/// Will be raised when an invalid collection name is used in the from clause
|
||||
/// of a query.
|
||||
/// - 1507: @CODE{collection alias '\%s' is invalid}
|
||||
/// Will be raised when an invalid alias name is used for a collection.
|
||||
/// - 1508: @CODE{collection alias '\%s' is declared multiple times in the same query}
|
||||
/// Will be raised when the same alias name is declared multiple times in the
|
||||
/// same query's from clause.
|
||||
/// - 1509: @CODE{collection alias '\%s' is used but was not declared in the from clause}
|
||||
/// Will be raised when an alias not declared in the from clause is used in
|
||||
/// the query.
|
||||
/// - 1510: @CODE{unable to open collection '\%s'}
|
||||
/// - 1503: @CODE{runtime error '\%s'}
|
||||
/// Will be raised when a runtime error is caused by the query.
|
||||
/// - 1510: @CODE{variable name '\%s' has an invalid format}
|
||||
/// Will be raised when an invalid variable name is used.
|
||||
/// - 1511: @CODE{variable '\%s' is assigned multiple times}
|
||||
/// Will be raised when a variable gets re-assigned in a query.
|
||||
/// - 1520: @CODE{unable to open collection '\%s'}
|
||||
/// Will be raised when one of the collections referenced in the query was
|
||||
/// not found.
|
||||
/// - 1511: @CODE{geo restriction for alias '\%s' is invalid}
|
||||
/// Will be raised when a specified geo restriction is invalid.
|
||||
/// - 1512: @CODE{no suitable geo index found for geo restriction on '\%s'}
|
||||
/// Will be raised when a geo restriction was specified but no suitable geo
|
||||
/// index is found to resolve it.
|
||||
/// - 1513: @CODE{no value specified for declared bind parameter '\%s'}
|
||||
/// Will be raised when a bind parameter was declared in the query but the
|
||||
/// query is being executed with no value for that parameter.
|
||||
/// - 1514: @CODE{value for bind parameter '\%s' is declared multiple times}
|
||||
/// Will be raised when a value gets specified multiple times for the same
|
||||
/// bind parameter.
|
||||
/// - 1515: @CODE{bind parameter '\%s' was not declared in the query}
|
||||
/// Will be raised when a value gets specified for an undeclared bind
|
||||
/// parameter.
|
||||
/// - 1516: @CODE{invalid value for bind parameter '\%s'}
|
||||
/// Will be raised when an invalid value is specified for one of the bind
|
||||
/// parameters.
|
||||
/// - 1517: @CODE{bind parameter number '\%s' out of range}
|
||||
/// Will be specified when the numeric index for a bind parameter of type @n
|
||||
/// is out of the allowed range.
|
||||
/// - 1518: @CODE{usage of unknown function '\%s'}
|
||||
/// Will be raised when an undefined function is called.
|
||||
/// - 1520: @CODE{runtime error '\%s'}
|
||||
/// Will be raised when a Javascript runtime error occurs while executing a
|
||||
/// query.
|
||||
/// - 1521: @CODE{limit value '\%s' is out of range}
|
||||
/// Will be raised when a limit value in the query is outside the allowed
|
||||
/// range (e. g. when passing a negative skip value).
|
||||
/// - 1522: @CODE{variable '\%s' is assigned multiple times}
|
||||
/// Will be raised when a variable gets re-assigned in a query.
|
||||
/// - 1523: @CODE{document attribute '\%s' is assigned multiple times}
|
||||
/// Will be raised when a document attribute is re-assigned.
|
||||
/// - 1524: @CODE{variable name '\%s' has an invalid format}
|
||||
/// Will be raised when an invalid variable name is used.
|
||||
/// - 1525: @CODE{invalid structure of bind parameters}
|
||||
/// Will be raised when the structure of bind parameters passed has an
|
||||
/// unexpected format.
|
||||
/// - 1526: @CODE{unable to read-lock collection \%s}
|
||||
/// - 1521: @CODE{unable to read-lock collection \%s}
|
||||
/// Will be raised when a read lock on the collection cannot be acquired.
|
||||
/// - 1527: @CODE{too many collections}
|
||||
/// - 1522: @CODE{too many collections}
|
||||
/// Will be raised when the number of collections in a query is beyond the
|
||||
/// allowed value.
|
||||
/// - 1528: @CODE{invalid logical value}
|
||||
/// - 1530: @CODE{document attribute '\%s' is assigned multiple times}
|
||||
/// Will be raised when a document attribute is re-assigned.
|
||||
/// - 1540: @CODE{usage of unknown function '\%s'}
|
||||
/// Will be raised when an undefined function is called.
|
||||
/// - 1550: @CODE{invalid structure of bind parameters}
|
||||
/// Will be raised when the structure of bind parameters passed has an
|
||||
/// unexpected format.
|
||||
/// - 1551: @CODE{no value specified for declared bind parameter '\%s'}
|
||||
/// Will be raised when a bind parameter was declared in the query but the
|
||||
/// query is being executed with no value for that parameter.
|
||||
/// - 1552: @CODE{bind parameter '\%s' was not declared in the query}
|
||||
/// Will be raised when a value gets specified for an undeclared bind
|
||||
/// parameter.
|
||||
/// - 1560: @CODE{invalid logical value}
|
||||
/// Will be raised when a non-boolean value is used in a logical operation.
|
||||
/// - 1529: @CODE{invalid arithmetic value}
|
||||
/// - 1561: @CODE{invalid arithmetic value}
|
||||
/// Will be raised when a non-numeric value is used in an arithmetic
|
||||
/// operation.
|
||||
/// - 1530: @CODE{division by zero}
|
||||
/// - 1562: @CODE{division by zero}
|
||||
/// Will be raised when there is an attempt to divide by zero.
|
||||
/// - 1531: @CODE{runtime error}
|
||||
/// Will be raised when a runtime error is caused by the query.
|
||||
/// - 1600: @CODE{cursor not found}
|
||||
/// Will be raised when a cursor is requested via its id but a cursor with
|
||||
/// that id cannot be found.
|
||||
|
@ -909,83 +869,37 @@ void TRI_InitialiseErrorMessages (void);
|
|||
#define TRI_ERROR_QUERY_EMPTY (1502)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1503: ERROR_QUERY_SPECIFICATION_INVALID
|
||||
/// @brief 1503: ERROR_QUERY_SCRIPT
|
||||
///
|
||||
/// query specification invalid
|
||||
/// runtime error '%s'
|
||||
///
|
||||
/// Will be raised when a query is sent to the server with an incomplete or
|
||||
/// invalid query specification structure.
|
||||
/// Will be raised when a runtime error is caused by the query.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_SPECIFICATION_INVALID (1503)
|
||||
#define TRI_ERROR_QUERY_SCRIPT (1503)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1504: ERROR_QUERY_NUMBER_OUT_OF_RANGE
|
||||
/// @brief 1510: ERROR_QUERY_VARIABLE_NAME_INVALID
|
||||
///
|
||||
/// number '%s' is out of range
|
||||
/// variable name '%s' has an invalid format
|
||||
///
|
||||
/// Will be raised when a numeric value inside a query is out of the allowed
|
||||
/// value range.
|
||||
/// Will be raised when an invalid variable name is used.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE (1504)
|
||||
#define TRI_ERROR_QUERY_VARIABLE_NAME_INVALID (1510)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1505: ERROR_QUERY_TOO_MANY_JOINS
|
||||
/// @brief 1511: ERROR_QUERY_VARIABLE_REDECLARED
|
||||
///
|
||||
/// too many joins.
|
||||
/// variable '%s' is assigned multiple times
|
||||
///
|
||||
/// Will be raised when the number of joins in a query is beyond the allowed
|
||||
/// value.
|
||||
/// Will be raised when a variable gets re-assigned in a query.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_TOO_MANY_JOINS (1505)
|
||||
#define TRI_ERROR_QUERY_VARIABLE_REDECLARED (1511)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1506: ERROR_QUERY_COLLECTION_NAME_INVALID
|
||||
///
|
||||
/// collection name '%s' is invalid
|
||||
///
|
||||
/// Will be raised when an invalid collection name is used in the from clause
|
||||
/// of a query.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_COLLECTION_NAME_INVALID (1506)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1507: ERROR_QUERY_COLLECTION_ALIAS_INVALID
|
||||
///
|
||||
/// collection alias '%s' is invalid
|
||||
///
|
||||
/// Will be raised when an invalid alias name is used for a collection.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_COLLECTION_ALIAS_INVALID (1507)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1508: ERROR_QUERY_COLLECTION_ALIAS_REDECLARED
|
||||
///
|
||||
/// collection alias '%s' is declared multiple times in the same query
|
||||
///
|
||||
/// Will be raised when the same alias name is declared multiple times in the
|
||||
/// same query's from clause.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_COLLECTION_ALIAS_REDECLARED (1508)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1509: ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED
|
||||
///
|
||||
/// collection alias '%s' is used but was not declared in the from clause
|
||||
///
|
||||
/// Will be raised when an alias not declared in the from clause is used in the
|
||||
/// query.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED (1509)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1510: ERROR_QUERY_COLLECTION_NOT_FOUND
|
||||
/// @brief 1520: ERROR_QUERY_COLLECTION_NOT_FOUND
|
||||
///
|
||||
/// unable to open collection '%s'
|
||||
///
|
||||
|
@ -993,168 +907,20 @@ void TRI_InitialiseErrorMessages (void);
|
|||
/// found.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_COLLECTION_NOT_FOUND (1510)
|
||||
#define TRI_ERROR_QUERY_COLLECTION_NOT_FOUND (1520)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1511: ERROR_QUERY_GEO_RESTRICTION_INVALID
|
||||
///
|
||||
/// geo restriction for alias '%s' is invalid
|
||||
///
|
||||
/// Will be raised when a specified geo restriction is invalid.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_GEO_RESTRICTION_INVALID (1511)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1512: ERROR_QUERY_GEO_INDEX_MISSING
|
||||
///
|
||||
/// no suitable geo index found for geo restriction on '%s'
|
||||
///
|
||||
/// Will be raised when a geo restriction was specified but no suitable geo
|
||||
/// index is found to resolve it.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_GEO_INDEX_MISSING (1512)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1513: ERROR_QUERY_BIND_PARAMETER_MISSING
|
||||
///
|
||||
/// no value specified for declared bind parameter '%s'
|
||||
///
|
||||
/// Will be raised when a bind parameter was declared in the query but the
|
||||
/// query is being executed with no value for that parameter.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETER_MISSING (1513)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1514: ERROR_QUERY_BIND_PARAMETER_REDECLARED
|
||||
///
|
||||
/// value for bind parameter '%s' is declared multiple times
|
||||
///
|
||||
/// Will be raised when a value gets specified multiple times for the same bind
|
||||
/// parameter.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETER_REDECLARED (1514)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1515: ERROR_QUERY_BIND_PARAMETER_UNDECLARED
|
||||
///
|
||||
/// bind parameter '%s' was not declared in the query
|
||||
///
|
||||
/// Will be raised when a value gets specified for an undeclared bind parameter.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETER_UNDECLARED (1515)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1516: ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID
|
||||
///
|
||||
/// invalid value for bind parameter '%s'
|
||||
///
|
||||
/// Will be raised when an invalid value is specified for one of the bind
|
||||
/// parameters.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID (1516)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1517: ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE
|
||||
///
|
||||
/// bind parameter number '%s' out of range
|
||||
///
|
||||
/// Will be specified when the numeric index for a bind parameter of type @n is
|
||||
/// out of the allowed range.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE (1517)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1518: ERROR_QUERY_FUNCTION_NAME_UNKNOWN
|
||||
///
|
||||
/// usage of unknown function '%s'
|
||||
///
|
||||
/// Will be raised when an undefined function is called.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_FUNCTION_NAME_UNKNOWN (1518)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1520: ERROR_QUERY_RUNTIME_ERROR
|
||||
///
|
||||
/// runtime error '%s'
|
||||
///
|
||||
/// Will be raised when a Javascript runtime error occurs while executing a
|
||||
/// query.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_RUNTIME_ERROR (1520)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1521: ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE
|
||||
///
|
||||
/// limit value '%s' is out of range
|
||||
///
|
||||
/// Will be raised when a limit value in the query is outside the allowed range
|
||||
/// (e. g. when passing a negative skip value).
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE (1521)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1522: ERROR_QUERY_VARIABLE_REDECLARED
|
||||
///
|
||||
/// variable '%s' is assigned multiple times
|
||||
///
|
||||
/// Will be raised when a variable gets re-assigned in a query.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_VARIABLE_REDECLARED (1522)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1523: ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED
|
||||
///
|
||||
/// document attribute '%s' is assigned multiple times
|
||||
///
|
||||
/// Will be raised when a document attribute is re-assigned.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED (1523)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1524: ERROR_QUERY_VARIABLE_NAME_INVALID
|
||||
///
|
||||
/// variable name '%s' has an invalid format
|
||||
///
|
||||
/// Will be raised when an invalid variable name is used.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_VARIABLE_NAME_INVALID (1524)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1525: ERROR_QUERY_BIND_PARAMETERS_INVALID
|
||||
///
|
||||
/// invalid structure of bind parameters
|
||||
///
|
||||
/// Will be raised when the structure of bind parameters passed has an
|
||||
/// unexpected format.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETERS_INVALID (1525)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1526: ERROR_QUERY_COLLECTION_LOCK_FAILED
|
||||
/// @brief 1521: ERROR_QUERY_COLLECTION_LOCK_FAILED
|
||||
///
|
||||
/// unable to read-lock collection %s
|
||||
///
|
||||
/// Will be raised when a read lock on the collection cannot be acquired.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_COLLECTION_LOCK_FAILED (1526)
|
||||
#define TRI_ERROR_QUERY_COLLECTION_LOCK_FAILED (1521)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1527: ERROR_QUERY_TOO_MANY_COLLECTIONS
|
||||
/// @brief 1522: ERROR_QUERY_TOO_MANY_COLLECTIONS
|
||||
///
|
||||
/// too many collections
|
||||
///
|
||||
|
@ -1162,47 +928,89 @@ void TRI_InitialiseErrorMessages (void);
|
|||
/// allowed value.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_TOO_MANY_COLLECTIONS (1527)
|
||||
#define TRI_ERROR_QUERY_TOO_MANY_COLLECTIONS (1522)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1528: ERROR_QUERY_INVALID_LOGICAL_VALUE
|
||||
/// @brief 1530: ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED
|
||||
///
|
||||
/// document attribute '%s' is assigned multiple times
|
||||
///
|
||||
/// Will be raised when a document attribute is re-assigned.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED (1530)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1540: ERROR_QUERY_FUNCTION_NAME_UNKNOWN
|
||||
///
|
||||
/// usage of unknown function '%s'
|
||||
///
|
||||
/// Will be raised when an undefined function is called.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_FUNCTION_NAME_UNKNOWN (1540)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1550: ERROR_QUERY_BIND_PARAMETERS_INVALID
|
||||
///
|
||||
/// invalid structure of bind parameters
|
||||
///
|
||||
/// Will be raised when the structure of bind parameters passed has an
|
||||
/// unexpected format.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETERS_INVALID (1550)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1551: ERROR_QUERY_BIND_PARAMETER_MISSING
|
||||
///
|
||||
/// no value specified for declared bind parameter '%s'
|
||||
///
|
||||
/// Will be raised when a bind parameter was declared in the query but the
|
||||
/// query is being executed with no value for that parameter.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETER_MISSING (1551)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1552: ERROR_QUERY_BIND_PARAMETER_UNDECLARED
|
||||
///
|
||||
/// bind parameter '%s' was not declared in the query
|
||||
///
|
||||
/// Will be raised when a value gets specified for an undeclared bind parameter.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_BIND_PARAMETER_UNDECLARED (1552)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1560: ERROR_QUERY_INVALID_LOGICAL_VALUE
|
||||
///
|
||||
/// invalid logical value
|
||||
///
|
||||
/// Will be raised when a non-boolean value is used in a logical operation.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_INVALID_LOGICAL_VALUE (1528)
|
||||
#define TRI_ERROR_QUERY_INVALID_LOGICAL_VALUE (1560)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1529: ERROR_QUERY_INVALID_ARITHMETIC_VALUE
|
||||
/// @brief 1561: ERROR_QUERY_INVALID_ARITHMETIC_VALUE
|
||||
///
|
||||
/// invalid arithmetic value
|
||||
///
|
||||
/// Will be raised when a non-numeric value is used in an arithmetic operation.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_INVALID_ARITHMETIC_VALUE (1529)
|
||||
#define TRI_ERROR_QUERY_INVALID_ARITHMETIC_VALUE (1561)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1530: ERROR_QUERY_DIVISON_BY_ZERO
|
||||
/// @brief 1562: ERROR_QUERY_DIVISON_BY_ZERO
|
||||
///
|
||||
/// division by zero
|
||||
///
|
||||
/// Will be raised when there is an attempt to divide by zero.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_DIVISON_BY_ZERO (1530)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1531: ERROR_QUERY_SCRIPT
|
||||
///
|
||||
/// runtime error
|
||||
///
|
||||
/// Will be raised when a runtime error is caused by the query.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_QUERY_SCRIPT (1531)
|
||||
#define TRI_ERROR_QUERY_DIVISON_BY_ZERO (1562)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1600: ERROR_CURSOR_NOT_FOUND
|
||||
|
|
|
@ -620,6 +620,7 @@ WARN_LOGFILE =
|
|||
|
||||
INPUT = \
|
||||
@srcdir@/Admin \
|
||||
@srcdir@/Ahuacatl \
|
||||
@srcdir@/ApplicationServer \
|
||||
@srcdir@/Basics \
|
||||
@srcdir@/BasicsC \
|
||||
|
@ -664,7 +665,7 @@ RECURSIVE = YES
|
|||
EXCLUDE = \
|
||||
@srcdir@/V8/v8-json.h \
|
||||
@srcdir@/V8/v8-json.cpp \
|
||||
@srcdir@/QL/tokens.c
|
||||
@srcdir@/Ahuacatl/ahuacatl-tokens.c
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
|
|
|
@ -1039,6 +1039,7 @@ UNITTESTS_SERVER = $(addprefix --unit-tests ,$(SHELL_SERVER))
|
|||
SHELL_SERVER_AHUACATL = @srcdir@/js/server/tests/ahuacatl-operators.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-escaping.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-functions.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-simple.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-variables.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-collection.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-noncollection.js
|
||||
|
|
|
@ -176,6 +176,7 @@ unittests-shell-server:
|
|||
SHELL_SERVER_AHUACATL = @srcdir@/js/server/tests/ahuacatl-operators.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-escaping.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-functions.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-simple.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-variables.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-collection.js \
|
||||
@srcdir@/js/server/tests/ahuacatl-queries-noncollection.js
|
||||
|
|
|
@ -1062,6 +1062,9 @@ void AvocadoServer::openDatabase () {
|
|||
LOGGER_FATAL << "cannot open database '" << _databasePath << "'";
|
||||
LOGGER_INFO << "please use the '--database.directory' option";
|
||||
TRI_FlushLogging();
|
||||
|
||||
ApplicationUserManager::unloadUsers();
|
||||
ApplicationUserManager::unloadRoles();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,10 +67,10 @@
|
|||
/// @subsection HomePHP PHP
|
||||
///
|
||||
/// There is a PHP client available in a separate project:
|
||||
/// https://github.com/triAGENS/AvocadoDB-PHP
|
||||
/// https://github.com/triAGENS/ArangoDB-PHP
|
||||
///
|
||||
/// See also Packagist:
|
||||
/// http://packagist.org/packages/triagens/Avocado
|
||||
/// http://packagist.org/packages/triagens/ArangoDb
|
||||
///
|
||||
/// @subsection HomePython Python
|
||||
///
|
||||
|
|
|
@ -1725,7 +1725,7 @@ static v8::Handle<v8::Value> JS_RunAhuacatl (v8::Arguments const& argv) {
|
|||
}
|
||||
|
||||
if (tryCatch.HasCaught()) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_RUNTIME_ERROR, TRI_ObjectToString(tryCatch.Exception()).c_str());
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_SCRIPT, TRI_ObjectToString(tryCatch.Exception()).c_str());
|
||||
v8::Handle<v8::Object> errorObject = TRI_CreateErrorObjectAhuacatl(&context->_error);
|
||||
TRI_FreeContextAql(context);
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ static bool CheckCollection (TRI_collection_t* collection) {
|
|||
char* filename;
|
||||
|
||||
filename = TRI_Concatenate2File(collection->_directory, file);
|
||||
// TODO: memory allocation might fail
|
||||
TRI_PushBackVectorString(&collection->_indexFiles, filename);
|
||||
}
|
||||
|
||||
|
@ -141,6 +142,7 @@ static bool CheckCollection (TRI_collection_t* collection) {
|
|||
TRI_col_header_marker_t* cm;
|
||||
|
||||
filename = TRI_Concatenate2File(collection->_directory, file);
|
||||
// TODO: memory allocation might fail
|
||||
datafile = TRI_OpenDatafile(filename);
|
||||
|
||||
if (datafile == NULL) {
|
||||
|
@ -152,6 +154,8 @@ static bool CheckCollection (TRI_collection_t* collection) {
|
|||
break;
|
||||
}
|
||||
|
||||
assert(datafile);
|
||||
|
||||
TRI_PushBackVectorPointer(&all, datafile);
|
||||
|
||||
// check the document header
|
||||
|
@ -242,8 +246,11 @@ static bool CheckCollection (TRI_collection_t* collection) {
|
|||
datafile = sealed._buffer[i];
|
||||
|
||||
number = TRI_StringUInt32(datafile->_fid);
|
||||
// TODO: memory allocation might fail
|
||||
dname = TRI_Concatenate3String("datafile-", number, ".db");
|
||||
// TODO: memory allocation might fail
|
||||
filename = TRI_Concatenate2File(collection->_directory, dname);
|
||||
// TODO: memory allocation might fail
|
||||
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, dname);
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, number);
|
||||
|
@ -546,6 +553,7 @@ int TRI_LoadParameterInfoCollection (char const* path, TRI_col_info_t* parameter
|
|||
|
||||
// find parameter file
|
||||
filename = TRI_Concatenate2File(path, TRI_COL_PARAMETER_FILE);
|
||||
// TODO: memory allocation might fail
|
||||
|
||||
if (! TRI_ExistsFile(filename)) {
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, filename);
|
||||
|
@ -857,7 +865,7 @@ TRI_collection_t* TRI_OpenCollection (TRI_vocbase_t* vocbase,
|
|||
res = TRI_LoadParameterInfoCollection(path, &info);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_ERROR("cannot save collection parameter '%s': '%s'", path, TRI_last_error());
|
||||
LOG_ERROR("cannot load collection parameter '%s': '%s'", path, TRI_last_error());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -309,8 +309,9 @@ static TRI_datafile_t* OpenDatafile (char const* filename, bool ignoreErrors) {
|
|||
|
||||
// create datafile structure
|
||||
datafile = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_datafile_t), false);
|
||||
|
||||
if (!datafile) {
|
||||
// TODO: FIXME
|
||||
return NULL;
|
||||
}
|
||||
|
||||
InitDatafile(datafile,
|
||||
|
@ -739,6 +740,8 @@ TRI_datafile_t* TRI_OpenDatafile (char const* filename) {
|
|||
close(datafile->_fd);
|
||||
|
||||
LOG_ERROR("datafile '%s' is corrupt", datafile->_filename);
|
||||
// must free datafile here
|
||||
TRI_FreeDatafile(datafile);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -796,6 +796,8 @@ static int LoadCollectionVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* col
|
|||
// someone else loaded the collection, release the WRITE lock and try again
|
||||
if (collection->_status == TRI_VOC_COL_STATUS_LOADED) {
|
||||
TRI_WRITE_UNLOCK_STATUS_VOCBASE_COL(collection);
|
||||
|
||||
// TODO: might this cause endless recursion in some obscure cases??
|
||||
return LoadCollectionVocBase(vocbase, collection);
|
||||
}
|
||||
|
||||
|
@ -804,6 +806,8 @@ static int LoadCollectionVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* col
|
|||
if (collection->_status == TRI_VOC_COL_STATUS_UNLOADING) {
|
||||
collection->_status = TRI_VOC_COL_STATUS_LOADED;
|
||||
TRI_WRITE_UNLOCK_STATUS_VOCBASE_COL(collection);
|
||||
|
||||
// TODO: might this cause endless recursion in some obscure cases??
|
||||
return LoadCollectionVocBase(vocbase, collection);
|
||||
}
|
||||
|
||||
|
@ -829,6 +833,7 @@ static int LoadCollectionVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* col
|
|||
return res;
|
||||
}
|
||||
|
||||
// TODO: might this cause endless recursion in some obscure cases??
|
||||
return LoadCollectionVocBase(vocbase, collection);
|
||||
}
|
||||
|
||||
|
@ -855,6 +860,8 @@ static int LoadCollectionVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* col
|
|||
|
||||
// release the WRITE lock and try again
|
||||
TRI_WRITE_UNLOCK_STATUS_VOCBASE_COL(collection);
|
||||
|
||||
// TODO: might this cause endless recursion in some obscure cases??
|
||||
return LoadCollectionVocBase(vocbase, collection);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -61,34 +61,20 @@ ModuleCache["/internal"].exports.errors = {
|
|||
"ERROR_QUERY_KILLED" : { "code" : 1500, "message" : "query killed" },
|
||||
"ERROR_QUERY_PARSE" : { "code" : 1501, "message" : "%s" },
|
||||
"ERROR_QUERY_EMPTY" : { "code" : 1502, "message" : "query is empty" },
|
||||
"ERROR_QUERY_SPECIFICATION_INVALID" : { "code" : 1503, "message" : "query specification invalid" },
|
||||
"ERROR_QUERY_NUMBER_OUT_OF_RANGE" : { "code" : 1504, "message" : "number '%s' is out of range" },
|
||||
"ERROR_QUERY_TOO_MANY_JOINS" : { "code" : 1505, "message" : "too many joins." },
|
||||
"ERROR_QUERY_COLLECTION_NAME_INVALID" : { "code" : 1506, "message" : "collection name '%s' is invalid" },
|
||||
"ERROR_QUERY_COLLECTION_ALIAS_INVALID" : { "code" : 1507, "message" : "collection alias '%s' is invalid" },
|
||||
"ERROR_QUERY_COLLECTION_ALIAS_REDECLARED" : { "code" : 1508, "message" : "collection alias '%s' is declared multiple times in the same query" },
|
||||
"ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED" : { "code" : 1509, "message" : "collection alias '%s' is used but was not declared in the from clause" },
|
||||
"ERROR_QUERY_COLLECTION_NOT_FOUND" : { "code" : 1510, "message" : "unable to open collection '%s'" },
|
||||
"ERROR_QUERY_GEO_RESTRICTION_INVALID" : { "code" : 1511, "message" : "geo restriction for alias '%s' is invalid" },
|
||||
"ERROR_QUERY_GEO_INDEX_MISSING" : { "code" : 1512, "message" : "no suitable geo index found for geo restriction on '%s'" },
|
||||
"ERROR_QUERY_BIND_PARAMETER_MISSING" : { "code" : 1513, "message" : "no value specified for declared bind parameter '%s'" },
|
||||
"ERROR_QUERY_BIND_PARAMETER_REDECLARED" : { "code" : 1514, "message" : "value for bind parameter '%s' is declared multiple times" },
|
||||
"ERROR_QUERY_BIND_PARAMETER_UNDECLARED" : { "code" : 1515, "message" : "bind parameter '%s' was not declared in the query" },
|
||||
"ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID" : { "code" : 1516, "message" : "invalid value for bind parameter '%s'" },
|
||||
"ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE" : { "code" : 1517, "message" : "bind parameter number '%s' out of range" },
|
||||
"ERROR_QUERY_FUNCTION_NAME_UNKNOWN" : { "code" : 1518, "message" : "usage of unknown function '%s'" },
|
||||
"ERROR_QUERY_RUNTIME_ERROR" : { "code" : 1520, "message" : "runtime error '%s'" },
|
||||
"ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE" : { "code" : 1521, "message" : "limit value '%s' is out of range" },
|
||||
"ERROR_QUERY_VARIABLE_REDECLARED" : { "code" : 1522, "message" : "variable '%s' is assigned multiple times" },
|
||||
"ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED" : { "code" : 1523, "message" : "document attribute '%s' is assigned multiple times" },
|
||||
"ERROR_QUERY_VARIABLE_NAME_INVALID" : { "code" : 1524, "message" : "variable name '%s' has an invalid format" },
|
||||
"ERROR_QUERY_BIND_PARAMETERS_INVALID" : { "code" : 1525, "message" : "invalid structure of bind parameters" },
|
||||
"ERROR_QUERY_COLLECTION_LOCK_FAILED" : { "code" : 1526, "message" : "unable to read-lock collection %s" },
|
||||
"ERROR_QUERY_TOO_MANY_COLLECTIONS" : { "code" : 1527, "message" : "too many collections" },
|
||||
"ERROR_QUERY_INVALID_LOGICAL_VALUE" : { "code" : 1528, "message" : "invalid logical value" },
|
||||
"ERROR_QUERY_INVALID_ARITHMETIC_VALUE" : { "code" : 1529, "message" : "invalid arithmetic value" },
|
||||
"ERROR_QUERY_DIVISON_BY_ZERO" : { "code" : 1530, "message" : "division by zero" },
|
||||
"ERROR_QUERY_SCRIPT" : { "code" : 1531, "message" : "runtime error" },
|
||||
"ERROR_QUERY_SCRIPT" : { "code" : 1503, "message" : "runtime error '%s'" },
|
||||
"ERROR_QUERY_VARIABLE_NAME_INVALID" : { "code" : 1510, "message" : "variable name '%s' has an invalid format" },
|
||||
"ERROR_QUERY_VARIABLE_REDECLARED" : { "code" : 1511, "message" : "variable '%s' is assigned multiple times" },
|
||||
"ERROR_QUERY_COLLECTION_NOT_FOUND" : { "code" : 1520, "message" : "unable to open collection '%s'" },
|
||||
"ERROR_QUERY_COLLECTION_LOCK_FAILED" : { "code" : 1521, "message" : "unable to read-lock collection %s" },
|
||||
"ERROR_QUERY_TOO_MANY_COLLECTIONS" : { "code" : 1522, "message" : "too many collections" },
|
||||
"ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED" : { "code" : 1530, "message" : "document attribute '%s' is assigned multiple times" },
|
||||
"ERROR_QUERY_FUNCTION_NAME_UNKNOWN" : { "code" : 1540, "message" : "usage of unknown function '%s'" },
|
||||
"ERROR_QUERY_BIND_PARAMETERS_INVALID" : { "code" : 1550, "message" : "invalid structure of bind parameters" },
|
||||
"ERROR_QUERY_BIND_PARAMETER_MISSING" : { "code" : 1551, "message" : "no value specified for declared bind parameter '%s'" },
|
||||
"ERROR_QUERY_BIND_PARAMETER_UNDECLARED" : { "code" : 1552, "message" : "bind parameter '%s' was not declared in the query" },
|
||||
"ERROR_QUERY_INVALID_LOGICAL_VALUE" : { "code" : 1560, "message" : "invalid logical value" },
|
||||
"ERROR_QUERY_INVALID_ARITHMETIC_VALUE" : { "code" : 1561, "message" : "invalid arithmetic value" },
|
||||
"ERROR_QUERY_DIVISON_BY_ZERO" : { "code" : 1562, "message" : "division by zero" },
|
||||
"ERROR_CURSOR_NOT_FOUND" : { "code" : 1600, "message" : "cursor not found" },
|
||||
"ERROR_SESSION_USERHANDLER_URL_INVALID" : { "code" : 1700, "message" : "expecting <prefix>/user/<username>" },
|
||||
"ERROR_SESSION_USERHANDLER_CANNOT_CREATE_USER" : { "code" : 1701, "message" : "cannot create user" },
|
||||
|
|
|
@ -62,34 +62,20 @@ static string JS_common_bootstrap_errors =
|
|||
" \"ERROR_QUERY_KILLED\" : { \"code\" : 1500, \"message\" : \"query killed\" }, \n"
|
||||
" \"ERROR_QUERY_PARSE\" : { \"code\" : 1501, \"message\" : \"%s\" }, \n"
|
||||
" \"ERROR_QUERY_EMPTY\" : { \"code\" : 1502, \"message\" : \"query is empty\" }, \n"
|
||||
" \"ERROR_QUERY_SPECIFICATION_INVALID\" : { \"code\" : 1503, \"message\" : \"query specification invalid\" }, \n"
|
||||
" \"ERROR_QUERY_NUMBER_OUT_OF_RANGE\" : { \"code\" : 1504, \"message\" : \"number '%s' is out of range\" }, \n"
|
||||
" \"ERROR_QUERY_TOO_MANY_JOINS\" : { \"code\" : 1505, \"message\" : \"too many joins.\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_NAME_INVALID\" : { \"code\" : 1506, \"message\" : \"collection name '%s' is invalid\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_ALIAS_INVALID\" : { \"code\" : 1507, \"message\" : \"collection alias '%s' is invalid\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_ALIAS_REDECLARED\" : { \"code\" : 1508, \"message\" : \"collection alias '%s' is declared multiple times in the same query\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED\" : { \"code\" : 1509, \"message\" : \"collection alias '%s' is used but was not declared in the from clause\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_NOT_FOUND\" : { \"code\" : 1510, \"message\" : \"unable to open collection '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_GEO_RESTRICTION_INVALID\" : { \"code\" : 1511, \"message\" : \"geo restriction for alias '%s' is invalid\" }, \n"
|
||||
" \"ERROR_QUERY_GEO_INDEX_MISSING\" : { \"code\" : 1512, \"message\" : \"no suitable geo index found for geo restriction on '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_MISSING\" : { \"code\" : 1513, \"message\" : \"no value specified for declared bind parameter '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_REDECLARED\" : { \"code\" : 1514, \"message\" : \"value for bind parameter '%s' is declared multiple times\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_UNDECLARED\" : { \"code\" : 1515, \"message\" : \"bind parameter '%s' was not declared in the query\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID\" : { \"code\" : 1516, \"message\" : \"invalid value for bind parameter '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE\" : { \"code\" : 1517, \"message\" : \"bind parameter number '%s' out of range\" }, \n"
|
||||
" \"ERROR_QUERY_FUNCTION_NAME_UNKNOWN\" : { \"code\" : 1518, \"message\" : \"usage of unknown function '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_RUNTIME_ERROR\" : { \"code\" : 1520, \"message\" : \"runtime error '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE\" : { \"code\" : 1521, \"message\" : \"limit value '%s' is out of range\" }, \n"
|
||||
" \"ERROR_QUERY_VARIABLE_REDECLARED\" : { \"code\" : 1522, \"message\" : \"variable '%s' is assigned multiple times\" }, \n"
|
||||
" \"ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED\" : { \"code\" : 1523, \"message\" : \"document attribute '%s' is assigned multiple times\" }, \n"
|
||||
" \"ERROR_QUERY_VARIABLE_NAME_INVALID\" : { \"code\" : 1524, \"message\" : \"variable name '%s' has an invalid format\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETERS_INVALID\" : { \"code\" : 1525, \"message\" : \"invalid structure of bind parameters\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_LOCK_FAILED\" : { \"code\" : 1526, \"message\" : \"unable to read-lock collection %s\" }, \n"
|
||||
" \"ERROR_QUERY_TOO_MANY_COLLECTIONS\" : { \"code\" : 1527, \"message\" : \"too many collections\" }, \n"
|
||||
" \"ERROR_QUERY_INVALID_LOGICAL_VALUE\" : { \"code\" : 1528, \"message\" : \"invalid logical value\" }, \n"
|
||||
" \"ERROR_QUERY_INVALID_ARITHMETIC_VALUE\" : { \"code\" : 1529, \"message\" : \"invalid arithmetic value\" }, \n"
|
||||
" \"ERROR_QUERY_DIVISON_BY_ZERO\" : { \"code\" : 1530, \"message\" : \"division by zero\" }, \n"
|
||||
" \"ERROR_QUERY_SCRIPT\" : { \"code\" : 1531, \"message\" : \"runtime error\" }, \n"
|
||||
" \"ERROR_QUERY_SCRIPT\" : { \"code\" : 1503, \"message\" : \"runtime error '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_VARIABLE_NAME_INVALID\" : { \"code\" : 1510, \"message\" : \"variable name '%s' has an invalid format\" }, \n"
|
||||
" \"ERROR_QUERY_VARIABLE_REDECLARED\" : { \"code\" : 1511, \"message\" : \"variable '%s' is assigned multiple times\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_NOT_FOUND\" : { \"code\" : 1520, \"message\" : \"unable to open collection '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_COLLECTION_LOCK_FAILED\" : { \"code\" : 1521, \"message\" : \"unable to read-lock collection %s\" }, \n"
|
||||
" \"ERROR_QUERY_TOO_MANY_COLLECTIONS\" : { \"code\" : 1522, \"message\" : \"too many collections\" }, \n"
|
||||
" \"ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED\" : { \"code\" : 1530, \"message\" : \"document attribute '%s' is assigned multiple times\" }, \n"
|
||||
" \"ERROR_QUERY_FUNCTION_NAME_UNKNOWN\" : { \"code\" : 1540, \"message\" : \"usage of unknown function '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETERS_INVALID\" : { \"code\" : 1550, \"message\" : \"invalid structure of bind parameters\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_MISSING\" : { \"code\" : 1551, \"message\" : \"no value specified for declared bind parameter '%s'\" }, \n"
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_UNDECLARED\" : { \"code\" : 1552, \"message\" : \"bind parameter '%s' was not declared in the query\" }, \n"
|
||||
" \"ERROR_QUERY_INVALID_LOGICAL_VALUE\" : { \"code\" : 1560, \"message\" : \"invalid logical value\" }, \n"
|
||||
" \"ERROR_QUERY_INVALID_ARITHMETIC_VALUE\" : { \"code\" : 1561, \"message\" : \"invalid arithmetic value\" }, \n"
|
||||
" \"ERROR_QUERY_DIVISON_BY_ZERO\" : { \"code\" : 1562, \"message\" : \"division by zero\" }, \n"
|
||||
" \"ERROR_CURSOR_NOT_FOUND\" : { \"code\" : 1600, \"message\" : \"cursor not found\" }, \n"
|
||||
" \"ERROR_SESSION_USERHANDLER_URL_INVALID\" : { \"code\" : 1700, \"message\" : \"expecting <prefix>/user/<username>\" }, \n"
|
||||
" \"ERROR_SESSION_USERHANDLER_CANNOT_CREATE_USER\" : { \"code\" : 1701, \"message\" : \"cannot create user\" }, \n"
|
||||
|
|
|
@ -0,0 +1,330 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tests for query language, simple queries
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Jan Steemann
|
||||
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var jsunity = require("jsunity");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test suite
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function ahuacatlQuerySimpleTestSuite () {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief execute a given query
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function executeQuery (query) {
|
||||
var cursor = AHUACATL_RUN(query, undefined);
|
||||
if (cursor instanceof AvocadoError) {
|
||||
print(query, cursor.errorMessage);
|
||||
}
|
||||
assertFalse(cursor instanceof AvocadoError);
|
||||
return cursor;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief execute a given query and return the results as an array
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getQueryResults (query) {
|
||||
var result = executeQuery(query).getRows();
|
||||
var results = [ ];
|
||||
|
||||
for (var i in result) {
|
||||
if (!result.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
results.push(result[i]);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
setUp : function () {
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tear down
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
tearDown : function () {
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return null
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnOnlyQuery1 : function () {
|
||||
var expected = [ null ];
|
||||
|
||||
var actual = getQueryResults("return null");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a number
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnOnlyQuery2 : function () {
|
||||
var expected = [ 0 ];
|
||||
|
||||
var actual = getQueryResults("return 0");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnOnlyQuery3 : function () {
|
||||
var expected = [ "a string value" ];
|
||||
|
||||
var actual = getQueryResults("return \"a string value\"");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a list
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnOnlyQuery4 : function () {
|
||||
var expected = [ [ 1, 2, 9 ] ];
|
||||
|
||||
var actual = getQueryResults("return [ 1, 2, 9 ]");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return an array
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnOnlyQuery5 : function () {
|
||||
var expected = [ { "name" : "Peter", "id" : 15, "age" : 35, "active" : false, "likes" : [ ] } ];
|
||||
|
||||
var actual = getQueryResults("return { \"name\" : \"Peter\", \"id\" : 15, \"age\" : 35, \"active\" : false, \"likes\" : [ ] }");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a list of arrays
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnOnlyQuery6 : function () {
|
||||
var expected = [ [ { "name" : "Max", "id" : 1 }, { "name" : "Vanessa", "id" : 2 }, { "unrelated" : [ "some", "stuff", "goes", "here" ] } ] ];
|
||||
|
||||
var actual = getQueryResults("return [ { \"name\" : \"Max\", \"id\" : 1 }, { \"name\" : \"Vanessa\", \"id\" : 2 }, { \"unrelated\" : [ \"some\", \"stuff\", \"goes\", \"here\" ] } ]");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a computed value
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnOnlyQuery7 : function () {
|
||||
var expected = [ 42 ];
|
||||
|
||||
var actual = getQueryResults("return 1 + 40 + 1");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from let
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnLet1 : function () {
|
||||
var expected = [ 1 ];
|
||||
|
||||
var actual = getQueryResults("let x = 1 return x");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from let
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnLet2 : function () {
|
||||
var expected = [ [ 1, 2, 42 ] ];
|
||||
|
||||
var actual = getQueryResults("let x = [ 1, 2, 42 ] return x");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from let
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnLet3 : function () {
|
||||
var expected = [ null ];
|
||||
|
||||
var actual = getQueryResults("let x = null return x");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from let
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnLet4 : function () {
|
||||
var expected = [ [ 1, 2, 3 ] ];
|
||||
|
||||
var actual = getQueryResults("let x = (for u in [ 1, 2, 3 ] return u) return x");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from let
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnLet5 : function () {
|
||||
var expected = [ [ 2, 3, 4 ] ];
|
||||
|
||||
var actual = getQueryResults("let x = (for u in (for v in [ 1, 2, 3 ] return v + 1) return u) return x");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from let
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnLet6 : function () {
|
||||
var expected = [ [ 1 ] ];
|
||||
|
||||
var actual = getQueryResults("let x = (return 1) return x");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter1 : function () {
|
||||
var expected = [ ];
|
||||
|
||||
var actual = getQueryResults("filter 1 == 0 return 1");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter2 : function () {
|
||||
var expected = [ ];
|
||||
|
||||
var actual = getQueryResults("filter 1 == 1 filter 1 == 0 return 1");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter3 : function () {
|
||||
var expected = [ 1 ];
|
||||
|
||||
var actual = getQueryResults("filter 1 == 1 return 1");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter4 : function () {
|
||||
var expected = [ 1 ];
|
||||
|
||||
var actual = getQueryResults("filter 1 == 1 filter \"true\" == \"true\" return 1");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter5 : function () {
|
||||
var expected = [ 2 ];
|
||||
|
||||
var actual = getQueryResults("let x = (filter 1 == 1 return 1) return 2");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter6 : function () {
|
||||
var expected = [ ];
|
||||
|
||||
var actual = getQueryResults("let x = (filter 0 == 1 return 1) return 2");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter7 : function () {
|
||||
var expected = [ ];
|
||||
|
||||
var actual = getQueryResults("let x = (filter 0 == 1 return 1) filter x == [ 1 ] return 2");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a value from a filter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReturnFilter8 : function () {
|
||||
var expected = [ 2 ];
|
||||
|
||||
var actual = getQueryResults("let x = (filter 1 == 1 return 1) filter x == [ 1 ] return 2");
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the test suite
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
jsunity.run(ahuacatlQuerySimpleTestSuite);
|
||||
|
||||
return jsunity.done();
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
// End:
|
Loading…
Reference in New Issue