~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/include/connect2.inc

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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