On Fri, Mar 21, 2008 at 4:44 PM, Mark Johnson <[EMAIL PROTECTED]> wrote: > On page: > http://library.gnome.org/devel/libgda-4.0/3.99/GdaConnection.html > for function gda_connection_open_from_dsn, we find: > " If a new GdaConnection > <http://library.gnome.org/devel/libgda-4.0/3.99/GdaConnection.html> is > created, then the caller will hold a reference on it." > This seems to imply that if an existing connection was returned from a > pool of connections, then the caller does not hold a reference on it. > Therefore, the caller should call g_object_unref only in the case when a > new connection is created. > Question: How does one tell if a new connection was created? > > On page: > http://library.gnome.org/devel/libgda-4.0/3.99/connections.html > We find this statement: > " Closing the connection can be ordered using gda_connection_close () > > <http://library.gnome.org/devel/libgda-4.0/3.99/GdaConnection.html#gda-connection-close>, > or is automatically done when the connection object is destroyed (as is > the case in the example abive when g_object_unref() is called with the > connection as argument)."
That was from the V3 version where there wer connection pools (GdaClient object). Now a GdaConnection object is created everytime gda_connection_open_from...() is called sucessfully. I'll correct the doc. > > When I called g_object_unref on the connection, expecting it to close > automatically, I found the following in the PostgreSQL log: > issue513149_dbLOG: unexpected EOF on client connection > issue513149_dbLOG: disconnection: session time: 0:00:00.268 > user=issue513149_user database=issue513149_db host=127.0.0.1 port=37580 > > When I added a call to gda_connection_close prior to the g_object_unref, > the unexpected EOF message did not appear. It seems that with > PostgreSQL, the connection is not automatically closing. Closing the connection is done automatically when a connection object is destroted (the same provider's function is called). Are you sure you did not have 2 references on the connection before calling g_object_unref()? Otherwise can you send me the piece of code (I'm a bit lazy...)? Thanks, Vivien > > Mark > > _______________________________________________ > gnome-db-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/gnome-db-list > _______________________________________________ gnome-db-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-db-list
