9
9
*
10
10
*
11
11
* 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 $
13
13
*
14
14
*-------------------------------------------------------------------------
15
15
*/
@@ -64,6 +64,9 @@ inv_create(int flags)
64
64
Oid file_oid ;
65
65
LargeObjectDesc * retval ;
66
66
67
+ if (!IsTransactionBlock ())
68
+ elog (ERROR , "inv_create: Not in transaction. BLOBs should be used inside transaction." );
69
+
67
70
/*
68
71
* Allocate an OID to be the LO's identifier.
69
72
*/
@@ -117,6 +120,9 @@ inv_open(Oid lobjId, int flags)
117
120
{
118
121
LargeObjectDesc * retval ;
119
122
123
+ if (!IsTransactionBlock ())
124
+ elog (ERROR , "inv_open: Not in transaction. BLOBs should be used inside transaction." );
125
+
120
126
if (! LargeObjectExists (lobjId ))
121
127
elog (ERROR , "inv_open: large object %u not found" , lobjId );
122
128
@@ -145,6 +151,9 @@ inv_open(Oid lobjId, int flags)
145
151
void
146
152
inv_close (LargeObjectDesc * obj_desc )
147
153
{
154
+ if (!IsTransactionBlock ())
155
+ elog (ERROR , "inv_close: Not in transaction. BLOBs should be used inside transaction." );
156
+
148
157
Assert (PointerIsValid (obj_desc ));
149
158
150
159
if (obj_desc -> flags & IFS_WRLOCK )
@@ -164,6 +173,9 @@ inv_close(LargeObjectDesc *obj_desc)
164
173
int
165
174
inv_drop (Oid lobjId )
166
175
{
176
+ if (!IsTransactionBlock ())
177
+ elog (ERROR , "inv_drop: Not in transaction. BLOBs should be used inside transaction." );
178
+
167
179
LargeObjectDrop (lobjId );
168
180
169
181
/*
@@ -248,6 +260,9 @@ inv_getsize(LargeObjectDesc *obj_desc)
248
260
int
249
261
inv_seek (LargeObjectDesc * obj_desc , int offset , int whence )
250
262
{
263
+ if (!IsTransactionBlock ())
264
+ elog (ERROR , "inv_seek: Not in transaction. BLOBs should be used inside transaction." );
265
+
251
266
Assert (PointerIsValid (obj_desc ));
252
267
253
268
switch (whence )
@@ -280,6 +295,9 @@ inv_seek(LargeObjectDesc *obj_desc, int offset, int whence)
280
295
int
281
296
inv_tell (LargeObjectDesc * obj_desc )
282
297
{
298
+ if (!IsTransactionBlock ())
299
+ elog (ERROR , "inv_tell: Not in transaction. BLOBs should be used inside transaction." );
300
+
283
301
Assert (PointerIsValid (obj_desc ));
284
302
285
303
return obj_desc -> offset ;
@@ -303,6 +321,9 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
303
321
bytea * datafield ;
304
322
bool pfreeit ;
305
323
324
+ if (!IsTransactionBlock ())
325
+ elog (ERROR , "inv_read: Not in transaction. BLOBs should be used inside transaction." );
326
+
306
327
Assert (PointerIsValid (obj_desc ));
307
328
Assert (buf != NULL );
308
329
@@ -415,6 +436,9 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
415
436
bool write_indices ;
416
437
Relation idescs [Num_pg_largeobject_indices ];
417
438
439
+ if (!IsTransactionBlock ())
440
+ elog (ERROR , "inv_write: Not in transaction. BLOBs should be used inside transaction." );
441
+
418
442
Assert (PointerIsValid (obj_desc ));
419
443
Assert (buf != NULL );
420
444
0 commit comments