MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
connect2.inc
1 # include/connect2.inc
2 #
3 # SUMMARY
4 #
5 # Make several attempts to connect.
6 #
7 # USAGE
8 #
9 # EXAMPLE
10 #
11 # connect.test
12 #
13 
14 --disable_query_log
15 
16 let $wait_counter= 300;
17 if ($wait_timeout)
18 {
19  let $wait_counter= `SELECT $wait_timeout * 10`;
20 }
21 # Reset $wait_timeout so that its value won't be used on subsequent
22 # calls, and default will be used instead.
23 let $wait_timeout= 0;
24 
25 --echo # -- Establishing connection '$con_name' (user: $con_user_name)...
26 
27 while ($wait_counter)
28 {
29  --disable_abort_on_error
30  --disable_result_log
31  --connect ($con_name,localhost,$con_user_name)
32  --enable_result_log
33  --enable_abort_on_error
34 
35  let $error = $mysql_errno;
36 
37  if (!$error)
38  {
39  let $wait_counter= 0;
40  }
41  if ($error)
42  {
43  real_sleep 0.1;
44  dec $wait_counter;
45  }
46 }
47 if ($error)
48 {
49  --echo # -- Error: can not establish connection '$con_name'.
50 }
51 if (!$error)
52 {
53  --echo # -- Connection '$con_name' has been established.
54 }
55 
56 --enable_query_log