aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-06-05 21:16:32 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-06-05 21:16:32 +0000
commitff0ac57db9e4bfd9c51b159563e1bf94522bb35f (patch)
treec6323da4f3c14490d1da87bd194c896b3dd2ccec /src
parent7868590c61fff0def9e46a59cad0890ecbecfe7f (diff)
downloadpostgresql-ff0ac57db9e4bfd9c51b159563e1bf94522bb35f.tar.gz
postgresql-ff0ac57db9e4bfd9c51b159563e1bf94522bb35f.zip
Remove extremely old, incomplete, broken example code.
Per my proposal a few days ago.
Diffstat (limited to 'src')
-rw-r--r--src/tutorial/beard.c78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/tutorial/beard.c b/src/tutorial/beard.c
deleted file mode 100644
index ec80ced31f5..00000000000
--- a/src/tutorial/beard.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * beard.c
- * sample routines to use large objects
- *
- * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- * $PostgreSQL: pgsql/src/tutorial/beard.c,v 1.15 2006/03/05 15:59:11 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-
-typedef struct ImageHdr
-{
- int size;
-} ImageHdr;
-
-#define BUFSIZE 10
-
-/*
- * beard -
- * clips lower 1/3 of picture and return as large object
- */
-Oid
-beard(Oid picture)
-{
- Oid beard;
- int pic_fd,
- beard_fd;
- ImageHdr ihdr;
- char buf[BUFSIZE];
- int cc;
-
- pic_fd = DatumGetInt32(DirectFunctionCall2(lo_open,
- ObjectIdGetDatum(picture),
- Int32GetDatum(INV_READ)));
- if (pic_fd < 0)
- elog(ERROR, "could not access picture large object");
-
- if (lo_read(pic_fd, (char *) &ihdr, sizeof(ihdr)) != sizeof(ihdr))
- elog(ERROR, "picture large object corrupted");
-
- beardOffset = (ihdr.size / 3) * 2;
-
- /*
- * new large object
- */
- beard = DatumGetObjectId(DirectFunctionCall1(lo_creat,
- Int32GetDatum(INV_MD)));
- if (beard == InvalidOid)
- elog(ERROR, "could not create new large object");
-
- beard_fd = DatumGetInt32(DirectFunctionCall2(lo_open,
- ObjectIdGetDatum(beard),
- Int32GetDatum(INV_WRITE)));
- if (beard_fd < 0)
- elog(ERROR, "could not access beard large object");
-
- if (DatumGetInt32(DirectFunctionCall3(lo_lseek,
- Int32GetDatum(pic_fd),
- Int32GetDatum(beardOffset),
- Int32GetDatum(SEEK_SET))) < 0)
- elog(ERROR, "could not seek in picture large object");
-
- while ((cc = lo_read(pic_fd, buf, BUFSIZE)) > 0)
- {
- if (lo_write(beard_fd, buf, cc) != cc)
- elog(ERROR, "error while writing large object");
- }
-
- DirectFunctionCall1(lo_close, Int32GetDatum(pic_fd));
- DirectFunctionCall1(lo_close, Int32GetDatum(beard_fd));
-
- return beard;
-}