add missing postgresql vfs io functions webdav

Thu, 03 Feb 2022 18:03:27 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 03 Feb 2022 18:03:27 +0100
branch
webdav
changeset 284
eab579b8c80d
parent 283
25e5b771677d
child 285
96e53bd94958

add missing postgresql vfs io functions

src/server/plugins/postgresql/vfs.c file | annotate | diff | comparison | revisions
--- a/src/server/plugins/postgresql/vfs.c	Thu Feb 03 17:26:08 2022 +0100
+++ b/src/server/plugins/postgresql/vfs.c	Thu Feb 03 18:03:27 2022 +0100
@@ -396,26 +396,32 @@
 
 ssize_t pg_vfs_io_write(SYS_FILE fd, const void *buf, size_t nbyte) {
     PgVFS *pgvfs = fd->ctx->vfs->instance;
-    
-    return 0;
+    PgFile *pg = fd->data;
+    return lo_write(pgvfs->connection, pg->fd, buf, nbyte);
 }
 
 ssize_t pg_vfs_io_pread(SYS_FILE fd, void *buf, size_t nbyte, off_t offset) {
     PgVFS *pgvfs = fd->ctx->vfs->instance;
-    
-    return 0;
+    PgFile *pg = fd->data;
+    if(lo_lseek64(pgvfs->connection, pg->fd, offset, SEEK_SET) == -1) {
+        return -1;
+    }
+    return lo_read(pgvfs->connection, pg->fd, buf, nbyte);
 }
 
 ssize_t pg_vfs_io_pwrite(SYS_FILE fd, const void *buf, size_t nbyte, off_t offset) {
     PgVFS *pgvfs = fd->ctx->vfs->instance;
-    
-    return 0;
+    PgFile *pg = fd->data;
+    if(lo_lseek64(pgvfs->connection, pg->fd, offset, SEEK_SET) == -1) {
+        return -1;
+    }
+    return lo_write(pgvfs->connection, pg->fd, buf, nbyte);
 }
 
 off_t pg_vfs_io_seek(SYS_FILE fd, off_t offset, int whence) {
     PgVFS *pgvfs = fd->ctx->vfs->instance;
-    
-    return 0;
+    PgFile *pg = fd->data;
+    return lo_lseek64(pgvfs->connection, pg->fd, offset, whence);
 }
 
 void pg_vfs_io_close(SYS_FILE fd) {

mercurial