Re: Alternative new libpq interface.

Marten Feldtmann <m.feldtmann@t-online.de>

From: M.Feldtmann@t-online.de (Marten Feldtmann)
To: "Chris Bitmead" <chrisb@nimrod.itg.telstra.com.au>, "Marten Feldtmann" <marten@toppoint.de>
Cc: "pgsql-hackers@postgreSQL.org" <pgsql-hackers@postgresql.org>, "pgsql-oo@postgreSQL.org" <pgsql-oo@postgresql.org>
Date: 2000-07-11T06:14:34Z
Lists: pgsql-hackers
On Tue, 11 Jul 2000 11:05:04 +1000, Chris Bitmead wrote:

>
>Each programming language has a specified ODMG interface. Database
>objects are mapped 1:1 with language objects. Every time you read
>a database object a language object is created to represent it.
>

 Ok, this is defined as the language bindungs mentioned in this 
book.

>Now if you read the same database object in different places in your
>code. Maybe the same object is "navigated" to via different paths,
>you don't want two objects created in memory to represent that object.
>If that happened you could have a confusing integrity situation.
>
>So with an ODMG interface it keeps track of what database objects
>are in memory at any one time - think of it as a cache, and makes
>sure that if you request the same object again, it doesn't construct
>a new one but returns the existing one.
>

 Hmmm, what you want is not that easy. It means, that the object
data is stored several times on the client:

 - you MUST hold an independent cache for each open connection 
   to the database.
 - you MUST copy the values from the cache to the language
   dependent representation.

 And you still do not get the result you want to have: the
integrity problem. What happens, if the cache is not big
enough. How are cached objects thrown away ? Garbage Collector
in the cache system ??

 And another point: this has nothing to do with an ODMG interface.
It's just a nice performance hint for database access, but
ODMG has nothing to do with it.

 Normally the identity is assured by the language binding - either
by the database (as you would like it) or by the binding of a
particular language to this database.

 To get an ODMG language binding you may use the libpq. You may
put a cache system on top of this libpq and you have the thing 
you perhaps want to have. That's all you really need. 

 What indeed would be a big win, it the chance to retrieve different 
result sets with one query !


 Marten


----

Marten Feldtmann, Germany