Debian Codegraph @

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

raw
1 #
2 # ndb_get_blob_tables.inc - get blob tables names for all blob columns
3 #
4 # Usage:
5 # let ndb_database= <table database>;
6 # let ndb_table= <table name>;
7 # --source suite/ndb/include/ndb_get_blob_tables.inc
8 #
9 # For each blob column where will be a variable
10 # $bt_<table database>_<table_name>_<column_name>
11 # with the blob table name (with escaped $)
12 #
13
14 let ndb_get_blob_tables_result_file= $MYSQLTEST_VARDIR/tmp/ndb_get_blob_tables_result.inc;
15 --perl
16 my $db = $ENV{ndb_database} or die "Missing ndb_database in environment";
17 my $tbl = $ENV{ndb_table} or die "Missing ndb_table in environment";
18 my $cmd = "$ENV{NDB_DESC} -d$db $tbl";
19
20 open RUN, "$cmd|";
21 open RES, ">$ENV{ndb_get_blob_tables_result_file}";
22 while (<RUN>)
23 {
24 if (/(\w+) .* BT=(NDB.BLOB_\d+_\d+).*/)
25 {
26 my $column = $1;
27 my $blob_table = $2;
28 $blob_table =~ s/\$/\\\$/g;
29 print RES "let \$bt_${db}_${tbl}_${column} = ".$blob_table.";\n";
30 }
31 }
32 close RES;
33 close RUN;
34 EOF
35
36 let ndb_database=;
37 let ndb_table=;
38
39 --source $ndb_get_blob_tables_result_file
40 --remove_file $ndb_get_blob_tables_result_file