@@ -24,21 +24,99 @@ Feature: Execute a a raw UPDATE query in JCR_SQL2
24
24
| UPDATE nt :unstructured AS a SET title = 'DTL ' WHERE localname () = 'article1 ' | /cms /articles /article1 | title | DTL |
25
25
| UPDATE nt :unstructured AS a SET title = 'DTL ', foobar ='barfoo ' WHERE localname () = 'article1 ' | /cms /articles /article1 | foobar | barfoo |
26
26
27
- Scenario : Update multivalue index by value
27
+ Scenario : Replace a multivalue index by value
28
28
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = 'Rockets' WHERE a.tags = 'Trains'" command
29
29
And I save the session
30
30
Then the command should not fail
31
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Rockets" at index "1"
32
+
33
+ Scenario : Set a multivalue value
34
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = ['Rockets', 'Dragons'] WHERE a.tags = 'Trains'" command
35
+ And I save the session
36
+ Then the command should not fail
37
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Rockets" at index "0"
38
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Dragons" at index "1"
39
+
40
+ Scenario : Update single multivalue
41
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = 'Rockets' WHERE a.tags = 'Planes'" command
42
+ And I save the session
43
+ Then the command should not fail
31
44
And I should see the following:
32
45
"""
33
- Cannot update property "tags". Updating multi-value nodes with more than one element not currently supported
46
+ 1 row(s) affected
34
47
"""
48
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Rockets" at index "0"
49
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "2"
35
50
36
- Scenario : Update single multivalue
37
- Given I execute the "UPDATE [nt:unstructured] AS a SET a.tag = 'Rockets' WHERE a.tags = 'Planes'" command
51
+ Scenario : Update single multivalue without selector
52
+ Given I execute the "UPDATE [nt:unstructured] SET tags = 'Rockets' WHERE tags = 'Planes'" command
53
+ And I save the session
54
+ Then the command should not fail
55
+ And I should see the following:
56
+ """
57
+ 1 row(s) affected
58
+ """
59
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Rockets" at index "0"
60
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "2"
61
+
62
+ Scenario : Remove single multivalue
63
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = NULL WHERE a.tags = 'Planes'" command
64
+ And I save the session
65
+ Then the command should not fail
66
+ And I should see the following:
67
+ """
68
+ 1 row(s) affected
69
+ """
70
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Trains" at index "0"
71
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "1"
72
+
73
+ Scenario : Remove single multivalue by index
74
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags[0] = NULL WHERE a.tags = 'Planes'" command
38
75
And I save the session
39
76
Then the command should not fail
40
77
And I should see the following:
41
78
"""
42
79
1 row(s) affected
43
80
"""
44
- And the node at "/cms/articles/article1" should have the property "tag" with value "Rockets" at index "0"
81
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Trains" at index "0"
82
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "1"
83
+
84
+ Scenario : Add a multivalue property
85
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags[] = 'Kite' WHERE a.tags = 'Planes'" command
86
+ And I save the session
87
+ Then the command should not fail
88
+ And I should see the following:
89
+ """
90
+ 1 row(s) affected
91
+ """
92
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Planes" at index "0"
93
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "2"
94
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Kite" at index "3"
95
+
96
+ Scenario : Replace a multivalue property by index
97
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags[1] = 'Kite', a.tags[2] = 'foobar' WHERE a.tags = 'Planes'" command
98
+ And I save the session
99
+ Then the command should not fail
100
+ And I should see the following:
101
+ """
102
+ 1 row(s) affected
103
+ """
104
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Planes" at index "0"
105
+ And the node at "/cms/articles/article1" should have the property "tags" with value "Kite" at index "1"
106
+ And the node at "/cms/articles/article1" should have the property "tags" with value "foobar" at index "2"
107
+
108
+ Scenario : Replace a multivalue property by invalid index
109
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags[10] = 'Kite' WHERE a.tags = 'Planes'" command
110
+ Then the command should fail
111
+ And I should see the following:
112
+ """
113
+ Multivalue index "10" does not exist
114
+ """
115
+
116
+ Scenario : Replace a multivalue property by invalid index with array (invalid)
117
+ Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags[1] = ['Kite'] WHERE a.tags = 'Planes'" command
118
+ Then the command should fail
119
+ And I should see the following:
120
+ """
121
+ Cannot set index to array value on "tags"
122
+ """
0 commit comments