aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq++/pglobject.h
blob: 3e3664a1dde9b31759dedf672ffdf15975160b30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*-------------------------------------------------------------------------
 *
 *   FILE
 *	pglobject.h
 *
 *   DESCRIPTION
 *      declaration of the PGlobj class.
 *   PGlobj encapsulates a large object interface to Postgres backend 
 *
 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 *  $Id: pglobject.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
 *
 *-------------------------------------------------------------------------
 */
 
#ifndef PGLOBJECT_H
#define PGLOBJECT_H
 
#ifndef PGCONNECTION_H
#include "pgconnection.h"
#endif


// ****************************************************************
//
// PgLargeObject - a class for accessing Large Object in a database
//
// ****************************************************************
class PgLargeObject : public PgConnection {
private:
  int pgFd;
  Oid pgObject;
  string loStatus;
  void Init(Oid lobjId = 0);

public:
  PgLargeObject(const char* conninfo = 0);   // use reasonable defaults and create large object
  PgLargeObject(Oid lobjId, const char* conninfo = 0); // use reasonable defaults and open large object
  ~PgLargeObject(); // close connection and clean up
  
  void Create();
  void Open();
  void Close();
  int Read(char* buf, int len);
  int Write(const char* buf, int len);
  int LSeek(int offset, int whence);
  int Tell();
  int Unlink();
  Oid LOid();
  Oid Import(const char* filename);
  int Export(const char* filename); 
  string Status();

private:
// We don't support copying of PgLargeObject objects,
// so make copy constructor and assignment op private.
   PgLargeObject(const PgLargeObject&);
   PgLargeObject& operator= (const PgLargeObject&);
};

#endif	// PGLOBJECT_H