Debian Codegraph @

mysql-test/suite/ndb/t/show_attributes.inc

raw
1 #
2 # show_attributes.inc - print table attribute details
3 # (output format is compatible with ndb_desc)
4 #
5 # Usage:
6 # [let $show_attributes_db=<db name>;]
7 # [let $show_attributes_table=<table name>;]
8 # --source show_attributes.inc
9 #
10
11 --disable_query_log
12
13 if (`select LENGTH('$show_attributes_db') = 0`)
14 {
15 # Default is to show properties of test
16 let $show_attributes_db=test;
17 }
18
19 if (`select LENGTH('$show_attributes_table') = 0`)
20 {
21 # Default is to show properties of t1
22 let $show_attributes_table=t1;
23 }
24
25 --replace_regex /BT=NDB\$BLOB_[0-9]+_[0-9]+/BT=NDB$BLOB_#_#/
26 eval SELECT CONCAT(
27 name, " ", column_type, " ",
28 IF(c.primary_key, "PRIMARY KEY", nullable),
29 IF(c.partition_key, " DISTRIBUTION KEY", ""),
30 " AT=", array_type,
31 " ST=", storage_type,
32 IF(c.auto_inc, " AUTO_INCR", ""),
33 IF(ISNULL(blob_table_name), "", CONCAT(" BV=2 BT=", blob_table_name)),
34 IF(c.dynamic, " DYNAMIC", ""),
35 IF(CHAR_LENGTH(c.default_value), CONCAT(" DEFAULT ", c.default_value), "")
36 )
37 AS "Attributes:"
38 FROM ndbinfo.dictionary_columns c
39 JOIN ndbinfo.dictionary_tables t USING (table_id)
40 LEFT OUTER JOIN ndbinfo.blobs b USING (table_id, column_id)
41 WHERE t.table_name = "$show_attributes_table"
42 AND t.database_name = "$show_attributes_db";
43
44 let $show_attributes_db=;
45 let $show_attributes_table=;
46 --enable_query_log