empty field results will no longer be added

Thu, 09 Jul 2015 15:00:16 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 09 Jul 2015 15:00:16 +0200
changeset 136
59058927b885
parent 135
664aeaec8d25
child 137
01cb9aabff05

empty field results will no longer be added

dav/main.c file | annotate | diff | comparison | revisions
libidav/davqlexec.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Wed Jul 08 17:31:26 2015 +0200
+++ b/dav/main.c	Thu Jul 09 15:00:16 2015 +0200
@@ -364,7 +364,7 @@
     }
     
     char *update = cmd_getoption(a, "update");
-    time_t t = 1;
+    time_t t = -1;
     if(update) {
         t = util_parse_lastmodified(update);
     }
@@ -373,15 +373,12 @@
     int ret = -1;
     DavResource *ls;
     while(ret != 0) {
-        /*
         ls = dav_query(
                 sn,
                 "select `idav:crypto-name`,`idav:crypto-key` from %s with depth = %d where lastmodified > %t",
                 path,
                 depth,
                 t);
-        */
-        ls = dav_query(sn, "select * from %s", path);
         
         if(!ls) {
             if(sn->error == DAV_UNAUTHORIZED) {
--- a/libidav/davqlexec.c	Wed Jul 08 17:31:26 2015 +0200
+++ b/libidav/davqlexec.c	Thu Jul 09 15:00:16 2015 +0200
@@ -200,7 +200,7 @@
 }
 
 static int reset_properties(DavSession *sn, DavResult *result, DavResource *res, UcxList *fields) {
-    return 0;
+    //return 0;
     UcxMap *new_properties = ucx_map_new_a(sn->mp->allocator, 32);
     DavResourceData *data = (DavResourceData*)res->data;
     
@@ -255,15 +255,19 @@
         DavQLStackObj field_result;
         if(!dav_exec_expr(field->code, res, &field_result)) {
             sstr_t str;
+            str.ptr = NULL;
+            str.length = 0;
             if(field_result.type == 0) {
                 str = ucx_asprintf(
                         sn->mp->allocator,
                         "%d",
                         field_result.data.integer);
             } else {
-                str = sstrdup_a(sn->mp->allocator, sstrn(
-                        field_result.data.string,
-                        field_result.length));
+                if(field_result.data.string) {
+                    str = sstrdup_a(sn->mp->allocator, sstrn(
+                            field_result.data.string,
+                            field_result.length));
+                }
             }
             if(str.ptr) {
                 UcxKey key = dav_property_key(field->ns, field->name);
@@ -284,8 +288,17 @@
     ucx_map_remove(data->properties, cn_key);
     ucx_map_remove(data->properties, ck_key);
     
-    resource_free_properties(sn, data->properties);
+    //resource_free_properties(sn, data->properties);
     data->properties = new_properties;
+    //printf("(%s) new properties: ", res->name, data->properties);
+    
+    free(cl_key.data);
+    free(cd_key.data);
+    free(lm_key.data);
+    free(ct_key.data);
+    free(rt_key.data);
+    free(cn_key.data);
+    free(ck_key.data);
     
     return 0;
 }
@@ -828,7 +841,7 @@
                 //printf("timestamp %d\n", cmd.data.timestamp);
                 obj.type = 0;
                 obj.length = 0;
-                obj.data.integer = (int)cmd.data.timestamp;
+                obj.data.integer = (int64_t)cmd.data.timestamp;
                 DAVQL_PUSH(obj);
                 break;
             }

mercurial