libidav/davqlexec.c

changeset 150
37fb12574acd
parent 148
f21ee22170bf
child 157
8dccc3063e28
equal deleted inserted replaced
149:509e9e1cbdcc 150:37fb12574acd
238 value = ucx_map_get(data->properties, rt_key); 238 value = ucx_map_get(data->properties, rt_key);
239 if(value) { 239 if(value) {
240 ucx_map_put(new_properties, rt_key, value); 240 ucx_map_put(new_properties, rt_key, value);
241 } 241 }
242 242
243 UcxKey cn_key = dav_property_key("DAV:", "crypto-name"); 243 UcxKey cn_key = dav_property_key(DAV_NS, "crypto-name");
244 value = ucx_map_get(data->properties, cn_key); 244 value = ucx_map_get(data->properties, cn_key);
245 if(value) { 245 if(value) {
246 ucx_map_put(new_properties, cn_key, value); 246 ucx_map_put(new_properties, cn_key, value);
247 } 247 }
248 248
249 UcxKey ck_key = dav_property_key("DAV:", "crypto-key"); 249 UcxKey ck_key = dav_property_key(DAV_NS, "crypto-key");
250 value = ucx_map_get(data->properties, ck_key); 250 value = ucx_map_get(data->properties, ck_key);
251 if(value) { 251 if(value) {
252 ucx_map_put(new_properties, ck_key, value); 252 ucx_map_put(new_properties, ck_key, value);
253 }
254
255 UcxKey ch_key = dav_property_key(DAV_NS, "crypto-hash");
256 value = ucx_map_get(data->properties, ch_key);
257 if(value) {
258 ucx_map_put(new_properties, ch_key, value);
253 } 259 }
254 260
255 // add properties from field list 261 // add properties from field list
256 UCX_FOREACH(elm, fields) { 262 UCX_FOREACH(elm, fields) {
257 DavCompiledField *field = elm->data; 263 DavCompiledField *field = elm->data;
289 ucx_map_remove(data->properties, lm_key); 295 ucx_map_remove(data->properties, lm_key);
290 ucx_map_remove(data->properties, ct_key); 296 ucx_map_remove(data->properties, ct_key);
291 ucx_map_remove(data->properties, rt_key); 297 ucx_map_remove(data->properties, rt_key);
292 ucx_map_remove(data->properties, cn_key); 298 ucx_map_remove(data->properties, cn_key);
293 ucx_map_remove(data->properties, ck_key); 299 ucx_map_remove(data->properties, ck_key);
300 ucx_map_remove(data->properties, ch_key);
294 301
295 resource_free_properties(sn, data->properties); 302 resource_free_properties(sn, data->properties);
296 data->properties = new_properties; 303 data->properties = new_properties;
297 304
298 free(cl_key.data); 305 free(cl_key.data);
300 free(lm_key.data); 307 free(lm_key.data);
301 free(ct_key.data); 308 free(ct_key.data);
302 free(rt_key.data); 309 free(rt_key.data);
303 free(cn_key.data); 310 free(cn_key.data);
304 free(ck_key.data); 311 free(ck_key.data);
312 free(ch_key.data);
305 313
306 return 0; 314 return 0;
307 } 315 }
308 316
309 /* 317 /*
376 if(st->where && !where) { 384 if(st->where && !where) {
377 // TODO: cleanup 385 // TODO: cleanup
378 ucx_mempool_destroy(mp); 386 ucx_mempool_destroy(mp);
379 return result; 387 return result;
380 } 388 }
381 ucx_mempool_reg_destr(mp, where, (ucx_destructor)ucx_buffer_free); 389 if(where) {
390 ucx_mempool_reg_destr(mp, where, (ucx_destructor)ucx_buffer_free);
391 }
382 392
383 // compile order criterion 393 // compile order criterion
384 UcxList *ordercr = NULL; 394 UcxList *ordercr = NULL;
385 UCX_FOREACH(elm, st->orderby) { 395 UCX_FOREACH(elm, st->orderby) {
386 DavQLOrderCriterion *oc = elm->data; 396 DavQLOrderCriterion *oc = elm->data;
493 503
494 // add properties 504 // add properties
495 add_properties(root, &response); 505 add_properties(root, &response);
496 cleanup_response(&response); 506 cleanup_response(&response);
497 507
498 if(root == selroot) { 508 if(root == selroot) {
499 // The current root is the root of the select query. 509 // The current root is the root of the select query.
500 // In this case we have to check the where clause. 510 // In this case we have to check the where clause.
501 // If root is not selroot, the where clause was 511 // If root is not selroot, the where clause was
502 // already checked for the resource before it was 512 // already checked for the resource before it was
503 // added to the stack. 513 // added to the stack.
504 DavQLStackObj where_result; 514 DavQLStackObj where_result;
505 if(!dav_exec_expr(where, root, &where_result)) { 515 if(!dav_exec_expr(where, root, &where_result)) {
506 if(where_result.data.integer != 0) { 516 if(where_result.data.integer != 0) {
507 if(!reset_properties(sn, &result, root, cfieldlist)) { 517 if(!reset_properties(sn, &result, root, cfieldlist)) {
508 continue; 518 continue;
509 } 519 }
510 result.status = -1; 520 result.status = -1;
511 } 521 }

mercurial