Debian Codegraph @

mysql-test/suite/ndb/include/ndb_exec.inc

raw
1 #
2 # Usage:
3 #
4 # let $ndb_exec_command= $NDB_DESC -d test t1;
5 # let $ndb_exec_select= output_line like 'Table options:%';
6 # let $ndb_exec_project= output_line;
7 # let $ndb_exec_replace= /([ _])[0-9][0-9]*/\1#/;
8 # source suite/ndb/include/ndb_exec.inc;
9 #
10
11 if ($ndb_exec_file) {
12 echo The variable ndb_exec_file must be empty when calling ndb_exec.inc;
13 die Bad argument ndb_exec_file must be empty;
14 }
15
16 if (!$ndb_exec_command) {
17 echo The variable ndb_exec_command must be set when calling ndb_exec.inc;
18 die Missing argument ndb_exec_command;
19 }
20
21 if (!$ndb_exec_select) {
22 let $ndb_exec_select= TRUE;
23 }
24
25 if (!$ndb_exec_project) {
26 let $ndb_exec_project= output_line;
27 }
28
29 if (!$ndb_exec_replace) {
30 let $ndb_exec_replace=;
31 }
32
33 let $ndb_exec_file = $MYSQLTEST_VARDIR/tmp/ndb_exec_file.txt;
34 exec $ndb_exec_command > $ndb_exec_file;
35 disable_query_log;
36 create temporary table ndb_exec_output (
37 idx int auto_increment primary key,
38 output_line text
39 );
40 set @save_local_infile = @@local_infile;
41 set GLOBAL local_infile = ON;
42 eval
43 load data local infile '$ndb_exec_file'
44 into table ndb_exec_output
45 fields terminated by '\r'
46 (output_line,@dummy);
47 replace_regex $ndb_exec_replace;
48 eval
49 select $ndb_exec_project
50 from ndb_exec_output
51 where $ndb_exec_select
52 order by idx;
53 drop table ndb_exec_output;
54 set GLOBAL local_infile = @save_local_infile;
55 enable_query_log;
56 remove_file $ndb_exec_file;
57
58 let $ndb_exec_file=;
59 let $ndb_exec_command=;
60 let $ndb_exec_select=;
61 let $ndb_exec_project=;
62 let $ndb_exec_replace=;