New Command: SQL_ENABLE_RECONNECT

SQL_ENABLE_RECONNECT allows the MySQL Driver to automatically reconnect to the server after the connection has been closed by a time-out. In the MySQL my.ini file you can set a system variable called wait_timeout to set the number of seconds that the server will wait on a non-interactive connection before it closes the connection. The default value for this variable is 28800 (8 hours). See also the MySQL manual under Server System Variables and more specifically the variables wait_timeout and interactive_timeout.
Syntax

SQL_ENABLE_RECONNECT of <ServerName> to dftrue/dffalse
Argument    	      Explanation
sServer	      Server Name.
bstate	True/False - DFTrue/DFFalse.

Example:

#include mertech.inc

String   sServerID
String   sUser
String   sPassword
Integer bStop

Move "YourServerID" To sServerID // Server ID or IP number
Move "user"              To sUser
Move "password"       To sPassword

Login sServerID sUser sPassword MYSQLFLEX

SQL_ENABLE_RECONNECT Of sServerID To dftrue
Open  Customer
Clear  Customer

Move (false) To bStop

While not (bStop)
  find Gt customer by index.1
  showln "Customer: " customer.customer_number "-" customer.name

  // Selecting "No" makes bStop return True
  Get Confirm "Do you want to find the next record?" To bStop
Loop

Send Info_Box "Hello World" "VDF Basic Application"

Tags:

Leave a Reply