src/server/plugins/postgresql/webdav.c

changeset 401
d2bfd11d3f8f
parent 384
f9e9f2b3e299
child 402
712aca08da7f
equal deleted inserted replaced
400:d814b29e8d96 401:d2bfd11d3f8f
144 144
145 static const char *sql_propfind_where_depth1 = "\ 145 static const char *sql_propfind_where_depth1 = "\
146 where r.resource_id = $1 or r.parent_id = $1\n"; 146 where r.resource_id = $1 or r.parent_id = $1\n";
147 147
148 static const char *sql_propfind_order_depth1 = "\ 148 static const char *sql_propfind_order_depth1 = "\
149 order by case when r.resource_id = $1 then 0 else 1 end, nodename, resource_id"; 149 order by case when r.resource_id = $1 then 0 else 1 end, r.nodename, r.resource_id";
150 150
151 static const char *sql_propfind_order_depth_infinity = "\ 151 static const char *sql_propfind_order_depth_infinity = "\
152 order by replace(ppath, '/', chr(1)), resource_id"; 152 order by replace(ppath, '/', chr(1)), r.resource_id";
153 153
154 /* 154 /*
155 * SQL Queries 155 * SQL Queries
156 */ 156 */
157 157
387 ucx_buffer_puts(sql, sql_propfind_order_depth_infinity); 387 ucx_buffer_puts(sql, sql_propfind_order_depth_infinity);
388 } 388 }
389 389
390 // end 390 // end
391 ucx_buffer_puts(sql, ";\0"); 391 ucx_buffer_puts(sql, ";\0");
392 392
393 return 0; 393 return 0;
394 } 394 }
395 395
396 int pg_dav_propfind_init( 396 int pg_dav_propfind_init(
397 WebdavPropfindRequest *rq, 397 WebdavPropfindRequest *rq,
542 if(xmlns_buf) { 542 if(xmlns_buf) {
543 ucx_buffer_free(xmlns_buf); 543 ucx_buffer_free(xmlns_buf);
544 ucx_buffer_free(pname_buf); 544 ucx_buffer_free(pname_buf);
545 } 545 }
546 if(nrows < 1) { 546 if(nrows < 1) {
547 // we resolved the path, so the resource exists and nrows should
548 // be >= 1
549 if(PQresultStatus(result) != PGRES_TUPLES_OK) {
550 log_ereport(LOG_FAILURE, "pg_dav_propfind_init: %s", PQerrorMessage(pgdav->connection));
551 }
547 PQclear(result); 552 PQclear(result);
548 return 1; 553 return 1;
549 } 554 }
550 555
551 PgPropfind *pg = pool_malloc(rq->sn->pool, sizeof(PgPropfind)); 556 PgPropfind *pg = pool_malloc(rq->sn->pool, sizeof(PgPropfind));

mercurial