99 *
1010 *
1111 * IDENTIFICATION
12- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.80 2000/11/02 23:52:06 tgl Exp $
12+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.81 2001/01/21 03:49:14 momjian Exp $
1313 *
1414 *-------------------------------------------------------------------------
1515 */
@@ -64,6 +64,9 @@ inv_create(int flags)
6464Oid file_oid ;
6565LargeObjectDesc * retval ;
6666
67+ if (!IsTransactionBlock ())
68+ elog (ERROR ,"inv_create: Not in transaction. BLOBs should be used inside transaction." );
69+
6770/*
6871 * Allocate an OID to be the LO's identifier.
6972 */
@@ -117,6 +120,9 @@ inv_open(Oid lobjId, int flags)
117120{
118121LargeObjectDesc * retval ;
119122
123+ if (!IsTransactionBlock ())
124+ elog (ERROR ,"inv_open: Not in transaction. BLOBs should be used inside transaction." );
125+
120126if (!LargeObjectExists (lobjId ))
121127elog (ERROR ,"inv_open: large object %u not found" ,lobjId );
122128
@@ -145,6 +151,9 @@ inv_open(Oid lobjId, int flags)
145151void
146152inv_close (LargeObjectDesc * obj_desc )
147153{
154+ if (!IsTransactionBlock ())
155+ elog (ERROR ,"inv_close: Not in transaction. BLOBs should be used inside transaction." );
156+
148157Assert (PointerIsValid (obj_desc ));
149158
150159if (obj_desc -> flags & IFS_WRLOCK )
@@ -164,6 +173,9 @@ inv_close(LargeObjectDesc *obj_desc)
164173int
165174inv_drop (Oid lobjId )
166175{
176+ if (!IsTransactionBlock ())
177+ elog (ERROR ,"inv_drop: Not in transaction. BLOBs should be used inside transaction." );
178+
167179LargeObjectDrop (lobjId );
168180
169181/*
@@ -248,6 +260,9 @@ inv_getsize(LargeObjectDesc *obj_desc)
248260int
249261inv_seek (LargeObjectDesc * obj_desc ,int offset ,int whence )
250262{
263+ if (!IsTransactionBlock ())
264+ elog (ERROR ,"inv_seek: Not in transaction. BLOBs should be used inside transaction." );
265+
251266Assert (PointerIsValid (obj_desc ));
252267
253268switch (whence )
@@ -280,6 +295,9 @@ inv_seek(LargeObjectDesc *obj_desc, int offset, int whence)
280295int
281296inv_tell (LargeObjectDesc * obj_desc )
282297{
298+ if (!IsTransactionBlock ())
299+ elog (ERROR ,"inv_tell: Not in transaction. BLOBs should be used inside transaction." );
300+
283301Assert (PointerIsValid (obj_desc ));
284302
285303return obj_desc -> offset ;
@@ -303,6 +321,9 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
303321bytea * datafield ;
304322bool pfreeit ;
305323
324+ if (!IsTransactionBlock ())
325+ elog (ERROR ,"inv_read: Not in transaction. BLOBs should be used inside transaction." );
326+
306327Assert (PointerIsValid (obj_desc ));
307328Assert (buf != NULL );
308329
@@ -415,6 +436,9 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
415436bool write_indices ;
416437Relation idescs [Num_pg_largeobject_indices ];
417438
439+ if (!IsTransactionBlock ())
440+ elog (ERROR ,"inv_write: Not in transaction. BLOBs should be used inside transaction." );
441+
418442Assert (PointerIsValid (obj_desc ));
419443Assert (buf != NULL );
420444