Thu, 18 Aug 2022 16:54:57 +0200
pg_vfs_open stores the resource_id in rq->vars
src/server/plugins/postgresql/vfs.c | file | annotate | diff | comparison | revisions |
--- a/src/server/plugins/postgresql/vfs.c Thu Aug 18 16:48:23 2022 +0200 +++ b/src/server/plugins/postgresql/vfs.c Thu Aug 18 16:54:57 2022 +0200 @@ -32,6 +32,7 @@ #include <inttypes.h> #include "../../util/util.h" +#include "../../util/pblock.h" static VFS pg_vfs_class = { pg_vfs_open, @@ -615,6 +616,19 @@ } } + // store the resource_id in rq->vars + if(ctx->rq) { + char *rq_path = pblock_findkeyval(pb_key_path, ctx->rq->vars); + if(rq_path && !strcmp(rq_path, path)) { + char *res_id_str = pblock_findval("resource_id", ctx->rq->vars); + if(!res_id_str) { + char resource_id_str[32]; + snprintf(resource_id_str, 32, "%" PRId64, resource_id); + pblock_nvinsert("resource_id",resource_id_str, ctx->rq->vars); + } + } + } + VFSFile *file = pool_malloc(ctx->pool, sizeof(VFSFile)); if(!file) { return NULL;