Re: [gnome-db] 2 issues with GdaConnection

On Fri, Mar 21, 2008 at 4:44 PM, Mark Johnson <mrj001 shaw ca> wrote:
> On page:
>  for function gda_connection_open_from_dsn, we find:
>  " If a new GdaConnection
>  <> 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:
>  We find this statement:
>  " Closing the connection can be ordered using 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

>  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= 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...)?



>  Mark
>  _______________________________________________
>  gnome-db-list mailing list
>  gnome-db-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]