File: ndb_exec.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (62 lines) | stat: -rw-r--r-- 1,514 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#
# Usage:
#
# let $ndb_exec_command= $NDB_DESC -d test t1;
# let $ndb_exec_select= output_line like 'Table options:%';
# let $ndb_exec_project= output_line;
# let $ndb_exec_replace= /([ _])[0-9][0-9]*/\1#/;
# source suite/ndb/include/ndb_exec.inc;
#

if ($ndb_exec_file) {
  echo The variable ndb_exec_file must be empty when calling ndb_exec.inc;
  die Bad argument ndb_exec_file must be empty;
}

if (!$ndb_exec_command) {
  echo The variable ndb_exec_command must be set when calling ndb_exec.inc;
  die Missing argument ndb_exec_command;
}

if (!$ndb_exec_select) {
  let $ndb_exec_select= TRUE;
}

if (!$ndb_exec_project) {
  let $ndb_exec_project= output_line;
}

if (!$ndb_exec_replace) {
  let $ndb_exec_replace=;
}

let $ndb_exec_file = $MYSQLTEST_VARDIR/tmp/ndb_exec_file.txt;
exec $ndb_exec_command > $ndb_exec_file;
disable_query_log;
create temporary table ndb_exec_output (
  idx int auto_increment primary key,
  output_line text
);
set @save_local_infile = @@local_infile;
set GLOBAL local_infile = ON;
eval
  load data local infile '$ndb_exec_file'
  into table ndb_exec_output
  fields terminated by '\r'
  (output_line,@dummy);
replace_regex $ndb_exec_replace;
eval
  select $ndb_exec_project
  from ndb_exec_output
  where $ndb_exec_select
  order by idx;
drop table ndb_exec_output;
set GLOBAL local_infile = @save_local_infile;
enable_query_log;
remove_file $ndb_exec_file;

let $ndb_exec_file=;
let $ndb_exec_command=;
let $ndb_exec_select=;
let $ndb_exec_project=;
let $ndb_exec_replace=;