File: ndb_get_blob_tables.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 (40 lines) | stat: -rw-r--r-- 1,075 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
#
# ndb_get_blob_tables.inc - get blob tables names for all blob columns
#
# Usage:
# let ndb_database= <table database>;
# let ndb_table= <table name>;
# --source suite/ndb/include/ndb_get_blob_tables.inc
#
# For each blob column where will be a variable
#   $bt_<table database>_<table_name>_<column_name>
# with the blob table name (with escaped $)
#

let ndb_get_blob_tables_result_file= $MYSQLTEST_VARDIR/tmp/ndb_get_blob_tables_result.inc;
--perl
my $db = $ENV{ndb_database} or die "Missing ndb_database in environment";
my $tbl = $ENV{ndb_table} or die "Missing ndb_table in environment";
my $cmd = "$ENV{NDB_DESC} -d$db $tbl";

open RUN, "$cmd|";
open RES, ">$ENV{ndb_get_blob_tables_result_file}";
while (<RUN>)
{
  if (/(\w+) .* BT=(NDB.BLOB_\d+_\d+).*/)
  {
    my $column = $1;
    my $blob_table = $2;
    $blob_table =~ s/\$/\\\$/g;
    print RES "let \$bt_${db}_${tbl}_${column} = ".$blob_table.";\n";
  }
}
close RES;
close RUN;
EOF

let ndb_database=;
let ndb_table=;

--source $ndb_get_blob_tables_result_file
--remove_file $ndb_get_blob_tables_result_file