1# ==== Purpose ====
2#
3# See include/begin_include_file.inc
4#
5#
6# ==== Usage ====
7#
8# # At the end of include/my_file.inc:
9# --let $include_filename= my_file.inc
10# [--let $skip_restore_connection= 1]
11# [--let $rpl_debug= 1]
12# --source include/begin_include_file.inc
13#
14# Parameters:
15#   $include_filename
16#     Name of file that sources this file.
17#
18#   $skip_restore_connection
19#     By default, this script restores the connection that was active
20#     when begin_include_file.inc was sourced.  If
21#     $skip_restore_connection is set, then this step is skipped and
22#     end_include_file.inc leaves the connection as it was before
23#     end_include_file.inc was sourced.
24
25--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_warnings', 1, 1)`
26--let $_include_file_enabled_warnings= `SELECT SUBSTRING('$_include_file_enabled_warnings', 2)`
27if ($_tmp) {
28  --enable_warnings
29}
30if (!$_tmp) {
31  --disable_warnings
32}
33
34--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_query_log', 1, 1)`
35--let $_include_file_enabled_query_log= `SELECT SUBSTRING('$_include_file_enabled_query_log', 2)`
36if ($_tmp) {
37  --enable_query_log
38}
39if (!$_tmp) {
40  --disable_query_log
41}
42
43--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_result_log', 1, 1)`
44--let $_include_file_enabled_result_log= `SELECT SUBSTRING('$_include_file_enabled_result_log', 2)`
45if ($_tmp) {
46  --enable_result_log
47}
48if (!$_tmp) {
49  --disable_result_log
50}
51
52--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 1, 1)`
53--let $_include_file_enabled_abort_on_error= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 2)`
54if ($_tmp) {
55  --enable_abort_on_error
56}
57if (!$_tmp) {
58  --disable_abort_on_error
59}
60
61--let $_include_file_rpl_connection_name= `SELECT SUBSTRING_INDEX('$_include_file_connection', ',', 1)`
62--let $_include_file_connection= `SELECT SUBSTRING('$_include_file_connection', LENGTH('$_include_file_rpl_connection_name') + 2)`
63if (!$skip_restore_connection)
64{
65  --let $rpl_connection_name= $_include_file_rpl_connection_name
66  --source include/rpl_connection.inc
67}
68--let $skip_restore_connection= 0
69
70
71--dec $_include_file_depth
72--let $_include_file_indent= `SELECT REPEAT('.', $_include_file_depth)`
73
74if ($rpl_debug)
75{
76  --echo $_include_file_indent==== END include/$include_filename ====
77  --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
78}
79--let $include_filename=
80