Hello folks,
I need help about the following problem :
I’ve a mac desktop application which open a postgresql database on a server machine ( The database.connect is in app.open event ).
Then the application do some database operations and wait to do other database operations every 15 minutes.
If during this time the client loss the database connection all database operations fail (obviously).
My question is,
can I wrap all code like this? it’s enough ? :
if db.connect then
Dim ps3 As PostgreSQLPreparedStatement
ps3 = app.db.Prepare(“UPDATE ““tblViaggi”” SET data_invio_email = $1 WHERE riferimento_spedizione = $2 ;”)
ps3.Bind(0, 99999999) 'data_invio_email
ps3.Bind(1, riferimento) 'riferimento_spedizione
ps3.SQLExecute
end if
or I’ve to check after SQLExecute instruction the error :
“If app.db.error Then”
and then try to reconnect it ?
Hi Sascha,
you mean that the code below should works ?
if db.connect then
Dim ps3 As PostgreSQLPreparedStatement
ps3 = app.db.Prepare(“UPDATE ““tblViaggi”” SET data_invio_email = $1 WHERE riferimento_spedizione = $2 ;”)
ps3.Bind(0, 99999999) 'data_invio_email
ps3.Bind(1, riferimento) 'riferimento_spedizione
ps3.SQLExecute
end if
a) you check the connection and 1 millisec later you loose the connection.
b) if you get a permanent error you may have to do something different compared to simply connecting back.
For Valentina:
exception exc
if exc isA VException then
Globals.theErrorLog.DialogErrorProceed(app.kErrorValentina + " " + exc.Message)
#if App.kMaxVersion = Globals.Version.Server then NotificationManager.post("LostConnection")
globals.StopArchiving = true
Return Nil
end if
theException = new ErrorException(exc, currentMethodName)