FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour cierre de conexion con FWMariadb
Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
cierre de conexion con FWMariadb
Posted: Thu Jun 08, 2017 02:15 PM

Me est谩 pasando lo siguiente,

Hago una conexi贸n a una base de datos
creo un rowset y hago el browse
cierro el browse
elimino el rowset con oRs:End()
me desconecto con oCn:Close()
y si vuelvo a intentar hacer el browse del recordset que destru铆 con la conexi贸n cerrada, en lugar de darme error me abre el recordset.... o sea como que no se destruy贸 el recordset y si
hago un xbrowse del objeto oCn me aparece como existente....

Saludos/Regards,

Jos茅 Murugosa

"Los errores en programaci贸n, siempre est谩n entre la silla, el teclado y la IA!!"
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: cierre de conexion con FWMariadb
Posted: Fri Jun 09, 2017 01:45 AM

Me interesa este tema ya que estoy usando la misma tecnolog铆a. Realmente no me hab铆a percatado.

Saludos

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: cierre de conexion con FWMariadb
Posted: Fri Jun 09, 2017 10:09 AM
Connection Object:

oCn:Close() or oCn:End() // functionally same
Closes connection with the server. But remembers all connection parameters.
We can later call oCn:ReConnect() and start working again.

The object itself remains till oCn is set to NIL and all references to the object go out of memory.

RowSet object:

Methods close() / end() do not do anything.
The object remains till oRs is set to NIL.

Even if the connection is closed, if we operate oRs and try to modify data, the connection is ReOpened and work continues. This way even if a connection is interrupted due to loss of internet / physical connection, work can be resumed after restoration of internet / physical connection.

Example:
Code (fw): Select all Collapse
oCn := maria_Connect( ........ )
oRs 聽:= oCn:Customer
XBROWSER oRs FASTEDIT 聽// works
oCn:Close()
oCn := NIL
XBROWSR oRs FASTEDIT // Also works. When we modify data, connection is reopened and work continues


Once rowset is loaded into memory, it does not require connection, unless we try to modify data. When we modify data, it uses the connection if already open and if not reopens the connection and continues to work.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
Re: cierre de conexion con FWMariadb
Posted: Fri Jun 09, 2017 10:15 AM

Thank you very much Mr. Rao.

Now is clear to me how it works :) .

Saludos/Regards,

Jos茅 Murugosa

"Los errores en programaci贸n, siempre est谩n entre la silla, el teclado y la IA!!"

Continue the discussion