libidav/davqlexec.c

changeset 348
b79fb94f9e0a
parent 331
9ca1e4706acc
child 351
11789a88d0b0
--- a/libidav/davqlexec.c	Sat Dec 16 10:37:50 2017 +0100
+++ b/libidav/davqlexec.c	Sun Dec 17 10:53:08 2017 +0100
@@ -266,21 +266,36 @@
             sstr_t str;
             str.ptr = NULL;
             str.length = 0;
+            DavXmlNode *node = NULL;
             if(field_result.type == 0) {
                 str = ucx_asprintf(
                         sn->mp->allocator,
                         "%d",
                         field_result.data.integer);
-            } else {
+            } else if(field_result.type == 1) {
                 if(field_result.data.string) {
                     str = sstrdup_a(sn->mp->allocator, sstrn(
                             field_result.data.string,
                             field_result.length));
                 }
+            } else if(field_result.type == 2) {
+                // TODO:
+            } else {
+                // unknown type
+                // TODO: error
+                resource_free_properties(sn, new_properties);
+                return -1;
             }
             if(str.ptr) {
+                node = dav_session_malloc(sn, sizeof(DavXmlNode));
+                memset(node, 0, sizeof(DavXmlNode));
+                node->type = DAV_XML_TEXT;
+                node->content = str.ptr;
+                node->contentlength = str.length;
+            }
+            if(node) {
                 UcxKey key = dav_property_key(field->ns, field->name);
-                ucx_map_put(new_properties, key, str.ptr);
+                ucx_map_put(new_properties, key, node);
                 free(key.data);
             }
         } else {

mercurial