mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
1f9931deba
|
@ -1,6 +1,8 @@
|
|||
v1.4
|
||||
----
|
||||
|
||||
* issue #581: Parameter binding for attributes
|
||||
|
||||
|
||||
v1.4.0-alpha1 (2013-08-02)
|
||||
--------------------------
|
||||
|
|
|
@ -854,6 +854,21 @@ TRI_aql_node_t* TRI_CreateNodeAttributeAccessAql (TRI_aql_context_t* const conte
|
|||
return node;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create an AST attribute access node w/ bind parameter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_aql_node_t* TRI_CreateNodeBoundAttributeAccessAql (TRI_aql_context_t* const context,
|
||||
const TRI_aql_node_t* const accessed,
|
||||
const TRI_aql_node_t* const parameter) {
|
||||
CREATE_NODE(TRI_AQL_NODE_BOUND_ATTRIBUTE_ACCESS)
|
||||
|
||||
ADD_MEMBER(accessed)
|
||||
ADD_MEMBER(parameter)
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create an AST index access node
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -325,6 +325,14 @@ TRI_aql_node_t* TRI_CreateNodeAttributeAccessAql (struct TRI_aql_context_s* cons
|
|||
const TRI_aql_node_t* const,
|
||||
const char* const);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create an AST attribute node w/ bind parameter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_aql_node_t* TRI_CreateNodeBoundAttributeAccessAql (struct TRI_aql_context_s* const,
|
||||
const TRI_aql_node_t* const,
|
||||
const TRI_aql_node_t* const);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create an AST index access node
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -42,13 +42,64 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief check if a node is a bound attribute access and convert it into a
|
||||
/// "normal" attribute access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_aql_node_t* FixAttributeAccess (TRI_aql_statement_walker_t* const walker,
|
||||
TRI_aql_node_t* node) {
|
||||
TRI_aql_context_t* context;
|
||||
TRI_aql_node_t* valueNode;
|
||||
char* stringValue;
|
||||
|
||||
if (node == NULL ||
|
||||
node->_type != TRI_AQL_NODE_BOUND_ATTRIBUTE_ACCESS) {
|
||||
return node;
|
||||
}
|
||||
|
||||
// we found a bound attribute access
|
||||
context = (TRI_aql_context_t*) walker->_data;
|
||||
assert(context);
|
||||
|
||||
assert(node->_members._length == 2);
|
||||
valueNode = TRI_AQL_NODE_MEMBER(node, 1);
|
||||
|
||||
if (valueNode == NULL) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
|
||||
return node;
|
||||
}
|
||||
|
||||
if (valueNode->_type != TRI_AQL_NODE_VALUE || valueNode->_value._type != TRI_AQL_TYPE_STRING) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_BIND_PARAMETER_TYPE, "(unknown)");
|
||||
return node;
|
||||
}
|
||||
|
||||
stringValue = TRI_AQL_NODE_STRING(valueNode);
|
||||
|
||||
if (stringValue == NULL || strlen(stringValue) == 0) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_BIND_PARAMETER_TYPE, "(unknown)");
|
||||
return node;
|
||||
}
|
||||
|
||||
// remove second node
|
||||
TRI_RemoveVectorPointer(&node->_members, 1);
|
||||
|
||||
// set attribute name
|
||||
TRI_AQL_NODE_STRING(node) = stringValue;
|
||||
|
||||
// convert node type
|
||||
node->_type = TRI_AQL_NODE_ATTRIBUTE_ACCESS;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief check if a node is a bind parameter and convert it into a value node
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_aql_node_t* ModifyNode (TRI_aql_statement_walker_t* const walker,
|
||||
TRI_aql_node_t* node) {
|
||||
static TRI_aql_node_t* InjectParameter (TRI_aql_statement_walker_t* const walker,
|
||||
TRI_aql_node_t* node) {
|
||||
TRI_aql_bind_parameter_t* bind;
|
||||
TRI_associative_pointer_t* bindValues;
|
||||
TRI_aql_context_t* context;
|
||||
|
@ -312,16 +363,27 @@ bool TRI_InjectBindParametersAql (TRI_aql_context_t* const context) {
|
|||
return true;
|
||||
}
|
||||
|
||||
walker = TRI_CreateStatementWalkerAql(context, true, &ModifyNode, NULL, NULL);
|
||||
walker = TRI_CreateStatementWalkerAql(context, true, &InjectParameter, NULL, NULL);
|
||||
|
||||
if (walker == NULL) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TRI_WalkStatementsAql(walker, context->_statements);
|
||||
TRI_FreeStatementWalkerAql(walker);
|
||||
|
||||
|
||||
walker = TRI_CreateStatementWalkerAql(context, true, &FixAttributeAccess, NULL, NULL);
|
||||
|
||||
if (walker == NULL) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TRI_WalkStatementsAql(walker, context->_statements);
|
||||
|
||||
TRI_FreeStatementWalkerAql(walker);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -2569,6 +2569,9 @@ static void ProcessNode (TRI_aql_codegen_js_t* const generator, const TRI_aql_no
|
|||
case TRI_AQL_NODE_SCOPE_END:
|
||||
ProcessScopeEnd(generator, node);
|
||||
break;
|
||||
case TRI_AQL_NODE_BOUND_ATTRIBUTE_ACCESS:
|
||||
assert(false);
|
||||
break;
|
||||
default: {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,31 +365,38 @@ bool TRI_ValueJavascriptAql (TRI_string_buffer_t* const buffer,
|
|||
}
|
||||
|
||||
case TRI_AQL_TYPE_STRING: {
|
||||
char* escapedString;
|
||||
size_t outLength;
|
||||
size_t length;
|
||||
|
||||
if (TRI_AppendCharStringBuffer(buffer, '"') != TRI_ERROR_NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
escapedString = TRI_EscapeUtf8StringZ(TRI_UNKNOWN_MEM_ZONE,
|
||||
value->_value._string,
|
||||
strlen(value->_value._string),
|
||||
false,
|
||||
&outLength,
|
||||
false);
|
||||
if (escapedString == NULL) {
|
||||
return false;
|
||||
}
|
||||
length = strlen(value->_value._string);
|
||||
|
||||
if (length > 0) {
|
||||
char* escapedString;
|
||||
size_t outLength;
|
||||
|
||||
escapedString = TRI_EscapeUtf8StringZ(TRI_UNKNOWN_MEM_ZONE,
|
||||
value->_value._string,
|
||||
length,
|
||||
false,
|
||||
&outLength,
|
||||
false);
|
||||
|
||||
if (escapedString == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TRI_AppendString2StringBuffer(buffer, escapedString, outLength) != TRI_ERROR_NO_ERROR) {
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, escapedString);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TRI_AppendString2StringBuffer(buffer, escapedString, outLength) != TRI_ERROR_NO_ERROR) {
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, escapedString);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, escapedString);
|
||||
|
||||
return (TRI_AppendCharStringBuffer(buffer, '"') == TRI_ERROR_NO_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -500,6 +507,10 @@ bool TRI_NodeStringAql (TRI_string_buffer_t* const buffer,
|
|||
case TRI_AQL_NODE_VALUE: {
|
||||
return TRI_ValueStringAql(buffer, &node->_value, node->_value._type);
|
||||
}
|
||||
|
||||
case TRI_AQL_NODE_PARAMETER: {
|
||||
return TRI_AppendStringStringBuffer(buffer, TRI_AQL_NODE_STRING(node)) == TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
case TRI_AQL_NODE_ARRAY_ELEMENT: {
|
||||
if (! TRI_ValueStringAql(buffer, &node->_value, TRI_AQL_TYPE_STRING)) {
|
||||
|
@ -601,6 +612,18 @@ bool TRI_NodeStringAql (TRI_string_buffer_t* const buffer,
|
|||
|
||||
return TRI_AppendStringStringBuffer(buffer, TRI_AQL_NODE_STRING(node)) == TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
case TRI_AQL_NODE_BOUND_ATTRIBUTE_ACCESS: {
|
||||
if (! TRI_NodeStringAql(buffer, TRI_AQL_NODE_MEMBER(node, 0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TRI_AppendCharStringBuffer(buffer, '.') != TRI_ERROR_NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRI_NodeStringAql(buffer, TRI_AQL_NODE_MEMBER(node, 1));
|
||||
}
|
||||
|
||||
case TRI_AQL_NODE_INDEXED: {
|
||||
if (! TRI_NodeStringAql(buffer, TRI_AQL_NODE_MEMBER(node, 0))) {
|
||||
|
|
|
@ -483,16 +483,16 @@ union yyalloc
|
|||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 3
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 378
|
||||
#define YYLAST 380
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 55
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 52
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 110
|
||||
#define YYNRULES 113
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES 173
|
||||
#define YYNSTATES 176
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK 2
|
||||
|
@ -551,9 +551,9 @@ static const yytype_uint16 yyprhs[] =
|
|||
173, 177, 181, 185, 189, 193, 197, 203, 204, 206,
|
||||
208, 212, 214, 216, 217, 222, 223, 225, 227, 231,
|
||||
232, 237, 238, 240, 242, 246, 250, 252, 253, 258,
|
||||
260, 262, 266, 271, 274, 278, 282, 287, 289, 291,
|
||||
293, 295, 297, 299, 301, 303, 305, 307, 309, 311,
|
||||
313
|
||||
260, 262, 266, 270, 275, 278, 281, 285, 289, 293,
|
||||
298, 300, 302, 304, 306, 308, 310, 312, 314, 316,
|
||||
318, 320, 322, 324
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
|
@ -585,12 +585,13 @@ static const yytype_int8 yyrhs[] =
|
|||
-1, -1, 45, 92, 93, 46, -1, -1, 94, -1,
|
||||
95, -1, 94, 42, 95, -1, 104, 39, 76, -1,
|
||||
98, -1, -1, 96, 97, 37, 99, -1, 17, -1,
|
||||
79, -1, 98, 54, 17, -1, 98, 47, 76, 48,
|
||||
-1, 54, 17, -1, 47, 76, 48, -1, 99, 54,
|
||||
17, -1, 99, 47, 76, 48, -1, 102, -1, 103,
|
||||
-1, 106, -1, 20, -1, 18, -1, 101, -1, 14,
|
||||
-1, 15, -1, 16, -1, 21, -1, 17, -1, 18,
|
||||
-1, 17, -1, 19, -1
|
||||
79, -1, 98, 54, 17, -1, 98, 54, 103, -1,
|
||||
98, 47, 76, 48, -1, 54, 17, -1, 54, 103,
|
||||
-1, 47, 76, 48, -1, 99, 54, 17, -1, 99,
|
||||
54, 103, -1, 99, 47, 76, 48, -1, 102, -1,
|
||||
103, -1, 106, -1, 20, -1, 18, -1, 101, -1,
|
||||
14, -1, 15, -1, 16, -1, 21, -1, 17, -1,
|
||||
18, -1, 17, -1, 19, -1
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
|
@ -605,9 +606,9 @@ static const yytype_uint16 yyrline[] =
|
|||
645, 653, 661, 669, 677, 685, 696, 708, 710, 715,
|
||||
720, 728, 731, 737, 737, 750, 752, 757, 762, 770,
|
||||
770, 783, 785, 790, 792, 797, 805, 809, 809, 862,
|
||||
879, 886, 894, 905, 915, 925, 932, 942, 945, 951,
|
||||
954, 977, 985, 988, 996, 1004, 1015, 1026, 1033, 1042,
|
||||
1048
|
||||
879, 886, 894, 902, 913, 923, 933, 943, 951, 959,
|
||||
970, 973, 979, 982, 1007, 1016, 1019, 1028, 1037, 1049,
|
||||
1061, 1068, 1077, 1083
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -673,9 +674,9 @@ static const yytype_uint8 yyr1[] =
|
|||
82, 82, 82, 82, 82, 82, 83, 84, 84, 85,
|
||||
85, 86, 86, 88, 87, 89, 89, 90, 90, 92,
|
||||
91, 93, 93, 94, 94, 95, 96, 97, 96, 98,
|
||||
98, 98, 98, 99, 99, 99, 99, 100, 100, 101,
|
||||
101, 102, 102, 102, 102, 102, 103, 104, 104, 105,
|
||||
106
|
||||
98, 98, 98, 98, 99, 99, 99, 99, 99, 99,
|
||||
100, 100, 101, 101, 102, 102, 102, 102, 102, 103,
|
||||
104, 104, 105, 106
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
|
@ -690,9 +691,9 @@ static const yytype_uint8 yyr2[] =
|
|||
3, 3, 3, 3, 3, 3, 5, 0, 1, 1,
|
||||
3, 1, 1, 0, 4, 0, 1, 1, 3, 0,
|
||||
4, 0, 1, 1, 3, 3, 1, 0, 4, 1,
|
||||
1, 3, 4, 2, 3, 3, 4, 1, 1, 1,
|
||||
1, 3, 3, 4, 2, 2, 3, 3, 3, 4,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1
|
||||
1, 1, 1, 1
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
|
||||
|
@ -701,70 +702,70 @@ static const yytype_uint8 yyr2[] =
|
|||
static const yytype_uint8 yydefact[] =
|
||||
{
|
||||
3, 0, 0, 1, 0, 0, 0, 0, 17, 24,
|
||||
0, 4, 5, 7, 6, 8, 9, 10, 2, 109,
|
||||
0, 13, 14, 0, 103, 104, 105, 89, 101, 110,
|
||||
100, 106, 0, 0, 0, 36, 79, 73, 12, 47,
|
||||
0, 4, 5, 7, 6, 8, 9, 10, 2, 112,
|
||||
0, 13, 14, 0, 106, 107, 108, 89, 104, 113,
|
||||
103, 109, 0, 0, 0, 36, 79, 73, 12, 47,
|
||||
90, 38, 39, 40, 41, 71, 72, 43, 86, 42,
|
||||
102, 97, 98, 99, 34, 0, 0, 32, 0, 0,
|
||||
105, 100, 101, 102, 34, 0, 0, 32, 0, 0,
|
||||
0, 51, 49, 50, 0, 3, 81, 75, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 22,
|
||||
19, 0, 25, 26, 29, 0, 11, 15, 16, 35,
|
||||
0, 107, 108, 0, 82, 83, 0, 77, 0, 76,
|
||||
0, 110, 111, 0, 82, 83, 0, 77, 0, 76,
|
||||
65, 53, 52, 59, 60, 61, 62, 63, 64, 54,
|
||||
55, 56, 57, 58, 0, 44, 46, 67, 0, 0,
|
||||
91, 0, 0, 18, 0, 0, 30, 31, 28, 33,
|
||||
37, 80, 0, 0, 74, 0, 0, 69, 0, 68,
|
||||
0, 0, 88, 92, 23, 20, 21, 27, 84, 85,
|
||||
78, 66, 48, 0, 0, 93, 0, 0, 70, 94,
|
||||
0, 95, 96
|
||||
91, 92, 0, 0, 18, 0, 0, 30, 31, 28,
|
||||
33, 37, 80, 0, 0, 74, 0, 0, 69, 0,
|
||||
68, 0, 0, 88, 93, 23, 20, 21, 27, 84,
|
||||
85, 78, 66, 48, 0, 0, 94, 95, 0, 0,
|
||||
70, 96, 0, 97, 98, 99
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int16 yydefgoto[] =
|
||||
{
|
||||
-1, 1, 2, 11, 12, 13, 14, 21, 22, 15,
|
||||
55, 89, 90, 133, 16, 56, 92, 93, 138, 17,
|
||||
18, 94, 65, 39, 40, 85, 41, 42, 43, 148,
|
||||
149, 44, 45, 67, 108, 109, 46, 66, 103, 104,
|
||||
105, 47, 86, 48, 152, 49, 50, 51, 52, 106,
|
||||
55, 89, 90, 134, 16, 56, 92, 93, 139, 17,
|
||||
18, 94, 65, 39, 40, 85, 41, 42, 43, 149,
|
||||
150, 44, 45, 67, 108, 109, 46, 66, 103, 104,
|
||||
105, 47, 86, 48, 153, 49, 50, 51, 52, 106,
|
||||
23, 53
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
#define YYPACT_NINF -35
|
||||
#define YYPACT_NINF -75
|
||||
static const yytype_int16 yypact[] =
|
||||
{
|
||||
-35, 30, 147, -35, 29, 29, 172, 172, -35, -35,
|
||||
97, -35, -35, -35, -35, -35, -35, -35, -35, -35,
|
||||
12, 5, -35, 57, -35, -35, -35, -18, -35, -35,
|
||||
-35, -35, 172, 172, 172, 172, -35, -35, 281, 40,
|
||||
-35, -35, -35, -35, -35, -35, -35, 45, -34, -35,
|
||||
-35, -35, -35, -35, 281, 29, 172, 41, 172, 29,
|
||||
172, -35, -35, -35, 196, -35, 0, 172, 172, 172,
|
||||
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
|
||||
172, 172, 172, 172, 67, 42, 49, 172, 70, 2,
|
||||
-35, 81, 47, -35, 231, 97, 281, -35, 281, -35,
|
||||
61, -35, -35, 60, 68, -35, 69, 281, 71, 78,
|
||||
-24, 342, 331, 317, 317, 24, 24, 24, 24, 15,
|
||||
15, -35, -35, -35, 256, 306, -35, 172, -33, 7,
|
||||
-35, 29, 29, -35, 172, 172, -35, -35, -35, -35,
|
||||
-35, -35, 0, 172, -35, 172, 172, 281, 65, 80,
|
||||
172, 106, -31, -35, -35, -35, 281, -35, -35, 281,
|
||||
281, 306, -35, 172, 66, -35, 172, 107, 281, -35,
|
||||
137, -35, -35
|
||||
-75, 30, 119, -75, 32, 32, 174, 174, -75, -75,
|
||||
71, -75, -75, -75, -75, -75, -75, -75, -75, -75,
|
||||
35, 9, -75, 58, -75, -75, -75, 39, -75, -75,
|
||||
-75, -75, 174, 174, 174, 174, -75, -75, 283, 43,
|
||||
-75, -75, -75, -75, -75, -75, -75, 74, -34, -75,
|
||||
-75, -75, -75, -75, 283, 32, 174, 67, 174, 32,
|
||||
174, -75, -75, -75, 198, -75, 76, 174, 174, 174,
|
||||
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
|
||||
174, 174, 174, 174, 95, 75, 82, 174, 1, 2,
|
||||
-75, 110, 91, -75, 233, 71, 283, -75, 283, -75,
|
||||
73, -75, -75, 88, 93, -75, 97, 283, 89, 100,
|
||||
-24, 344, 333, 319, 319, 24, 24, 24, 24, 80,
|
||||
80, -75, -75, -75, 258, 308, -75, 174, -31, 7,
|
||||
-75, -75, 32, 32, -75, 174, 174, -75, -75, -75,
|
||||
-75, -75, -75, 76, 174, -75, 174, 174, 283, 99,
|
||||
102, 174, 4, -30, -75, -75, -75, 283, -75, -75,
|
||||
283, 283, 308, -75, 174, 72, -75, -75, 174, 29,
|
||||
283, -75, 139, -75, -75, -75
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-35, 62, -35, -35, -35, -35, -35, -35, 72, -35,
|
||||
-35, -35, 1, -35, -35, -35, -35, -10, -35, -35,
|
||||
-35, -6, -35, -35, -35, -35, -35, -35, -35, -35,
|
||||
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
|
||||
-16, -35, -35, -35, -35, -7, -35, -35, -35, -35,
|
||||
-2, -35
|
||||
-75, 81, -75, -75, -75, -75, -75, -75, 90, -75,
|
||||
-75, -75, 6, -75, -75, -75, -75, 11, -75, -75,
|
||||
-75, -6, -75, -75, -75, -75, -75, -75, -75, -75,
|
||||
-75, -75, -75, -75, -75, -75, -75, -75, -75, -75,
|
||||
5, -75, -75, -75, -75, -7, -75, -75, -74, -75,
|
||||
-2, -75
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
|
@ -774,47 +775,48 @@ static const yytype_int8 yypgoto[] =
|
|||
static const yytype_int16 yytable[] =
|
||||
{
|
||||
38, 54, 20, 57, 73, 74, 75, 76, 77, 78,
|
||||
79, 80, 81, 87, 150, 131, 166, 101, 102, 68,
|
||||
88, 151, -45, 167, 58, -45, 61, 62, 63, 64,
|
||||
79, 80, 81, 87, 131, 132, 151, 168, 130, 68,
|
||||
88, 166, 31, 152, 169, 31, 61, 62, 63, 64,
|
||||
3, 69, 70, 71, 72, 73, 74, 75, 76, 77,
|
||||
78, 79, 80, 81, 132, 82, 19, 59, 83, 79,
|
||||
80, 81, 96, 91, 98, 153, 77, 78, 79, 80,
|
||||
78, 79, 80, 81, 133, 82, 173, 58, 83, 19,
|
||||
31, 59, 96, 91, 98, 154, 77, 78, 79, 80,
|
||||
81, 107, 110, 111, 112, 113, 114, 115, 116, 117,
|
||||
118, 119, 120, 121, 122, 123, 124, 125, 68, 60,
|
||||
84, 129, -87, 95, 126, 127, 128, 130, 139, 135,
|
||||
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
||||
79, 80, 81, 134, 82, 140, 141, 83, 143, 162,
|
||||
142, 24, 25, 26, 169, 28, 29, 30, 31, 144,
|
||||
145, 147, 163, 165, 171, 157, 158, 100, 156, 154,
|
||||
91, 97, 0, 155, 0, 0, 0, 159, 0, 160,
|
||||
161, 0, 0, 0, 164, 0, 0, 0, 0, 68,
|
||||
4, 5, 6, 7, 8, 9, 10, 168, 0, 0,
|
||||
170, 69, 70, 71, 72, 73, 74, 75, 76, 77,
|
||||
78, 79, 80, 81, 0, 82, 0, 0, 83, 0,
|
||||
0, 0, 0, 0, 0, 172, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 0, 32, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 33, 34, 0, 0, 68, 0,
|
||||
0, 0, 0, 0, 0, 35, 0, 36, 0, 37,
|
||||
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
||||
79, 80, 81, 0, 82, 0, 0, 83, 0, 0,
|
||||
99, 136, 137, 68, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 69, 70, 71, 72, 73,
|
||||
74, 75, 76, 77, 78, 79, 80, 81, 68, 82,
|
||||
0, 0, 83, 0, 0, 0, 0, 0, 0, 0,
|
||||
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
||||
79, 80, 81, 68, 82, 146, 0, 83, 0, 0,
|
||||
0, 0, 0, 0, 0, 69, 70, 71, 72, 73,
|
||||
74, 75, 76, 77, 78, 79, 80, 81, 68, 82,
|
||||
0, 0, 83, 0, 0, 0, 0, 0, 0, 68,
|
||||
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
||||
79, 80, 81, 68, 82, 73, 74, 75, 76, 77,
|
||||
78, 79, 80, 81, 68, 69, 0, 71, 72, 73,
|
||||
74, 75, 76, 77, 78, 79, 80, 81, 71, 72,
|
||||
73, 74, 75, 76, 77, 78, 79, 80, 81
|
||||
118, 119, 120, 121, 122, 123, 124, 125, 167, -45,
|
||||
60, 129, -45, 84, 68, 24, 25, 26, 140, 28,
|
||||
29, 30, 31, 101, 102, 174, 69, 70, 71, 72,
|
||||
73, 74, 75, 76, 77, 78, 79, 80, 81, 95,
|
||||
82, -87, 126, 83, 79, 80, 81, 141, 127, 128,
|
||||
171, 148, 4, 5, 6, 7, 8, 9, 10, 157,
|
||||
155, 91, 135, 136, 142, 143, 144, 145, 160, 156,
|
||||
161, 162, 146, 163, 164, 165, 100, 158, 159, 97,
|
||||
0, 68, 0, 0, 0, 0, 0, 0, 170, 0,
|
||||
0, 0, 172, 69, 70, 71, 72, 73, 74, 75,
|
||||
76, 77, 78, 79, 80, 81, 0, 82, 0, 0,
|
||||
83, 0, 0, 0, 0, 0, 0, 175, 24, 25,
|
||||
26, 27, 28, 29, 30, 31, 0, 32, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 33, 34, 0, 0,
|
||||
68, 0, 0, 0, 0, 0, 0, 35, 0, 36,
|
||||
0, 37, 69, 70, 71, 72, 73, 74, 75, 76,
|
||||
77, 78, 79, 80, 81, 0, 82, 0, 0, 83,
|
||||
0, 0, 99, 137, 138, 68, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 69, 70, 71,
|
||||
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
|
||||
68, 82, 0, 0, 83, 0, 0, 0, 0, 0,
|
||||
0, 0, 69, 70, 71, 72, 73, 74, 75, 76,
|
||||
77, 78, 79, 80, 81, 68, 82, 147, 0, 83,
|
||||
0, 0, 0, 0, 0, 0, 0, 69, 70, 71,
|
||||
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
|
||||
68, 82, 0, 0, 83, 0, 0, 0, 0, 0,
|
||||
0, 68, 69, 70, 71, 72, 73, 74, 75, 76,
|
||||
77, 78, 79, 80, 81, 68, 82, 73, 74, 75,
|
||||
76, 77, 78, 79, 80, 81, 68, 69, 0, 71,
|
||||
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
|
||||
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
|
||||
81
|
||||
};
|
||||
|
||||
#define yypact_value_is_default(Yystate) \
|
||||
(!!((Yystate) == (-35)))
|
||||
(!!((Yystate) == (-75)))
|
||||
|
||||
#define yytable_value_is_error(Yytable_value) \
|
||||
YYID (0)
|
||||
|
@ -822,43 +824,44 @@ static const yytype_int16 yytable[] =
|
|||
static const yytype_int16 yycheck[] =
|
||||
{
|
||||
6, 7, 4, 10, 28, 29, 30, 31, 32, 33,
|
||||
34, 35, 36, 47, 47, 13, 47, 17, 18, 12,
|
||||
54, 54, 40, 54, 12, 43, 32, 33, 34, 35,
|
||||
34, 35, 36, 47, 88, 13, 47, 47, 17, 12,
|
||||
54, 17, 21, 54, 54, 21, 32, 33, 34, 35,
|
||||
0, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||
33, 34, 35, 36, 42, 38, 17, 42, 41, 34,
|
||||
35, 36, 58, 55, 60, 48, 32, 33, 34, 35,
|
||||
33, 34, 35, 36, 42, 38, 17, 12, 41, 17,
|
||||
21, 42, 58, 55, 60, 48, 32, 33, 34, 35,
|
||||
36, 67, 68, 69, 70, 71, 72, 73, 74, 75,
|
||||
76, 77, 78, 79, 80, 81, 82, 83, 12, 22,
|
||||
40, 87, 37, 42, 17, 43, 37, 17, 95, 42,
|
||||
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
|
||||
34, 35, 36, 22, 38, 44, 46, 41, 39, 44,
|
||||
42, 14, 15, 16, 48, 18, 19, 20, 21, 48,
|
||||
42, 127, 42, 17, 17, 135, 142, 65, 134, 131,
|
||||
132, 59, -1, 132, -1, -1, -1, 143, -1, 145,
|
||||
146, -1, -1, -1, 150, -1, -1, -1, -1, 12,
|
||||
3, 4, 5, 6, 7, 8, 9, 163, -1, -1,
|
||||
166, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||
33, 34, 35, 36, -1, 38, -1, -1, 41, -1,
|
||||
-1, -1, -1, -1, -1, 48, 14, 15, 16, 17,
|
||||
18, 19, 20, 21, -1, 23, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, 32, 33, -1, -1, 12, -1,
|
||||
-1, -1, -1, -1, -1, 43, -1, 45, -1, 47,
|
||||
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
|
||||
34, 35, 36, -1, 38, -1, -1, 41, -1, -1,
|
||||
44, 10, 11, 12, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 32, 33, 34, 35, 36, 12, 38,
|
||||
-1, -1, 41, -1, -1, -1, -1, -1, -1, -1,
|
||||
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
|
||||
34, 35, 36, 12, 38, 39, -1, 41, -1, -1,
|
||||
-1, -1, -1, -1, -1, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 32, 33, 34, 35, 36, 12, 38,
|
||||
-1, -1, 41, -1, -1, -1, -1, -1, -1, 12,
|
||||
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
|
||||
34, 35, 36, 12, 38, 28, 29, 30, 31, 32,
|
||||
33, 34, 35, 36, 12, 24, -1, 26, 27, 28,
|
||||
29, 30, 31, 32, 33, 34, 35, 36, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 34, 35, 36
|
||||
76, 77, 78, 79, 80, 81, 82, 83, 152, 40,
|
||||
22, 87, 43, 40, 12, 14, 15, 16, 95, 18,
|
||||
19, 20, 21, 17, 18, 169, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 34, 35, 36, 42,
|
||||
38, 37, 17, 41, 34, 35, 36, 44, 43, 37,
|
||||
48, 127, 3, 4, 5, 6, 7, 8, 9, 135,
|
||||
132, 133, 22, 42, 46, 42, 39, 48, 144, 133,
|
||||
146, 147, 42, 44, 42, 151, 65, 136, 143, 59,
|
||||
-1, 12, -1, -1, -1, -1, -1, -1, 164, -1,
|
||||
-1, -1, 168, 24, 25, 26, 27, 28, 29, 30,
|
||||
31, 32, 33, 34, 35, 36, -1, 38, -1, -1,
|
||||
41, -1, -1, -1, -1, -1, -1, 48, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, -1, 23, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 32, 33, -1, -1,
|
||||
12, -1, -1, -1, -1, -1, -1, 43, -1, 45,
|
||||
-1, 47, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, -1, 38, -1, -1, 41,
|
||||
-1, -1, 44, 10, 11, 12, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 24, 25, 26,
|
||||
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
||||
12, 38, -1, -1, 41, -1, -1, -1, -1, -1,
|
||||
-1, -1, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 12, 38, 39, -1, 41,
|
||||
-1, -1, -1, -1, -1, -1, -1, 24, 25, 26,
|
||||
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
||||
12, 38, -1, -1, 41, -1, -1, -1, -1, -1,
|
||||
-1, 12, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 12, 38, 28, 29, 30,
|
||||
31, 32, 33, 34, 35, 36, 12, 24, -1, 26,
|
||||
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
||||
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
||||
36
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
|
@ -878,11 +881,11 @@ static const yytype_uint8 yystos[] =
|
|||
56, 17, 18, 93, 94, 95, 104, 76, 89, 90,
|
||||
76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
|
||||
76, 76, 76, 76, 76, 76, 17, 43, 37, 76,
|
||||
17, 13, 42, 68, 22, 42, 10, 11, 73, 100,
|
||||
44, 46, 42, 39, 48, 42, 39, 76, 84, 85,
|
||||
47, 54, 99, 48, 105, 67, 76, 72, 95, 76,
|
||||
76, 76, 44, 42, 76, 17, 47, 54, 76, 48,
|
||||
76, 17, 48
|
||||
17, 103, 13, 42, 68, 22, 42, 10, 11, 73,
|
||||
100, 44, 46, 42, 39, 48, 42, 39, 76, 84,
|
||||
85, 47, 54, 99, 48, 105, 67, 76, 72, 95,
|
||||
76, 76, 76, 44, 42, 76, 17, 103, 47, 54,
|
||||
76, 48, 76, 17, 103, 48
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
|
@ -2815,7 +2818,7 @@ yyreduce:
|
|||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
|
||||
if (! (yyval.node)) {
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -2828,7 +2831,7 @@ yyreduce:
|
|||
// named variable access, e.g. variable.reference
|
||||
(yyval.node) = TRI_CreateNodeAttributeAccessAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].strval));
|
||||
|
||||
if (! (yyval.node)) {
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -2838,10 +2841,10 @@ yyreduce:
|
|||
/* Line 1778 of yacc.c */
|
||||
#line 894 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
// indexed variable access, e.g. variable[index]
|
||||
(yyval.node) = TRI_CreateNodeIndexedAql(context, (yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].node));
|
||||
// named variable access, e.g. variable.@reference
|
||||
(yyval.node) = TRI_CreateNodeBoundAttributeAccessAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
|
||||
if (! (yyval.node)) {
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -2849,14 +2852,12 @@ yyreduce:
|
|||
|
||||
case 93:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 905 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 902 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
// named variable access, continuation from * expansion, e.g. [*].variable.reference
|
||||
TRI_aql_node_t* node = TRI_PopStackParseAql(context);
|
||||
|
||||
(yyval.node) = TRI_CreateNodeAttributeAccessAql(context, node, (yyvsp[(2) - (2)].strval));
|
||||
|
||||
if (! (yyval.node)) {
|
||||
// indexed variable access, e.g. variable[index]
|
||||
(yyval.node) = TRI_CreateNodeIndexedAql(context, (yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].node));
|
||||
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -2864,14 +2865,14 @@ yyreduce:
|
|||
|
||||
case 94:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 915 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 913 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
// indexed variable access, continuation from * expansion, e.g. [*].variable[index]
|
||||
// named variable access, continuation from * expansion, e.g. [*].variable.reference
|
||||
TRI_aql_node_t* node = TRI_PopStackParseAql(context);
|
||||
|
||||
(yyval.node) = TRI_CreateNodeIndexedAql(context, node, (yyvsp[(2) - (3)].node));
|
||||
(yyval.node) = TRI_CreateNodeAttributeAccessAql(context, node, (yyvsp[(2) - (2)].strval));
|
||||
|
||||
if (! (yyval.node)) {
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -2879,11 +2880,14 @@ yyreduce:
|
|||
|
||||
case 95:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 925 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 923 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
// named variable access, continuation from * expansion, e.g. [*].variable.xx.reference
|
||||
(yyval.node) = TRI_CreateNodeAttributeAccessAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].strval));
|
||||
if (! (yyval.node)) {
|
||||
// named variable access w/ bind parameter, continuation from * expansion, e.g. [*].variable.@reference
|
||||
TRI_aql_node_t* node = TRI_PopStackParseAql(context);
|
||||
|
||||
(yyval.node) = TRI_CreateNodeBoundAttributeAccessAql(context, node, (yyvsp[(2) - (2)].node));
|
||||
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -2891,11 +2895,14 @@ yyreduce:
|
|||
|
||||
case 96:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 932 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 933 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
// indexed variable access, continuation from * expansion, e.g. [*].variable.xx.[index]
|
||||
(yyval.node) = TRI_CreateNodeIndexedAql(context, (yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].node));
|
||||
if (! (yyval.node)) {
|
||||
// indexed variable access, continuation from * expansion, e.g. [*].variable[index]
|
||||
TRI_aql_node_t* node = TRI_PopStackParseAql(context);
|
||||
|
||||
(yyval.node) = TRI_CreateNodeIndexedAql(context, node, (yyvsp[(2) - (3)].node));
|
||||
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -2903,31 +2910,70 @@ yyreduce:
|
|||
|
||||
case 97:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 942 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 943 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
// named variable access, continuation from * expansion, e.g. [*].variable.xx.reference
|
||||
(yyval.node) = TRI_CreateNodeAttributeAccessAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].strval));
|
||||
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 98:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 945 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 951 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
// named variable access w/ bind parameter, continuation from * expansion, e.g. [*].variable.xx.@reference
|
||||
(yyval.node) = TRI_CreateNodeBoundAttributeAccessAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 99:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 951 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 959 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
// indexed variable access, continuation from * expansion, e.g. [*].variable.xx.[index]
|
||||
(yyval.node) = TRI_CreateNodeIndexedAql(context, (yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].node));
|
||||
|
||||
if ((yyval.node) == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 100:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 954 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 970 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
}
|
||||
break;
|
||||
|
||||
case 101:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 973 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
}
|
||||
break;
|
||||
|
||||
case 102:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 979 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
}
|
||||
break;
|
||||
|
||||
case 103:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 982 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node;
|
||||
double value;
|
||||
|
@ -2937,46 +2983,14 @@ yyreduce:
|
|||
}
|
||||
|
||||
value = TRI_DoubleString((yyvsp[(1) - (1)].strval));
|
||||
|
||||
if (TRI_errno() != TRI_ERROR_NO_ERROR) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, NULL);
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
node = TRI_CreateNodeValueDoubleAql(context, value);
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
(yyval.node) = node;
|
||||
}
|
||||
break;
|
||||
|
||||
case 101:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 977 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueStringAql(context, (yyvsp[(1) - (1)].strval));
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
(yyval.node) = node;
|
||||
}
|
||||
break;
|
||||
|
||||
case 102:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 985 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
}
|
||||
break;
|
||||
|
||||
case 103:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 988 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueNullAql(context);
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -2987,9 +3001,10 @@ yyreduce:
|
|||
|
||||
case 104:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 996 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 1007 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, true);
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueStringAql(context, (yyvsp[(1) - (1)].strval));
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -3000,22 +3015,18 @@ yyreduce:
|
|||
|
||||
case 105:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1004 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 1016 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, false);
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
(yyval.node) = node;
|
||||
(yyval.node) = (yyvsp[(1) - (1)].node);
|
||||
}
|
||||
break;
|
||||
|
||||
case 106:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1015 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 1019 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeParameterAql(context, (yyvsp[(1) - (1)].strval));
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueNullAql(context);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -3026,19 +3037,49 @@ yyreduce:
|
|||
|
||||
case 107:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1026 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 1028 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
if (! (yyvsp[(1) - (1)].strval)) {
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, true);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
(yyval.strval) = (yyvsp[(1) - (1)].strval);
|
||||
(yyval.node) = node;
|
||||
}
|
||||
break;
|
||||
|
||||
case 108:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1033 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 1037 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, false);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
(yyval.node) = node;
|
||||
}
|
||||
break;
|
||||
|
||||
case 109:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1049 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeParameterAql(context, (yyvsp[(1) - (1)].strval));
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
(yyval.node) = node;
|
||||
}
|
||||
break;
|
||||
|
||||
case 110:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1061 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
if (! (yyvsp[(1) - (1)].strval)) {
|
||||
ABORT_OOM
|
||||
|
@ -3048,17 +3089,29 @@ yyreduce:
|
|||
}
|
||||
break;
|
||||
|
||||
case 109:
|
||||
case 111:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1042 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 1068 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
if (! (yyvsp[(1) - (1)].strval)) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
(yyval.strval) = (yyvsp[(1) - (1)].strval);
|
||||
}
|
||||
break;
|
||||
|
||||
case 112:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1077 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
(yyval.strval) = (yyvsp[(1) - (1)].strval);
|
||||
}
|
||||
break;
|
||||
|
||||
case 110:
|
||||
case 113:
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 1048 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
#line 1083 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node;
|
||||
int64_t value;
|
||||
|
@ -3084,7 +3137,7 @@ yyreduce:
|
|||
|
||||
|
||||
/* Line 1778 of yacc.c */
|
||||
#line 3088 "arangod/Ahuacatl/ahuacatl-grammar.c"
|
||||
#line 3141 "arangod/Ahuacatl/ahuacatl-grammar.c"
|
||||
default: break;
|
||||
}
|
||||
/* User semantic actions sometimes alter yychar, and that requires
|
||||
|
|
|
@ -879,7 +879,7 @@ single_reference:
|
|||
| function_call {
|
||||
$$ = $1;
|
||||
|
||||
if (! $$) {
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -887,7 +887,15 @@ single_reference:
|
|||
// named variable access, e.g. variable.reference
|
||||
$$ = TRI_CreateNodeAttributeAccessAql(context, $1, $3);
|
||||
|
||||
if (! $$) {
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
| single_reference '.' bind_parameter %prec REFERENCE {
|
||||
// named variable access, e.g. variable.@reference
|
||||
$$ = TRI_CreateNodeBoundAttributeAccessAql(context, $1, $3);
|
||||
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -895,7 +903,7 @@ single_reference:
|
|||
// indexed variable access, e.g. variable[index]
|
||||
$$ = TRI_CreateNodeIndexedAql(context, $1, $3);
|
||||
|
||||
if (! $$) {
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -908,7 +916,17 @@ expansion:
|
|||
|
||||
$$ = TRI_CreateNodeAttributeAccessAql(context, node, $2);
|
||||
|
||||
if (! $$) {
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
| '.' bind_parameter %prec REFERENCE {
|
||||
// named variable access w/ bind parameter, continuation from * expansion, e.g. [*].variable.@reference
|
||||
TRI_aql_node_t* node = TRI_PopStackParseAql(context);
|
||||
|
||||
$$ = TRI_CreateNodeBoundAttributeAccessAql(context, node, $2);
|
||||
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -918,21 +936,31 @@ expansion:
|
|||
|
||||
$$ = TRI_CreateNodeIndexedAql(context, node, $2);
|
||||
|
||||
if (! $$) {
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
| expansion '.' T_STRING %prec REFERENCE {
|
||||
// named variable access, continuation from * expansion, e.g. [*].variable.xx.reference
|
||||
$$ = TRI_CreateNodeAttributeAccessAql(context, $1, $3);
|
||||
if (! $$) {
|
||||
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
| expansion '.' bind_parameter %prec REFERENCE {
|
||||
// named variable access w/ bind parameter, continuation from * expansion, e.g. [*].variable.xx.@reference
|
||||
$$ = TRI_CreateNodeBoundAttributeAccessAql(context, $1, $3);
|
||||
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
| expansion T_LIST_OPEN expression T_LIST_CLOSE %prec INDEXED {
|
||||
// indexed variable access, continuation from * expansion, e.g. [*].variable.xx.[index]
|
||||
$$ = TRI_CreateNodeIndexedAql(context, $1, $3);
|
||||
if (! $$) {
|
||||
|
||||
if ($$ == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
}
|
||||
|
@ -960,12 +988,14 @@ numeric_value:
|
|||
}
|
||||
|
||||
value = TRI_DoubleString($1);
|
||||
|
||||
if (TRI_errno() != TRI_ERROR_NO_ERROR) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, NULL);
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
node = TRI_CreateNodeValueDoubleAql(context, value);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -976,6 +1006,7 @@ numeric_value:
|
|||
value_literal:
|
||||
T_QUOTED_STRING {
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueStringAql(context, $1);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -987,6 +1018,7 @@ value_literal:
|
|||
}
|
||||
| T_NULL {
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueNullAql(context);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -995,6 +1027,7 @@ value_literal:
|
|||
}
|
||||
| T_TRUE {
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, true);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -1003,6 +1036,7 @@ value_literal:
|
|||
}
|
||||
| T_FALSE {
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, false);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
@ -1014,6 +1048,7 @@ value_literal:
|
|||
bind_parameter:
|
||||
T_PARAMETER {
|
||||
TRI_aql_node_t* node = TRI_CreateNodeParameterAql(context, $1);
|
||||
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
|
|
@ -167,6 +167,8 @@ const char* TRI_NodeNameAql (const TRI_aql_node_type_e type) {
|
|||
return "subquery";
|
||||
case TRI_AQL_NODE_ATTRIBUTE_ACCESS:
|
||||
return "attribute access";
|
||||
case TRI_AQL_NODE_BOUND_ATTRIBUTE_ACCESS:
|
||||
return "bound attribute access";
|
||||
case TRI_AQL_NODE_INDEXED:
|
||||
return "indexed";
|
||||
case TRI_AQL_NODE_EXPAND:
|
||||
|
|
|
@ -172,6 +172,7 @@ typedef enum {
|
|||
TRI_AQL_NODE_OPERATOR_TERNARY,
|
||||
TRI_AQL_NODE_SUBQUERY,
|
||||
TRI_AQL_NODE_ATTRIBUTE_ACCESS,
|
||||
TRI_AQL_NODE_BOUND_ATTRIBUTE_ACCESS,
|
||||
TRI_AQL_NODE_INDEXED,
|
||||
TRI_AQL_NODE_EXPAND,
|
||||
TRI_AQL_NODE_VALUE,
|
||||
|
|
|
@ -355,6 +355,7 @@ TRI_aql_statement_walker_t* TRI_CreateStatementWalkerAql (void* data,
|
|||
walker->postVisitStatement = postVisitStatement;
|
||||
|
||||
res = TRI_InitVectorPointer2(&walker->_currentScopes, TRI_UNKNOWN_MEM_ZONE, 4);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, walker);
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@
|
|||
.statClient {
|
||||
float: left;
|
||||
height: 100px;
|
||||
width: 237px;
|
||||
margin-left: 5px !important;
|
||||
width: 230px;
|
||||
margin-left: 13px !important;
|
||||
margin-bottom: 5px !important;
|
||||
background-color: #FFFFFF !important;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ li:hover h6, li.hover h6 {
|
|||
margin-bottom: 16px;
|
||||
margin-top: 0px;
|
||||
margin-right: 5px !important;
|
||||
margin-left: 5px !important;
|
||||
margin-left: 12px !important;
|
||||
padding: 0 !important;
|
||||
height: 24px !important;
|
||||
width: auto !important;
|
||||
|
@ -488,5 +488,8 @@ li:hover h6, li.hover h6 {
|
|||
margin-top: 5px;
|
||||
padding-left: 7px;
|
||||
font-size: 15px;
|
||||
|
||||
}
|
||||
|
||||
#dbThumbnailsIn {
|
||||
margin-left: -7px;
|
||||
}
|
||||
|
|
|
@ -135,5 +135,6 @@
|
|||
</div>
|
||||
</li>
|
||||
</div>
|
||||
<div id="dbThumbnailsIn"/>
|
||||
|
||||
</ul>
|
||||
|
|
|
@ -213,7 +213,7 @@ var dashboardView = Backbone.View.extend({
|
|||
|
||||
var counter = 1;
|
||||
$.each(this.options.description.models[0].attributes.groups, function () {
|
||||
$('.thumbnails').append(
|
||||
$('#dbThumbnailsIn').append(
|
||||
'<ul class="statGroups" id="' + this.group + '">' +
|
||||
'<i class="group-close icon-minus icon-white"></i>' +
|
||||
'<div id="statsHeaderDiv"><h4 class="statsHeader">' + this.name + '</h4></div>' +
|
||||
|
|
|
@ -368,6 +368,83 @@ function ahuacatlBindTestSuite () {
|
|||
assertException(function() { getQueryResults("FOR u IN [ 1, 2, 3 ] LIMIT @offset, @count RETURN u", { "offset" : 1, "count" : "foo" }); });
|
||||
assertException(function() { getQueryResults("FOR u IN [ 1, 2, 3 ] LIMIT @offset, @count RETURN u", { "offset" : "foo", "count" : "foo" }); });
|
||||
assertException(function() { getQueryResults("FOR u IN [ 1, 2, 3 ] LIMIT @offset, @count RETURN u", { "offset" : -1, "count" : -1 }); });
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test bound attribute names
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testBindAttributeNames1 : function () {
|
||||
var actual = getQueryResults("FOR u IN [ { age: 1 }, { age: 2 }, { age: 3 } ] RETURN u.@what", { "what": "age" });
|
||||
|
||||
assertEqual([ 1, 2, 3 ], actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test bound attribute names
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testBindAttributeNames2 : function () {
|
||||
var actual = getQueryResults("FOR u IN [ { age: 1 }, { age: 2 }, { age: 3 } ] FILTER u.@what == @age RETURN u.@what", { "what": "age", "age": 2 });
|
||||
|
||||
assertEqual([ 2 ], actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test bound attribute names
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testBindAttributeNames3 : function () {
|
||||
var actual = getQueryResults("FOR u IN [ { age1: 1 }, { age2: 2 }, { age3: 3 } ] RETURN u.@what", { "what": "age2" });
|
||||
|
||||
assertEqual([ null, 2, null ], actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test bound attribute names
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testBindAttributeNames4 : function () {
|
||||
var actual = getQueryResults("FOR u IN [ { `the fox` : 1 }, { `the-foxx` : 2 }, { `3`: 3 } ] FILTER u.@what == @value RETURN @value", { "what" : "the fox", "value" : 1 });
|
||||
assertEqual([ 1 ], actual);
|
||||
|
||||
actual = getQueryResults("FOR u IN [ { `the fox` : 1 }, { `the-foxx` : 2 }, { `3`: 3 } ] FILTER u.@what == @value RETURN @value", { "what" : "the-foxx", "value" : 2 });
|
||||
assertEqual([ 2 ], actual);
|
||||
|
||||
actual = getQueryResults("FOR u IN [ { `the fox` : 1 }, { `the-foxx` : 2 }, { `3`: 3 } ] FILTER u.@what == @value RETURN @value", { "what" : "3", "value" : 3 });
|
||||
assertEqual([ 3 ], actual);
|
||||
|
||||
actual = getQueryResults("FOR u IN [ { `the fox` : 1 }, { `the-foxx` : 2 }, { `3`: 3 } ] FILTER HAS(u, @what) RETURN u", { "what" : "the fox" });
|
||||
assertEqual([ { "the fox" : 1 } ], actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test bound attribute names
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testBindAttributeNames5 : function () {
|
||||
var actual = getQueryResults("FOR u IN [ { name: { first: 'foo', last: 'bar' } } ] FILTER u.name.@part1 == 'foo' && u.name.@part2 == 'bar' RETURN u", { "part1" : "first", "part2" : "last" });
|
||||
assertEqual([ { name: { first: "foo", last: "bar" } } ], actual);
|
||||
|
||||
actual = getQueryResults("FOR u IN [ { name: { first: 'foo', last: 'bar' } } ] FILTER u.@part1.@first == 'foo' && u.@part1.@last == 'bar' RETURN u", { "part1" : "name", "first" : "first", "last" : "last" });
|
||||
assertEqual([ { name: { first: "foo", last: "bar" } } ], actual);
|
||||
|
||||
actual = getQueryResults("FOR u IN [ { values: [ { age: 28 }, { age: 30 }, { age: 40 } ] } ] RETURN u.values[*].@what", { "what" : "age" });
|
||||
assertEqual([ [ 28, 30, 40 ] ], actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test bound attribute names
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testBindAttributeNamesInvalid : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_BIND_PARAMETER_TYPE.code, "FOR u IN [ { age: 1 }, { age: 2 } ] RETURN u.@what", { "what" : 1 });
|
||||
assertQueryError(errors.ERROR_QUERY_BIND_PARAMETER_TYPE.code, "FOR u IN [ { age: 1 }, { age: 2 } ] RETURN u.@what", { "what" : true });
|
||||
assertQueryError(errors.ERROR_QUERY_BIND_PARAMETER_TYPE.code, "FOR u IN [ { age: 1 }, { age: 2 } ] RETURN u.@what", { "what" : null });
|
||||
assertQueryError(errors.ERROR_QUERY_BIND_PARAMETER_TYPE.code, "FOR u IN [ { age: 1 }, { age: 2 } ] RETURN u.@what", { "what" : "" });
|
||||
assertQueryError(errors.ERROR_QUERY_BIND_PARAMETER_TYPE.code, "FOR u IN [ { age: 1 }, { age: 2 } ] RETURN u.@what", { "what" : [ ] });
|
||||
assertQueryError(errors.ERROR_QUERY_BIND_PARAMETER_TYPE.code, "FOR u IN [ { age: 1 }, { age: 2 } ] RETURN u.@what", { "what" : { } });
|
||||
assertQueryError(errors.ERROR_QUERY_BIND_PARAMETER_MISSING.code, "FOR u IN [ { age: 1 }, { age: 2 } ] RETURN u.@what", { "age" : "age" });
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -29,6 +29,7 @@ var jsunity = require("jsunity");
|
|||
var internal = require("internal");
|
||||
var helper = require("org/arangodb/aql-helper");
|
||||
var getQueryResults = helper.getQueryResults;
|
||||
var getQueryExplanation = helper.getQueryExplanation;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test suite
|
||||
|
@ -161,8 +162,43 @@ function ahuacatlQueryOptimiserRefTestSuite () {
|
|||
var actual = getQueryResults("FOR u1 IN " + cn + " FOR u2 IN " + cn + " FILTER u2.name == u1.name && u1.name == u2.name && u2.name == u1.name && u1._id == u2._id SORT u1.id RETURN { \"name\" : u1.name }");
|
||||
|
||||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief check a ref access with index and bind parameters
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRefAccessIndexBind1 : function () {
|
||||
users.ensureHashIndex("name");
|
||||
|
||||
var expected = [ 28 ];
|
||||
var query = "FOR u IN " + cn + " FILTER u.@att == 'Diego' RETURN u.@what";
|
||||
var actual = getQueryResults(query, { "att" : "name", "what" : "age" });
|
||||
|
||||
assertEqual(expected, actual);
|
||||
|
||||
var explain = getQueryExplanation(query, { "att": "name", "what": "age" });
|
||||
assertEqual("for", explain[0].type);
|
||||
assertEqual("index", explain[0].expression.extra.accessType);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief check a ref access with index and bind parameters
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRefAccessIndexBind2 : function () {
|
||||
var expected = [ "Diego" ];
|
||||
var query = "FOR u IN " + cn + " FILTER u.@att == 28 RETURN u.@what";
|
||||
var actual = getQueryResults(query, { "att" : "age", "what" : "name" });
|
||||
|
||||
assertEqual(expected, actual);
|
||||
|
||||
var explain = getQueryExplanation(query, { "att": "age", "what": "name" });
|
||||
assertEqual("for", explain[0].type);
|
||||
assertEqual("all", explain[0].expression.extra.accessType);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue