Bug #763: PgLargeObject Class

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема Bug #763: PgLargeObject Class
Дата
Msg-id 20020911163545.4E8E84762D2@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
Randy L. Pearson (blueboy@bamafolks.com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
PgLargeObject Class

Long Description
The definition of PgLargeObject currently declares all data members as private

Problem:

When attempting to read an existing LO, you must construct a new PgLargeObject, since that is the only place where the
desiredOID can be provided. 

My project is attempting to use a connection pool for both PgDatabase and PgLargeObject objects to avoid the overhead
ofestablishing connections to the backend. 

PgLargeObject should either define its data members as protected, so you can override the class and access the
protectedpgObject member, or a member function should be provided so the user can set the desired OID without
constructinga new object. 

I suggest modifying the Open function to accept a new OID.


Sample Code
Patch against 7.2.2:

--- pglobject.h.orig    2002-09-11 11:19:29.000000000 -0500
+++ pglobject.h 2002-09-11 11:24:27.000000000 -0500
@@ -48,14 +48,14 @@
   ~PgLargeObject(); // close connection and clean up

   void Create();
-  void Open();
+  void Open( Oid oid = 0 );
   void Close();
   int Read(char* buf, int len);
   int Write(const char* buf, int len);
   int LSeek(int offset, int whence);
   int Tell() const;
   int Unlink();
-  Oid LOid();
+  Oid LOid() const;
   Oid Import(const char* filename);
   int Export(const char* filename);
   PGSTD string Status() const;

--- pglobject.cc.orig   2002-09-11 11:19:35.000000000 -0500
+++ pglobject.cc        2002-09-11 11:28:58.000000000 -0500
@@ -88,10 +88,13 @@

 // PgLargeObject::open
 // open large object and check for errors
-void PgLargeObject::Open()
+void PgLargeObject::Open( Oid oid )
 {
   // Close any prior object
   Close();
+  // Store new OID (if provided)
+  if( oid )
+    pgObject = oid;
   // Open the object
   pgFd = lo_open(pgConn, pgObject, INV_READ|INV_WRITE);

@@ -169,3 +172,8 @@
 {
   return loStatus;
 }
+
+Oid PgLargeObject::LOid() const
+{
+  return pgObject;
+}


No file was uploaded with this report

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bug #759: 7.3beta1 DROP COLUMN DEPENDENCY PROBLEM
Следующее
От: "Brendon Matthews"
Дата:
Сообщение: HELP