-- source include/have_ndb.inc # # Test showing extra ndb_desc options : # -a --autoinc # Show next stored autoincrement value for the table # # -x --context # Show table context info (database, schema, name and id) # --disable_query_log set @old_ndb_autoincrement_prefetch_sz = @@session.ndb_autoincrement_prefetch_sz; set ndb_autoincrement_prefetch_sz = 1; --enable_query_log create table test.t1 (a int auto_increment primary key, b int) engine=ndb; create table test.t2 (a int primary key, b int) engine=ndb; --echo Table with auto-inc, initial value --let $ndb_desc_opts= -a -x -dtest t1 --source suite/ndb/include/ndb_desc_print.inc insert into test.t1 (b) values (888); select * from test.t1 order by a; --echo Table with auto-inc, new value --let $ndb_desc_opts= -a -x -dtest t1 --source suite/ndb/include/ndb_desc_print.inc insert into test.t1 (a,b) values (12345, 888); select * from test.t1 order by a; --echo Table with auto-inc, forced value --let $ndb_desc_opts= -a -x -dtest t1 --source suite/ndb/include/ndb_desc_print.inc insert into test.t1 (b) values (888); select * from test.t1 order by a; --echo Table with auto-inc, next value after forced --let $ndb_desc_opts= -a -x -dtest t1 --source suite/ndb/include/ndb_desc_print.inc drop table test.t1; create table test.t1 (a int auto_increment primary key, b int) engine=ndb; --echo Re-created table with auto-inc, initial value --let $ndb_desc_opts= -a -x -dtest t1 --source suite/ndb/include/ndb_desc_print.inc drop table test.t1; create table test.t1 (a int primary key, b int) engine=ndb; --echo Re-created table with no auto-inc key --let $ndb_desc_opts= -a -x -dtest t1 --source suite/ndb/include/ndb_desc_print.inc --echo Table with no auto-inc --let $ndb_desc_opts= -a -x -dtest t2 drop table test.t1; drop table test.t2; --echo Show behaviour with a larger autoinc prefetch size set ndb_autoincrement_prefetch_sz = 8; create table test.t3 (a int auto_increment primary key, b int) engine=ndb; --echo Initial value : 1 --let $ndb_desc_opts= -a -x -dtest t3 --source suite/ndb/include/ndb_desc_print.inc insert into test.t3 (b) values (1); select * from test.t3 order by a; --echo After 1 insertion : 1 + 8 = 9 --let $ndb_desc_opts= -a -x -dtest t3 --source suite/ndb/include/ndb_desc_print.inc insert into test.t3 (b) values (1), (1), (1), (1), (1), (1), (1); select * from test.t3 order by a; --echo After 8 insertions : Still 9 --let $ndb_desc_opts= -a -x -dtest t3 --source suite/ndb/include/ndb_desc_print.inc insert into test.t3 (b) values (1); select * from test.t3 order by a; --echo After 9 insertions : 9 + 8 = 17 --let $ndb_desc_opts= -a -x -dtest t3 --source suite/ndb/include/ndb_desc_print.inc drop table test.t3; --disable_query_log set ndb_autoincrement_prefetch_sz = @old_ndb_autoincrement_prefetch_sz; --enable_query_log --echo Show embedded-metadata behaviour --echo sys/def/SYSTAB_0 has no embedded metadata --let $ndb_desc_opts= --embedded-metadata -dsys SYSTAB_0 --source suite/ndb/include/ndb_desc_print.inc --let $OUTPUT_FILE = $MYSQLTEST_VARDIR/tmp/ndb_desc_extra.txt --echo mysql/def/ndb_apply_status has embedded frm --exec $NDB_DESC -m -dmysql ndb_apply_status > $OUTPUT_FILE --let $assert_text= Version 1 embedded metadata (frm) --let $assert_file= $OUTPUT_FILE --let $assert_select= Metadata version : 1 --let $assert_count= 1 --source include/assert_grep.inc --remove_file $OUTPUT_FILE --echo User table has SDI with creating mysqld version create table test.user_tab(a int primary key, b varchar(50) default 'Hello', c blob, d json) engine=ndb; --exec $NDB_DESC -m -dtest user_tab > $OUTPUT_FILE --let $assert_text= SDI contains MySQL Server version --let $assert_file= $OUTPUT_FILE --let $assert_select= mysqld_version_id --let $assert_count= 1 --source include/assert_grep.inc --remove_file $OUTPUT_FILE drop table test.user_tab;