FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Fwmariaconection class turn off messages
Posts: 49
Joined: Wed Apr 18, 2007 06:01 PM
Fwmariaconection class turn off messages
Posted: Wed Jun 05, 2019 02:28 PM
Hello Mr Rao,

I'm doing tests with the Fwmariaconection class.
How do I control the error message of the connection and avoid the one generated by the class?
I turn off the Mariadb server and the error is interceded by the class and not the catch.

I connect like this

Code (fw): Select all Collapse
TRY
      FWCONNECT oConect HOST "localhost:3307" USER "root" PASSWORD "mypass" DATABASE "gestion_ancla2018"
  CATCH oErr
      MsgStop("No es posible conectar con Servidor de Datos :"+oConect:nError )
      Return .f.
 END


Thank you for your cooperation,
José David Angulo

Auditoria y Sitemas Ltda.

Cartagena Colombia
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Fwmariaconection class turn off messages
Posted: Wed Jun 05, 2019 03:15 PM
FWMarialib does not produce runtime errors for any server errors. So TRY/CATCH is not useful.

By default, only when an attempt to connect fails, the Library itself displays the error and returns nil, instead of connection object.
If the programmer does not want the library to display the error and display it himself, he may adopt this code:
Code (fw): Select all Collapse
MsgRun( "Connecting", "MYSQL", { || oCn := maria_Connect( "localhost:3307", "gestion_ancla2018", "root", "mypass", .f. ) } )
if oCn == nil
   aError := maria_ConnectError()
   ? "Faied to connect" + CRLF + ;
     "Error No: " + Str( aError[ 1 ] ) + CRLF + ;
     "Error Msg: "  + aError[ 2 ]
   QUIT
else
   ? "Connected"
   // DO ANY WORK
   oCn:Close()
endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 49
Joined: Wed Apr 18, 2007 06:01 PM
Re: Fwmariaconection class turn off messages
Posted: Wed Jun 05, 2019 03:35 PM

Perfect.

Thank You,

José David Angulo

Auditoria y Sitemas Ltda.

Cartagena Colombia

Continue the discussion