From: Justin Banks <justinb@tricord.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: justinb@tricord.com, PostgreSQL-interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: Re: libpq++
Date: Thu, 3 May 2001 14:37:24 -0500 (CDT)
Message-ID: <15089.45940.490466.456420@idoru.tricord.com> (raw)
In-Reply-To: <299.988917936@sss.pgh.pa.us>
References: <200105031915.f43JFpf12056@candle.pha.pa.us>
<299.988917936@sss.pgh.pa.us>
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> I think he is creating his own shared memory area:
Tom> Oh, I see. Isn't that pretty silly, considering that there's no way
Tom> for such objects to share a DBconnection if they are in different
Tom> application processes? Seems like a simple static variable would do
Tom> the job just as well with a lot fewer portability and resource-leakage
Tom> issues...
If you have a class, say 'class host', that represents a table in your
database, in which you are storing host information, and you want each host to
also be a database object, you now have two choices, as far as I can tell. You
can connect to the database in the chain of constructors somewhere, or you can
put it off until you actually issue a query of some kind. Either way, you get
punished quite severely if you want say, a
int N = 75;
host * cluster_of_boxes = new host[N](default_parameters_of_some_kind);
since you either then have N connections to the backend, or every time you
want to go to the DB you take a big hit. With my modification, you only get
one connection to the backend, and all your host objects share it.
You're right - this only works because the shared connections all occur in the
same address space. It doesn't buy you anything between applications, only
inside an application. The problem is that there's no way for different
instantiations of classes inheriting database-ness from the PgDatabase class
to share a PGconn* unless the PgDatabase class provides a way for different
instantiations to know that existing connections are available.
-justinb
--
Justin Banks Tricord, Inc. justinb@tricord.com
"The time you enjoy wasting is not wasted time."
- Bertrand Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: justinb@tricord.com, tgl@sss.pgh.pa.us, pgman@candle.pha.pa.us
Subject: Re: Re: libpq++
In-Reply-To: <15089.45940.490466.456420@idoru.tricord.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox