MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
begin_include_file.inc
1 # ==== Purpose ====
2 #
3 # This is an auxiliary file that facilitates writing include/*.inc
4 # files. It has three purposes:
5 #
6 # 1. Store mtr's state at the beginning of the .inc file and restore
7 # the state at the end. The following status is restored:
8 #
9 # disable_warnings
10 # disable_query_log
11 # disable_result_log
12 # disable_abort_on_errors
13 # Current connection
14 #
15 # 2. This file also prints the name of the .inc file that sources
16 # it. Only the name of the top-level .inc file is printed: if
17 # file_1.inc sources file_2.inc, then this file only prints
18 # file_1.inc.
19 #
20 # 3. If the mysqltest variable $rpl_debug is set, then
21 # this file will print:
22 #
23 # ==== BEGIN include/<filename> ====
24 #
25 # and end_include_file.inc will print
26 #
27 # ==== END include/<filename> ====
28 #
29 # These printouts are indented to make it easier to read the
30 # result log.
31 #
32 #
33 # ==== Usage ====
34 #
35 # # At the beginning of include/my_file.inc:
36 # --let $include_filename= my_file.inc
37 # [--let $rpl_debug= 1]
38 # --source include/begin_include_file.inc
39 #
40 # # At the end of include/my_file.inc:
41 # --let $include_filename= my_file.inc
42 # --source include/end_include_file.inc
43 #
44 # Parameters:
45 # $include_filename
46 # The basename of the file: a file named /path/to/my_file.inc
47 # should set $include_filename=my_file.inc. This parameter
48 # must be provided both for begin_include_file.inc and
49 # end_include_file.inc.
50 #
51 # $include_silent
52 # By default, the following string is printed to the result file:
53 # include/$include_filename
54 # If this variable is set, this printout is inhibited.
55 #
56 # $rpl_debug
57 # If set, this script will print the following text:
58 # ==== BEGIN include/$include_filename.inc ====
59 
60 
61 # Print 'include/$include_filename', but only when invoked from
62 # the top-level. We don't want to print
63 # 'include/$include_filename' from all files included
64 # recursively.
65 if (!$_include_file_depth)
66 {
67  if (!$include_silent)
68  {
69  --echo include/$include_filename
70  }
71  --let $_include_file_depth= 0
72 }
73 --inc $_include_file_depth
74 if ($rpl_debug)
75 {
76  --echo $_include_file_indent==== BEGIN include/$include_filename ====
77 }
78 
79 --let $_include_file_enabled_warnings= $ENABLED_WARNINGS$_include_file_enabled_warnings
80 --let $_include_file_enabled_query_log= $ENABLED_QUERY_LOG$_include_file_enabled_query_log
81 --let $_include_file_enabled_result_log= $ENABLED_RESULT_LOG$_include_file_enabled_result_log
82 --let $_include_file_enabled_abort_on_error= $ENABLED_ABORT_ON_ERROR$_include_file_enabled_abort_on_error
83 --let $_include_file_connection= $CURRENT_CONNECTION,$_include_file_connection
84 
85 if ($rpl_debug)
86 {
87  --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
88 }
89 
90 --let $include_filename=
91 --let $_include_file_indent= .$_include_file_indent