From cf5a950c105cf67d85acc214e2d8cfd171831971 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 8 Oct 2000 03:18:57 +0000 Subject: Hello, this is patch v 0.4 to support transactions with BLOBs. All BLOBs are in one table. You need to make initdb. -- Sincerely Yours, Denis Perchine --- src/include/catalog/catname.h | 3 +- src/include/catalog/indexing.h | 4 ++- src/include/catalog/pg_largeobject.h | 63 ++++++++++++++++++++++++++++++++++++ src/include/storage/large_object.h | 19 +++-------- 4 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 src/include/catalog/pg_largeobject.h (limited to 'src/include') diff --git a/src/include/catalog/catname.h b/src/include/catalog/catname.h index 368a05e474b..9829682be55 100644 --- a/src/include/catalog/catname.h +++ b/src/include/catalog/catname.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: catname.h,v 1.12 2000/01/26 05:57:56 momjian Exp $ + * $Id: catname.h,v 1.13 2000/10/08 03:18:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,7 @@ #define InheritsRelationName "pg_inherits" #define InheritancePrecidenceListRelationName "pg_ipl" #define LanguageRelationName "pg_language" +#define LargeobjectRelationName "pg_largeobject" #define ListenerRelationName "pg_listener" #define LogRelationName "pg_log" #define OperatorClassRelationName "pg_opclass" diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index dfb05051cae..8e42356d7a7 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: indexing.h,v 1.40 2000/06/17 04:56:30 tgl Exp $ + * $Id: indexing.h,v 1.41 2000/10/08 03:18:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -31,6 +31,7 @@ #define Num_pg_index_indices 2 #define Num_pg_inherits_indices 1 #define Num_pg_language_indices 2 +#define Num_pg_largeobject_indices 2 #define Num_pg_listener_indices 1 #define Num_pg_opclass_indices 2 #define Num_pg_operator_indices 2 @@ -92,6 +93,7 @@ extern char *Name_pg_group_indices[]; extern char *Name_pg_index_indices[]; extern char *Name_pg_inherits_indices[]; extern char *Name_pg_language_indices[]; +extern char *Name_pg_largeobject_indices[]; extern char *Name_pg_listener_indices[]; extern char *Name_pg_opclass_indices[]; extern char *Name_pg_operator_indices[]; diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h new file mode 100644 index 00000000000..f8f6509acbb --- /dev/null +++ b/src/include/catalog/pg_largeobject.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject.h + * definition of the system "largeobject" relation (pg_largeobject) + * along with the relation's initial contents. + * + * + * Portions Copyright (c) 1996-2000, PostgreSQL, Inc + * Portions Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_largeobject.h,v 1.1 2000/10/08 03:18:56 momjian Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_H +#define PG_LARGEOBJECT_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ + +/* ---------------- + * pg_largeobject definition. cpp turns this into + * typedef struct FormData_pg_largeobject. Large object id + * is stored in loid; + * ---------------- + */ + +CATALOG(pg_largeobject) +{ + Oid loid; + int4 pageno; + bytea data; +} FormData_pg_largeobject; + +/* ---------------- + * Form_pg_largeobject corresponds to a pointer to a tuple with + * the format of pg_largeobject relation. + * ---------------- + */ +typedef FormData_pg_largeobject *Form_pg_largeobject; + +/* ---------------- + * compiler constants for pg_largeobject + * ---------------- + */ +#define Natts_pg_largeobject 3 +#define Anum_pg_largeobject_loid 1 +#define Anum_pg_largeobject_pageno 2 +#define Anum_pg_largeobject_data 3 + +Oid LargeobjectCreate(Oid loid); +void LargeobjectDrop(Oid loid); +int LargeobjectFind(Oid loid); + +#endif /* PG_LARGEOBJECT_H */ diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h index 4aa151844c8..1157c5dc02e 100644 --- a/src/include/storage/large_object.h +++ b/src/include/storage/large_object.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: large_object.h,v 1.13 2000/01/26 05:58:33 momjian Exp $ + * $Id: large_object.h,v 1.14 2000/10/08 03:18:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,17 +22,11 @@ /* * This structure will eventually have lots more stuff associated with it. */ -typedef struct LargeObjectDesc -{ - Relation heap_r; /* heap relation */ - Relation index_r; /* index relation on seqno attribute */ - IndexScanDesc iscan; /* index scan we're using */ - TupleDesc hdesc; /* heap relation tuple desc */ - TupleDesc idesc; /* index relation tuple desc */ - uint32 lowbyte; /* low byte on the current page */ - uint32 highbyte; /* high byte on the current page */ +typedef struct LargeObjectDesc { + Relation heap_r; + Relation index_r; uint32 offset; /* current seek pointer */ - ItemPointerData htid; /* tid of current heap tuple */ + Oid id; #define IFS_RDLOCK (1 << 0) #define IFS_WRLOCK (1 << 1) @@ -55,7 +49,4 @@ extern int inv_tell(LargeObjectDesc *obj_desc); extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes); extern int inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes); -/* added for buffer leak prevention [ PA ] */ -extern void inv_cleanindex(LargeObjectDesc *obj_desc); - #endif /* LARGE_OBJECT_H */ -- cgit v1.2.3