Merge lp:~zorba-coders/zorba/couchbase_module-bug-1188063 into lp:zorba/couchbase-module
- couchbase_module-bug-1188063
- Merge into couchbase-module
Proposed by
Matthias Brantner
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~zorba-coders/zorba/couchbase_module-bug-1188063 | ||||
Merge into: | lp:zorba/couchbase-module | ||||
Diff against target: |
546 lines (+127/-153) 2 files modified
src/couchbase.xq (+126/-152) src/couchbase.xq.src/couchbase.h (+1/-1) |
||||
To merge this branch: | bzr merge lp:~zorba-coders/zorba/couchbase_module-bug-1188063 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Hillery | Needs Fixing | ||
Matthias Brantner | Approve | ||
Review via email: mp+182781@code.launchpad.net |
Commit message
renamed to zorba.io and adapted documentation
Description of the change
To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
20 tests failed (8409 total tests run).
Check test results at http://
Revision history for this message
Chris Hillery (ceejatec) wrote : | # |
This needs JSON validation too, correct?
Revision history for this message
Chris Hillery (ceejatec) wrote : | # |
Per Matthias, validation is done in C++, so we can defer adding a JSON schema for now.
Revision history for this message
Chris Hillery (ceejatec) wrote : | # |
Need to update error codes. Don't want to use CB0001 codes anymore.
review:
Needs Fixing
Unmerged revisions
- 48. By Matthias Brantner
-
renamed and improved documentation
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/couchbase.xq' | |||
2 | --- src/couchbase.xq 2013-08-09 09:37:05 +0000 | |||
3 | +++ src/couchbase.xq 2013-08-28 23:18:04 +0000 | |||
4 | @@ -1,7 +1,7 @@ | |||
6 | 1 | xquery version "3.0"; | 1 | jsoniq version "1.0"; |
7 | 2 | 2 | ||
8 | 3 | (: | 3 | (: |
10 | 4 | : Copyright 2012 The FLWOR Foundation. | 4 | : Copyright 2013 The FLWOR Foundation. |
11 | 5 | : | 5 | : |
12 | 6 | : Licensed under the Apache License, Version 2.0 (the "License"); | 6 | : Licensed under the Apache License, Version 2.0 (the "License"); |
13 | 7 | : you may not use this file except in compliance with the License. | 7 | : you may not use this file except in compliance with the License. |
14 | @@ -19,9 +19,9 @@ | |||
15 | 19 | (:~ | 19 | (:~ |
16 | 20 | : This module provides minimal functionality to interact with the | 20 | : This module provides minimal functionality to interact with the |
17 | 21 | : Couchbase NoSQL database. | 21 | : Couchbase NoSQL database. |
19 | 22 | : | 22 | : <p/> |
20 | 23 | : The module is built using the libcouchbase C client library and | 23 | : The module is built using the libcouchbase C client library and |
22 | 24 | : exposes most of its functionality in XQuery with JSONiq extensions. | 24 | : exposes most of its functionality. |
23 | 25 | : Beyond just allowing for basic key-value store operations (e.g. | 25 | : Beyond just allowing for basic key-value store operations (e.g. |
24 | 26 | : put-/get-text or put-/get-binary, this module also allows to work | 26 | : put-/get-text or put-/get-binary, this module also allows to work |
25 | 27 | : with Couchbase views in order to allow for complex JSON query | 27 | : with Couchbase views in order to allow for complex JSON query |
26 | @@ -31,9 +31,8 @@ | |||
27 | 31 | : @project DB Drivers/Couchbase | 31 | : @project DB Drivers/Couchbase |
28 | 32 | : | 32 | : |
29 | 33 | :) | 33 | :) |
31 | 34 | module namespace cb = "http://www.zorba-xquery.com/modules/couchbase"; | 34 | module namespace cb = "http://zorba.io/modules/couchbase"; |
32 | 35 | 35 | ||
33 | 36 | declare namespace jn = "http://jsoniq.org/functions"; | ||
34 | 37 | declare namespace an = "http://zorba.io/annotations"; | 36 | declare namespace an = "http://zorba.io/annotations"; |
35 | 38 | 37 | ||
36 | 39 | declare namespace ver = "http://zorba.io/options/versioning"; | 38 | declare namespace ver = "http://zorba.io/options/versioning"; |
37 | @@ -55,11 +54,11 @@ | |||
38 | 55 | :) | 54 | :) |
39 | 56 | 55 | ||
40 | 57 | declare %an:sequential function cb:connect( | 56 | declare %an:sequential function cb:connect( |
46 | 58 | $host as xs:string, | 57 | $host as string, |
47 | 59 | $username as xs:string?, | 58 | $username as string?, |
48 | 60 | $password as xs:string?, | 59 | $password as string?, |
49 | 61 | $bucket as xs:string) | 60 | $bucket as string) |
50 | 62 | as xs:anyURI | 61 | as anyURI |
51 | 63 | { | 62 | { |
52 | 64 | cb:connect({"host" : $host, | 63 | cb:connect({"host" : $host, |
53 | 65 | "username" : $username, | 64 | "username" : $username, |
54 | @@ -71,13 +70,8 @@ | |||
55 | 71 | : Connect to the Couchbase server and return an opaque identifier | 70 | : Connect to the Couchbase server and return an opaque identifier |
56 | 72 | : representing the established connection. | 71 | : representing the established connection. |
57 | 73 | : | 72 | : |
65 | 74 | : @param $options a JSONiq object that contains the host, bucket, | 73 | : @param $options an object that contains the host (mandatory), |
66 | 75 | : and user information. | 74 | : bucket (mandatory), username, and password. |
60 | 76 | : | ||
61 | 77 | : @option "host" endpoint of the Couchbase server (mandatory) | ||
62 | 78 | : @option "username" username used for the connection (optional) | ||
63 | 79 | : @option "password" password used for the connection (optional) | ||
64 | 80 | : @option "bucket" name of an existing bucket (mandatory) | ||
67 | 81 | : | 75 | : |
68 | 82 | : @error cb:LCB0001 if the connection to the given host/bucket | 76 | : @error cb:LCB0001 if the connection to the given host/bucket |
69 | 83 | : could not be established. | 77 | : could not be established. |
70 | @@ -85,22 +79,12 @@ | |||
71 | 85 | : @error cb:CB0007 if a given option is not supported. | 79 | : @error cb:CB0007 if a given option is not supported. |
72 | 86 | : | 80 | : |
73 | 87 | : @return an identifier for the established connection. | 81 | : @return an identifier for the established connection. |
74 | 88 | : | ||
75 | 89 | : Example: | ||
76 | 90 | : <code> | ||
77 | 91 | : { | ||
78 | 92 | : "host": "localhost:8091", | ||
79 | 93 | : "username" : null, | ||
80 | 94 | : "password" : null, | ||
81 | 95 | : "bucket" : "default" | ||
82 | 96 | : } | ||
83 | 97 | : </code> | ||
84 | 98 | :) | 82 | :) |
87 | 99 | declare %an:sequential function cb:connect($options as object()) | 83 | declare %an:sequential function cb:connect($options as object) |
88 | 100 | as xs:anyURI external; | 84 | as anyURI external; |
89 | 101 | 85 | ||
90 | 102 | (:~ | 86 | (:~ |
92 | 103 | : Return the values of the given keys (type xs:string) as string. | 87 | : Return the values of the given keys as string. |
93 | 104 | : | 88 | : |
94 | 105 | : @param $db connection reference | 89 | : @param $db connection reference |
95 | 106 | : @param $key the requested keys | 90 | : @param $key the requested keys |
96 | @@ -108,43 +92,39 @@ | |||
97 | 108 | : @error cb:LCB0002 if any error occurs in the communication with | 92 | : @error cb:LCB0002 if any error occurs in the communication with |
98 | 109 | : the server. | 93 | : the server. |
99 | 110 | : | 94 | : |
101 | 111 | : @return A sequence of string Items corresponding to the key | 95 | : @return A sequence of strings. |
102 | 112 | :) | 96 | :) |
103 | 113 | 97 | ||
104 | 114 | declare %an:sequential function cb:get-text( | 98 | declare %an:sequential function cb:get-text( |
108 | 115 | $db as xs:anyURI, | 99 | $db as anyURI, |
109 | 116 | $key as xs:string*) | 100 | $key as string*) |
110 | 117 | as xs:string* external; | 101 | as string* external; |
111 | 118 | 102 | ||
112 | 119 | (:~ | 103 | (:~ |
114 | 120 | : Return the values of the given keys (type xs:string) as string. | 104 | : Return the values of the given keys as string. |
115 | 121 | : | 105 | : |
116 | 122 | : @param $db connection reference | 106 | : @param $db connection reference |
117 | 123 | : @param $key the requested keys | 107 | : @param $key the requested keys |
119 | 124 | : @param $options JSONiq object with additional options | 108 | : @param $options an object specifying the expiration-time (integer) |
120 | 109 | : or encoding (string; default is UTF-8). | ||
121 | 125 | : | 110 | : |
122 | 126 | : @option "expiration-time" xs:integer value for refreshing the expiration | ||
123 | 127 | : time in seconds. | ||
124 | 128 | : @option "encoding" string with the name of the encoding of the returned | ||
125 | 129 | : string (if not UTF-8). | ||
126 | 130 | : | ||
127 | 131 | : @error cb:LCB0002 if any error occurs in the communication with | 111 | : @error cb:LCB0002 if any error occurs in the communication with |
128 | 132 | : the server. | 112 | : the server. |
129 | 133 | : @error cb:CB0006 if the given encoding is not supported. | 113 | : @error cb:CB0006 if the given encoding is not supported. |
130 | 134 | : @error cb:CB0007 if any of the options is not supported. | 114 | : @error cb:CB0007 if any of the options is not supported. |
132 | 135 | : @error cb:CB0009 if the given expiration time is not an xs:integer. | 115 | : @error cb:CB0009 if the given expiration time is not an integer. |
133 | 136 | : | 116 | : |
134 | 137 | : @return a sequence of strings for the given keys. | 117 | : @return a sequence of strings for the given keys. |
135 | 138 | :) | 118 | :) |
136 | 139 | 119 | ||
137 | 140 | declare %an:sequential function cb:get-text( | 120 | declare %an:sequential function cb:get-text( |
142 | 141 | $db as xs:anyURI, | 121 | $db as anyURI, |
143 | 142 | $key as xs:string*, | 122 | $key as string*, |
144 | 143 | $options as object()) | 123 | $options as object) |
145 | 144 | as xs:string* external; | 124 | as string* external; |
146 | 145 | 125 | ||
147 | 146 | (:~ | 126 | (:~ |
149 | 147 | : Return the values of the given keys (type xs:string) as base64Binary. | 127 | : Return the values of the given keys as base64Binary. |
150 | 148 | : | 128 | : |
151 | 149 | : @param $db connection reference | 129 | : @param $db connection reference |
152 | 150 | : @param $key the requested keys | 130 | : @param $key the requested keys |
153 | @@ -152,91 +132,90 @@ | |||
154 | 152 | : @error cb:LCB0002 if any error occurs in the communication with | 132 | : @error cb:LCB0002 if any error occurs in the communication with |
155 | 153 | : the server. | 133 | : the server. |
156 | 154 | : | 134 | : |
158 | 155 | : @return a sequence of xs:base64Binary items for the given keys. | 135 | : @return a sequence of base64Binary items for the given keys. |
159 | 156 | :) | 136 | :) |
160 | 157 | declare %an:sequential function cb:get-binary( | 137 | declare %an:sequential function cb:get-binary( |
164 | 158 | $db as xs:anyURI, | 138 | $db as anyURI, |
165 | 159 | $key as xs:string*) | 139 | $key as string*) |
166 | 160 | as xs:base64Binary* external; | 140 | as base64Binary* external; |
167 | 161 | 141 | ||
168 | 162 | (:~ | 142 | (:~ |
170 | 163 | : Return the values of the given keys (type xs:string) as base64Binary. | 143 | : Return the values of the given keys as base64Binary. |
171 | 164 | : | 144 | : |
172 | 165 | : @param $db connection reference | 145 | : @param $db connection reference |
173 | 166 | : @param $key the requested keys | 146 | : @param $key the requested keys |
175 | 167 | : @param $options JSONiq object with additional options | 147 | : @param $options an object with specyfing the expiration-time (integer). |
176 | 168 | : | 148 | : |
177 | 169 | : @option "expiration-time" xs:integer value for refreshing the expiration | ||
178 | 170 | : time in seconds. | ||
179 | 171 | : | ||
180 | 172 | : @error cb:LCB0002 if any error occurs in the communication with | 149 | : @error cb:LCB0002 if any error occurs in the communication with |
181 | 173 | : the server. | 150 | : the server. |
182 | 174 | : @error cb:CB0007 if any of the options is not supported. | 151 | : @error cb:CB0007 if any of the options is not supported. |
184 | 175 | : @error cb:CB0009 if the given expiration time is not an xs:integer. | 152 | : @error cb:CB0009 if the given expiration time is not an integer. |
185 | 176 | : | 153 | : |
187 | 177 | : @return a sequence of xs:base64Binary items for the given keys. | 154 | : @return a sequence of base64Binary items for the given keys. |
188 | 178 | :) | 155 | :) |
189 | 179 | declare %an:sequential function cb:get-binary( | 156 | declare %an:sequential function cb:get-binary( |
194 | 180 | $db as xs:anyURI, | 157 | $db as anyURI, |
195 | 181 | $key as xs:string*, | 158 | $key as string*, |
196 | 182 | $options as object()) | 159 | $options as object) |
197 | 183 | as xs:base64Binary* external; | 160 | as base64Binary* external; |
198 | 184 | 161 | ||
199 | 185 | (:~ | 162 | (:~ |
201 | 186 | : Remove the values matching the given keys (xs:string) from the server. | 163 | : Remove the values matching the given keys. |
202 | 187 | : | 164 | : |
203 | 188 | : @param $db connection reference | 165 | : @param $db connection reference |
204 | 189 | : @param $key the keys of the values that should be removed. | 166 | : @param $key the keys of the values that should be removed. |
205 | 190 | : | 167 | : |
206 | 191 | : @error cb:LCB0002 if any error occurs in the communication with | 168 | : @error cb:LCB0002 if any error occurs in the communication with |
207 | 192 | : the server. | 169 | : the server. |
208 | 170 | : | ||
209 | 193 | : @return a empty sequence. | 171 | : @return a empty sequence. |
210 | 194 | :) | 172 | :) |
213 | 195 | declare %an:sequential function cb:remove($db as xs:anyURI, $key as xs:string*) | 173 | declare %an:sequential function cb:remove($db as anyURI, $key as string*) |
214 | 196 | as empty-sequence() external; | 174 | as () external; |
215 | 197 | 175 | ||
216 | 198 | (:~ | 176 | (:~ |
217 | 199 | : Store the given key-value bindings. | 177 | : Store the given key-value bindings. |
219 | 200 | : | 178 | : <p/> |
220 | 201 | : The values are stored with the UTF-8 encoding and a default | 179 | : The values are stored with the UTF-8 encoding and a default |
221 | 202 | : expiration time of 60 seconds. | 180 | : expiration time of 60 seconds. |
222 | 203 | : | 181 | : |
223 | 204 | : @param $db connection reference | 182 | : @param $db connection reference |
224 | 205 | : @param $key the keys to store | 183 | : @param $key the keys to store |
226 | 206 | : @param $value the values (as xs:string) to be stored. | 184 | : @param $value the values to be stored. |
227 | 207 | : | 185 | : |
228 | 208 | : @error cb:LCB0002 if any error occurs in the communication with | 186 | : @error cb:LCB0002 if any error occurs in the communication with |
229 | 209 | : the server. | 187 | : the server. |
230 | 210 | : @error cb:CB0005 if the number of keys doesn't match the number | 188 | : @error cb:CB0005 if the number of keys doesn't match the number |
231 | 211 | : of values. | 189 | : of values. |
232 | 190 | : | ||
233 | 212 | : @return a empty sequence. | 191 | : @return a empty sequence. |
234 | 213 | :) | 192 | :) |
235 | 214 | declare %an:sequential function cb:put-text( | 193 | declare %an:sequential function cb:put-text( |
240 | 215 | $db as xs:anyURI, | 194 | $db as anyURI, |
241 | 216 | $key as xs:string*, | 195 | $key as string*, |
242 | 217 | $value as xs:string*) | 196 | $value as string*) |
243 | 218 | as empty-sequence() | 197 | as () |
244 | 219 | { | 198 | { |
245 | 220 | cb:put-text($db, $key, $value, { "expiration-time" : 60, "encoding" : "UTF-8" }) | 199 | cb:put-text($db, $key, $value, { "expiration-time" : 60, "encoding" : "UTF-8" }) |
246 | 221 | }; | 200 | }; |
247 | 222 | 201 | ||
248 | 223 | (:~ | 202 | (:~ |
249 | 224 | : Store the given key-value bindings. | 203 | : Store the given key-value bindings. |
250 | 204 | : <p/> | ||
251 | 205 | : Available options: | ||
252 | 206 | : <ul> | ||
253 | 207 | : <li>"expiration-time" integer value that represent the : expiration time in seconds.</li> | ||
254 | 208 | : <li>"operation" type of operation, possible values are : "add", "replace", "set", "append" and "prepend".</li> | ||
255 | 209 | : <li>"encoding" the encoding that should be used for the : value (default is UTF-8).</li> | ||
256 | 210 | : <li>"wait" variable for setting if a wait for persistancy in | ||
257 | 211 | : the storing key is needed, possible values are "persist" and "false".</li> | ||
258 | 212 | : </ul> | ||
259 | 225 | : | 213 | : |
260 | 226 | : @param $db connection reference | 214 | : @param $db connection reference |
261 | 227 | : @param $key the keys to store | 215 | : @param $key the keys to store |
264 | 228 | : @param $value the values (as xs:string) to be stored. | 216 | : @param $value the values (as string) to be stored. |
265 | 229 | : @param $options JSONiq object with additional options | 217 | : @param $options an object with additional options |
266 | 230 | : | 218 | : |
267 | 231 | : @option "expiration-time" integer value that represent the | ||
268 | 232 | : expiration time in seconds. | ||
269 | 233 | : @option "operation" type of operation, possible values are | ||
270 | 234 | : "add", "replace", "set", "append" and "prepend". | ||
271 | 235 | : @option "encoding" the encoding that should be used for the | ||
272 | 236 | : value (default is UTF-8). | ||
273 | 237 | : @option "wait" variable for setting if a wait for persistancy in | ||
274 | 238 | : the storing key is needed, possible values are "persist" | ||
275 | 239 | : and "false". | ||
276 | 240 | : | 219 | : |
277 | 241 | : @error cb:LCB0002 if any error occurs in the communication with | 220 | : @error cb:LCB0002 if any error occurs in the communication with |
278 | 242 | : the server. | 221 | : the server. |
279 | @@ -244,24 +223,24 @@ | |||
280 | 244 | : of values. | 223 | : of values. |
281 | 245 | : @error cb:CB0006 if the given encoding is not supported. | 224 | : @error cb:CB0006 if the given encoding is not supported. |
282 | 246 | : @error cb:CB0007 if any of the options is not supported. | 225 | : @error cb:CB0007 if any of the options is not supported. |
284 | 247 | : @error cb:CB0009 if the given expiration time is not an xs:integer. | 226 | : @error cb:CB0009 if the given expiration time is not an integer. |
285 | 248 | : @error cb:CB0011 if the stored Variable was not stored | 227 | : @error cb:CB0011 if the stored Variable was not stored |
286 | 249 | : | 228 | : |
287 | 250 | : @return a empty sequence. | 229 | : @return a empty sequence. |
288 | 251 | :) | 230 | :) |
289 | 252 | declare %an:sequential function cb:put-text( | 231 | declare %an:sequential function cb:put-text( |
295 | 253 | $db as xs:anyURI, | 232 | $db as anyURI, |
296 | 254 | $key as xs:string*, | 233 | $key as string*, |
297 | 255 | $value as xs:string*, | 234 | $value as string*, |
298 | 256 | $options as object()) | 235 | $options as object) |
299 | 257 | as empty-sequence() external; | 236 | as () external; |
300 | 258 | 237 | ||
301 | 259 | (:~ | 238 | (:~ |
302 | 260 | : Store the given key-value bindings. | 239 | : Store the given key-value bindings. |
303 | 261 | : | 240 | : |
304 | 262 | : @param $db connection reference | 241 | : @param $db connection reference |
305 | 263 | : @param $key the keys to store | 242 | : @param $key the keys to store |
307 | 264 | : @param $value the values (as xs:base64binary) to be stored. | 243 | : @param $value the values (as base64binary) to be stored. |
308 | 265 | : | 244 | : |
309 | 266 | : @error cb:LCB0002 if any error occurs in the communication with | 245 | : @error cb:LCB0002 if any error occurs in the communication with |
310 | 267 | : the server. | 246 | : the server. |
311 | @@ -271,10 +250,10 @@ | |||
312 | 271 | : @return a empty sequence. | 250 | : @return a empty sequence. |
313 | 272 | :) | 251 | :) |
314 | 273 | declare %an:sequential function cb:put-binary( | 252 | declare %an:sequential function cb:put-binary( |
319 | 274 | $db as xs:anyURI, | 253 | $db as anyURI, |
320 | 275 | $key as xs:string*, | 254 | $key as string*, |
321 | 276 | $value as xs:base64Binary*) | 255 | $value as base64Binary*) |
322 | 277 | as empty-sequence() | 256 | as () |
323 | 278 | { | 257 | { |
324 | 279 | cb:put-binary($db, $key, $value, { "expiration-time" : 60 }) | 258 | cb:put-binary($db, $key, $value, { "expiration-time" : 60 }) |
325 | 280 | }; | 259 | }; |
326 | @@ -284,8 +263,8 @@ | |||
327 | 284 | : | 263 | : |
328 | 285 | : @param $db connection reference | 264 | : @param $db connection reference |
329 | 286 | : @param $key the keys to store | 265 | : @param $key the keys to store |
332 | 287 | : @param $value the values (as xs:base64binary) to be stored. | 266 | : @param $value the values (as base64binary) to be stored. |
333 | 288 | : @param $options JSONiq object with additional options | 267 | : @param $options an object with additional options |
334 | 289 | 268 | ||
335 | 290 | : @option "expiration-time" integer value that represent the | 269 | : @option "expiration-time" integer value that represent the |
336 | 291 | : expiration time in seconds. | 270 | : expiration time in seconds. |
337 | @@ -300,17 +279,17 @@ | |||
338 | 300 | : @error cb:CB0005 if the number of keys doesn't match the number | 279 | : @error cb:CB0005 if the number of keys doesn't match the number |
339 | 301 | : of values. | 280 | : of values. |
340 | 302 | : @error cb:CB0007 if any of the options is not supported. | 281 | : @error cb:CB0007 if any of the options is not supported. |
342 | 303 | : @error cb:CB0009 if the given expiration time is not an xs:integer. | 282 | : @error cb:CB0009 if the given expiration time is not an integer. |
343 | 304 | : @error cb:CB0011 if the stored Variable was not stored | 283 | : @error cb:CB0011 if the stored Variable was not stored |
344 | 305 | : | 284 | : |
345 | 306 | : @return a empty sequence. | 285 | : @return a empty sequence. |
346 | 307 | :) | 286 | :) |
347 | 308 | declare %an:sequential function cb:put-binary( | 287 | declare %an:sequential function cb:put-binary( |
353 | 309 | $db as xs:anyURI, | 288 | $db as anyURI, |
354 | 310 | $key as xs:string*, | 289 | $key as string*, |
355 | 311 | $value as xs:base64Binary*, | 290 | $value as base64Binary*, |
356 | 312 | $options as object()) | 291 | $options as object) |
357 | 313 | as empty-sequence() external; | 292 | as () external; |
358 | 314 | 293 | ||
359 | 315 | 294 | ||
360 | 316 | (:~ | 295 | (:~ |
361 | @@ -323,8 +302,8 @@ | |||
362 | 323 | : | 302 | : |
363 | 324 | : @return a empty sequence. | 303 | : @return a empty sequence. |
364 | 325 | :) | 304 | :) |
367 | 326 | declare %an:sequential function cb:flush($db as xs:anyURI) | 305 | declare %an:sequential function cb:flush($db as anyURI) |
368 | 327 | as empty-sequence() external; | 306 | as () external; |
369 | 328 | 307 | ||
370 | 329 | (:~ | 308 | (:~ |
371 | 330 | : Refresh the expiration time of the given keys. | 309 | : Refresh the expiration time of the given keys. |
372 | @@ -339,10 +318,10 @@ | |||
373 | 339 | : @return a empty sequence. | 318 | : @return a empty sequence. |
374 | 340 | :) | 319 | :) |
375 | 341 | declare %an:sequential function cb:touch( | 320 | declare %an:sequential function cb:touch( |
380 | 342 | $db as xs:anyURI, | 321 | $db as anyURI, |
381 | 343 | $key as xs:string*, | 322 | $key as string*, |
382 | 344 | $exp-time as xs:integer) | 323 | $exp-time as integer) |
383 | 345 | as empty-sequence() external; | 324 | as () external; |
384 | 346 | 325 | ||
385 | 347 | (:~ | 326 | (:~ |
386 | 348 | : Retrieve the content of existing views. | 327 | : Retrieve the content of existing views. |
387 | @@ -356,14 +335,14 @@ | |||
388 | 356 | : | 335 | : |
389 | 357 | : @return a sequence of strings (as JSON) containing information of the views. | 336 | : @return a sequence of strings (as JSON) containing information of the views. |
390 | 358 | :) | 337 | :) |
393 | 359 | declare %an:sequential function cb:view($db as xs:anyURI, $path as xs:string*) | 338 | declare %an:sequential function cb:view($db as anyURI, $path as string*) |
394 | 360 | as object()* | 339 | as object* |
395 | 361 | { | 340 | { |
396 | 362 | jn:parse-json(cb:view-text($db, $path)) | 341 | jn:parse-json(cb:view-text($db, $path)) |
397 | 363 | }; | 342 | }; |
398 | 364 | 343 | ||
401 | 365 | declare %private %an:sequential function cb:view-text($db as xs:anyURI, $path as xs:string*) | 344 | declare %private %an:sequential function cb:view-text($db as anyURI, $path as string*) |
402 | 366 | as xs:string* external; | 345 | as string* external; |
403 | 367 | 346 | ||
404 | 368 | 347 | ||
405 | 369 | (:~ | 348 | (:~ |
406 | @@ -372,7 +351,7 @@ | |||
407 | 372 | : @param $db connection reference | 351 | : @param $db connection reference |
408 | 373 | : @param $path contains the string of a view path | 352 | : @param $path contains the string of a view path |
409 | 374 | : (e.g. "_design/test/_view/vies"). | 353 | : (e.g. "_design/test/_view/vies"). |
411 | 375 | : @param $options JSONiq object with additional options | 354 | : @param $options an object with additional options |
412 | 376 | : | 355 | : |
413 | 377 | : @option Json object whith options for the querying the view. available options: | 356 | : @option Json object whith options for the querying the view. available options: |
414 | 378 | : "encoding" string with the name of the encoding of the returned | 357 | : "encoding" string with the name of the encoding of the returned |
415 | @@ -394,24 +373,23 @@ | |||
416 | 394 | : @return a sequence of strings (as JSON) containing information of the views. | 373 | : @return a sequence of strings (as JSON) containing information of the views. |
417 | 395 | :) | 374 | :) |
418 | 396 | declare %an:sequential function cb:view( | 375 | declare %an:sequential function cb:view( |
423 | 397 | $db as xs:anyURI, | 376 | $db as anyURI, |
424 | 398 | $path as xs:string*, | 377 | $path as string*, |
425 | 399 | $options as object()) | 378 | $options as object) |
426 | 400 | as object()* | 379 | as object* |
427 | 401 | { | 380 | { |
428 | 402 | jn:parse-json(cb:view-text($db, $path, $options)) | 381 | jn:parse-json(cb:view-text($db, $path, $options)) |
429 | 403 | }; | 382 | }; |
430 | 404 | 383 | ||
431 | 405 | declare %private %an:sequential function cb:view-text( | 384 | declare %private %an:sequential function cb:view-text( |
437 | 406 | $db as xs:anyURI, | 385 | $db as anyURI, |
438 | 407 | $path as xs:string*, | 386 | $path as string*, |
439 | 408 | $options as object()) | 387 | $options as object) |
440 | 409 | as xs:string* external; | 388 | as string* external; |
436 | 410 | |||
441 | 411 | 389 | ||
442 | 412 | (:~ | 390 | (:~ |
443 | 413 | : Create a document/view. | 391 | : Create a document/view. |
445 | 414 | 392 | : <p/> | |
446 | 415 | : If the document already exists, it is replaced. A document can hold several | 393 | : If the document already exists, it is replaced. A document can hold several |
447 | 416 | : views that must be specified in the same call of cb:create-view. | 394 | : views that must be specified in the same call of cb:create-view. |
448 | 417 | : | 395 | : |
449 | @@ -426,34 +404,31 @@ | |||
450 | 426 | : created. | 404 | : created. |
451 | 427 | :) | 405 | :) |
452 | 428 | declare %an:sequential function cb:create-view( | 406 | declare %an:sequential function cb:create-view( |
457 | 429 | $db as xs:anyURI, | 407 | $db as anyURI, |
458 | 430 | $doc-name as xs:string, | 408 | $doc-name as string, |
459 | 431 | $view-names as xs:string*) | 409 | $view-names as string*) |
460 | 432 | as xs:string* external; | 410 | as string* external; |
461 | 433 | 411 | ||
462 | 434 | (:~ | 412 | (:~ |
463 | 435 | : Create a document/view. | 413 | : Create a document/view. |
466 | 436 | 414 | : <p/> | |
467 | 437 | : If the document already exists, it is replaced. A document can hold several | 415 | : If the document already exists, it is replaced. A document can have several |
468 | 438 | : views that must be specified in the same call of cb:create-view. | 416 | : views that must be specified in the same call of cb:create-view. |
469 | 417 | : <p/> | ||
470 | 418 | : The following options can be specified: | ||
471 | 419 | : <ul> | ||
472 | 420 | : <li>"key": name of the key displayed in the resulting object.</li> | ||
473 | 421 | : <li>"values" a string or array of strings containing the values | ||
474 | 422 | : that should be contained in the resulting object.</li> | ||
475 | 423 | : <li>"function" the javascript map function of the view. If present, | ||
476 | 424 | : the "key" and "values" options are ignored.</li> | ||
477 | 425 | : </ul> | ||
478 | 439 | : | 426 | : |
479 | 440 | : @param $db connection reference | 427 | : @param $db connection reference |
480 | 441 | : @param $doc-name name of the document to create. | 428 | : @param $doc-name name of the document to create. |
481 | 442 | : @param $view-names names of the views to create in the document. | 429 | : @param $view-names names of the views to create in the document. |
482 | 443 | : @param $options options describing how to create the view. | 430 | : @param $options options describing how to create the view. |
483 | 444 | : | 431 | : |
484 | 445 | : @option "key" value must be a string containing the name of the value | ||
485 | 446 | : in the json object stored in couchbase that is wanted to be | ||
486 | 447 | : displayed as the value of "key" in the resulting json. | ||
487 | 448 | : @option "values" value must be a string or an array of strings containing | ||
488 | 449 | : the name of the value in the json object stored in couchbase that | ||
489 | 450 | : is wanted to be displayed as the value of "value" in the resulting | ||
490 | 451 | : json. | ||
491 | 452 | : @option "function" string with a javascript function describing the | ||
492 | 453 | : map function of the view. cb:create-view won't throw an error | ||
493 | 454 | : if the javascript function is not compilable or functional. If | ||
494 | 455 | : this option is set the "key" and "values" options are ignored. | ||
495 | 456 | : | ||
496 | 457 | : @error cb:LCB0002 if any error occurs in the communication with | 432 | : @error cb:LCB0002 if any error occurs in the communication with |
497 | 458 | : the server. | 433 | : the server. |
498 | 459 | : @error cb:CB0005 if the number of options doesn't match the number of | 434 | : @error cb:CB0005 if the number of options doesn't match the number of |
499 | @@ -465,18 +440,17 @@ | |||
500 | 465 | : created. | 440 | : created. |
501 | 466 | :) | 441 | :) |
502 | 467 | declare %an:sequential function cb:create-view( | 442 | declare %an:sequential function cb:create-view( |
509 | 468 | $db as xs:anyURI, | 443 | $db as anyURI, |
510 | 469 | $doc-name as xs:string, | 444 | $doc-name as string, |
511 | 470 | $view-names as xs:string*, | 445 | $view-names as string*, |
512 | 471 | $options as object()*) | 446 | $options as object*) |
513 | 472 | as xs:string* external; | 447 | as string* external; |
508 | 473 | |||
514 | 474 | 448 | ||
515 | 475 | (:~ | 449 | (:~ |
516 | 476 | : Delete a document/view. | 450 | : Delete a document/view. |
518 | 477 | 451 | : <p/> | |
519 | 478 | : If the document doesn't exists, function does nothing. All the views hold in the | 452 | : If the document doesn't exists, function does nothing. All the views hold in the |
521 | 479 | : Document are deleted, this function can't delete single views. | 453 | : document are deleted, this function can't delete single views. |
522 | 480 | : | 454 | : |
523 | 481 | : @param $db connection reference | 455 | : @param $db connection reference |
524 | 482 | : @param $doc-name name of the document to create. | 456 | : @param $doc-name name of the document to create. |
525 | @@ -487,6 +461,6 @@ | |||
526 | 487 | : @return empty sequence. | 461 | : @return empty sequence. |
527 | 488 | :) | 462 | :) |
528 | 489 | declare %an:sequential function cb:delete-view( | 463 | declare %an:sequential function cb:delete-view( |
532 | 490 | $db as xs:anyURI, | 464 | $db as anyURI, |
533 | 491 | $doc as xs:string*) | 465 | $doc as string*) |
534 | 492 | as xs:string* external; | 466 | as string* external; |
535 | 493 | 467 | ||
536 | === modified file 'src/couchbase.xq.src/couchbase.h' | |||
537 | --- src/couchbase.xq.src/couchbase.h 2013-01-21 22:42:49 +0000 | |||
538 | +++ src/couchbase.xq.src/couchbase.h 2013-08-28 23:18:04 +0000 | |||
539 | @@ -24,7 +24,7 @@ | |||
540 | 24 | #include <zorba/function.h> | 24 | #include <zorba/function.h> |
541 | 25 | #include <zorba/dynamic_context.h> | 25 | #include <zorba/dynamic_context.h> |
542 | 26 | 26 | ||
544 | 27 | #define COUCHBASE_MODULE_NAMESPACE "http://www.zorba-xquery.com/modules/couchbase" | 27 | #define COUCHBASE_MODULE_NAMESPACE "http://zorba.io/modules/couchbase" |
545 | 28 | 28 | ||
546 | 29 | namespace zorba { namespace couchbase { | 29 | namespace zorba { namespace couchbase { |
547 | 30 | 30 |
Validation queue starting for the following merge proposals: /code.launchpad .net/~zorba- coders/ zorba/couchbase _module- bug-1188063/ +merge/ 182781
https:/
Progress dashboard at http:// jenkins. lambda. nu/view/ ValidationQueue