File: list_objects.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 (46 lines) | stat: -rw-r--r-- 1,293 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
if (!$create_table_name)
{
  die Need the name of temporary table where to put list of objects;
}

if (!$list_table_name)
{
  die Need the name of the table to list objects for;
}

--disable_query_log

# Create temporary table for storing the original
# list of objects in the table
eval CREATE TEMPORARY TABLE $create_table_name (
  id INT UNSIGNED PRIMARY KEY,
  type INT UNSIGNED,
  version INT UNSIGNED,
  state INT UNSIGNED,
  parent_obj_type INT  UNSIGNED,
  parent_obj_id INT  UNSIGNED,
  fq_name VARCHAR(512)
);

# Split the table_name variable into db and name part
# since ndbinfo.ndb$dict_obj_info.parent_fq_name uses format
# db/catalog/name
let $_db = `SELECT IF(INSTR('$list_table_name', '.'),
                      SUBSTRING_INDEX('$list_table_name', '.', 1),
                      'ndb_ddl_test')`; # Default to ndb_ddl_test
let $_name = `SELECT SUBSTRING_INDEX('$list_table_name', '.', -1)`;

let $table_id = `SELECT id FROM test.ndbinfo_dict_obj_info
                   WHERE fq_name = '$_db/def/$_name'`;
eval INSERT INTO $create_table_name
  SELECT * FROM test.ndbinfo_dict_obj_info
    WHERE parent_obj_id = $table_id;

# Show the object list
#eval select * from $create_table_name;

--enable_query_log

# Reset arguments
let $create_table_name =;
let $list_table_name =;