From aaf19c0e25715c2b46164798ff017d688487763b Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 12 Jun 2000 04:01:52 +0000 Subject: [PATCH] Well, pg_dumplo is in attache. It is really simple program and now is not prepared for dirtribution (it needs a little changes). I can change and work on this, but I need motivation :-) And Peter, I know and I agree that standard PG tree is not good space for all interfaces and for all tools based on PG, but LO is PG feature and we haven't backup tool for LO. Karel Zak --- contrib/README | 3 + contrib/pg_dumplo/Makefile | 26 +++ contrib/pg_dumplo/README | 18 ++ contrib/pg_dumplo/VERSION | 1 + contrib/pg_dumplo/pg_dumplo.c | 379 ++++++++++++++++++++++++++++++++++ 5 files changed, 427 insertions(+) create mode 100644 contrib/pg_dumplo/Makefile create mode 100644 contrib/pg_dumplo/README create mode 100644 contrib/pg_dumplo/VERSION create mode 100644 contrib/pg_dumplo/pg_dumplo.c diff --git a/contrib/README b/contrib/README index 773b0e30c3..7dcd1ca1fe 100644 --- a/contrib/README +++ b/contrib/README @@ -60,6 +60,9 @@ mSQL-interface - noupdate - trigger to prevent updates on single columns +pg_dumplo - + Dump large objects + soundex - Prototype for soundex function diff --git a/contrib/pg_dumplo/Makefile b/contrib/pg_dumplo/Makefile new file mode 100644 index 0000000000..0d4fb83424 --- /dev/null +++ b/contrib/pg_dumplo/Makefile @@ -0,0 +1,26 @@ + +PROGRAM = pg_dumplo + +OBJECTS = pg_dumplo.o + +CFLAGS = -Wall -fpic -g +CC = gcc +RM = rm -f +INCLUDE = -I/usr/include/postgresql +LIBS =-lpq + +COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDE) +LINK = $(CC) $(CFLAGS) -o $@ $(LIBS) + + +all: $(PROGRAM) + +$(PROGRAM): $(OBJECTS) + $(LINK) $(OBJECTS) + +.c.o: $< + $(COMPILE) -c $< + +clean: + $(RM) -f *~ $(OBJECTS) $(PROGRAM) + diff --git a/contrib/pg_dumplo/README b/contrib/pg_dumplo/README new file mode 100644 index 0000000000..b36cdd01d0 --- /dev/null +++ b/contrib/pg_dumplo/README @@ -0,0 +1,18 @@ + + pg_dumplo - PostgreSQL large object dumper + + + Hmm... documentation is not available. For more information + see the help ( pg_dumplo -h ) and examples in this help. + + Compilation: + - you need the PostgreSQL's devel. libs + - and type: 'make' + + + Karel Zak + + + + + diff --git a/contrib/pg_dumplo/VERSION b/contrib/pg_dumplo/VERSION new file mode 100644 index 0000000000..05b19b1f76 --- /dev/null +++ b/contrib/pg_dumplo/VERSION @@ -0,0 +1 @@ +0.0.4 \ No newline at end of file diff --git a/contrib/pg_dumplo/pg_dumplo.c b/contrib/pg_dumplo/pg_dumplo.c new file mode 100644 index 0000000000..6e6a20bef5 --- /dev/null +++ b/contrib/pg_dumplo/pg_dumplo.c @@ -0,0 +1,379 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define _GNU_SOURCE +#include + +extern int errno; + +#define QUERY_BUFSIZ (8*1024) +#define DIR_UMASK 0755 +#define FILE_UMASK 0666 + +#define TRUE 1 +#define FALSE 0 +#define RE_OK 0 +#define RE_ERROR 1 + +typedef struct { + char *table, + *attr; + long lo_oid; +} lo_attr; + +void usage() +{ + printf("\nPostgreSQL large objects dump"); + printf("\npg_lo_dump