]> granicus.if.org Git - postgresql/blob - src/interfaces/libpq++/pglobject.h
Here's a version of my suggested diffs transplanted to 7.1 beta 5. I'm
[postgresql] / src / interfaces / libpq++ / pglobject.h
1 /*-------------------------------------------------------------------------
2  *
3  *   FILE
4  *      pglobject.h
5  *
6  *   DESCRIPTION
7  *      declaration of the PGlobj class.
8  *   PGlobj encapsulates a large object interface to Postgres backend 
9  *
10  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
11  * Portions Copyright (c) 1994, Regents of the University of California
12  *
13  *
14  *  $Id: pglobject.h,v 1.7 2001/05/09 17:29:10 momjian Exp $
15  *
16  *-------------------------------------------------------------------------
17  */
18  
19 #ifndef PGLOBJECT_H
20 #define PGLOBJECT_H
21  
22 #ifndef PGCONNECTION_H
23 #include "pgconnection.h"
24 #endif
25
26 #ifdef HAVE_NAMESPACE_STD
27 #define PGSTD std::
28 #else
29 #define PGSTD
30 #endif
31
32
33 // ****************************************************************
34 //
35 // PgLargeObject - a class for accessing Large Object in a database
36 //
37 // ****************************************************************
38 class PgLargeObject : public PgConnection {
39 private:
40   int pgFd;
41   Oid pgObject;
42   PGSTD string loStatus;
43   void Init(Oid lobjId = 0);
44
45 public:
46   explicit PgLargeObject(const char* conninfo = 0);   // use reasonable defaults and create large object
47   explicit PgLargeObject(Oid lobjId, const char* conninfo = 0); // use reasonable defaults and open large object
48   ~PgLargeObject(); // close connection and clean up
49   
50   void Create();
51   void Open();
52   void Close();
53   int Read(char* buf, int len);
54   int Write(const char* buf, int len);
55   int LSeek(int offset, int whence);
56   int Tell() const;
57   int Unlink();
58   Oid LOid();
59   Oid Import(const char* filename);
60   int Export(const char* filename); 
61   PGSTD string Status() const;
62
63 private:
64 // We don't support copying of PgLargeObject objects,
65 // so make copy constructor and assignment op private.
66    PgLargeObject(const PgLargeObject&);
67    PgLargeObject& operator= (const PgLargeObject&);
68 };
69
70
71 #ifdef HAVE_NAMESPACE_STD
72 #undef PGSTD
73 #endif
74
75
76 #endif  // PGLOBJECT_H