src/server/plugins/postgresql/webdav.c

changeset 564
f19fd264c69c
parent 562
69fc4ecc5f60
--- a/src/server/plugins/postgresql/webdav.c	Wed Nov 27 23:00:07 2024 +0100
+++ b/src/server/plugins/postgresql/webdav.c	Fri Nov 29 18:10:26 2024 +0100
@@ -604,7 +604,9 @@
             PgPropfindExtCol *c = &ext[i];
             //c->field_num = PQfnumber(result, c->ext->column);
             int *fieldnum = cxMapGet(fieldmap, c->ext->column);
-            c->field_num = *fieldnum;
+            if(fieldnum) {
+                c->field_num = *fieldnum;
+            }
         }
         
         cxMapDestroy(fieldmap);
@@ -736,7 +738,7 @@
                     PgPropfindExtCol ext = pg->ext[extc];
                     int fieldnum = ext.field_num;
                     
-                    if(!PQgetisnull(result, r, fieldnum)) {
+                    if(fieldnum >= 0 && !PQgetisnull(result, r, fieldnum)) {
                         char *ext_value = PQgetvalue(result, r, fieldnum);
                         int ext_value_len = PQgetlength(result, r, fieldnum);
                         char ext_xmlns_prefix[32];
@@ -1217,7 +1219,7 @@
         }
         
         pg_params[i] = value_str;
-        cx_bprintf(sql, " %s = $%d,\n", prop->column->name, ++i);
+        cx_bprintf(sql, " %s = $%d,\n", prop->column->column, ++i);
     }
     
     for(PgProppatchExtProp *prop=ext->remove_begin;prop;prop=prop->next)  {

mercurial