Fwmariaconection class turn off messages

Post Reply
audisys
Posts: 36
Joined: Wed Apr 18, 2007 6:01 pm
Location: Cartagena - Colombia

Fwmariaconection class turn off messages

Post by audisys »

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: Select all

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Fwmariaconection class turn off messages

Post by nageswaragunupudi »

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: Select all

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
audisys
Posts: 36
Joined: Wed Apr 18, 2007 6:01 pm
Location: Cartagena - Colombia

Re: Fwmariaconection class turn off messages

Post by audisys »

Perfect.

Thank You,
José David Angulo
Auditoria y Sitemas Ltda.
Cartagena Colombia
Post Reply