Debian Codegraph @

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

raw
1 # LOAD DATA line terminators
2 --let $lt_unix='\n'
3 --let $lt_windows='\r\n'
4 if (!$IS_WINDOWS) {
5 --let $lt_default=$lt_unix
6 }
7 if ($IS_WINDOWS) {
8 --let $lt_default=$lt_windows
9 }
10
11 --echo Auto increment coulumn being the primary key
12 --eval create table t1 (a $col_type not null auto_increment primary key, b int, c bigint) engine ndb
13 exec $NDB_IMPORT --state-dir=$MYSQLTEST_VARDIR/tmp
14 --keep-state --log-level=1 --missing-ai-column
15 --fields-terminated-by="::" --csvopt=n
16 test
17 $MYSQLTEST_VARDIR/tmp/t1.csv >> $NDB_TOOLS_OUTPUT 2>&1;
18
19 create table t1ver like t1;
20
21 --disable_query_log
22 eval load data local infile '$MYSQLTEST_VARDIR/tmp/t1.csv' into table t1ver
23 FIELDS TERMINATED BY '::'
24 lines terminated by $lt_default(b,c);
25 --enable_query_log
26
27 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver";
28 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1";
29 select count(*) from t1ver;
30 select count(*) from t1;
31
32 select count(*) from t1 x, t1ver y
33 where x.b = y.b;
34
35 drop table t1, t1ver;
36
37 --echo Auto increment coulumn being a part of the primary key
38 --eval create table t1 (a int, b $col_type not null auto_increment, c bigint, primary key(a, b)) engine ndb
39 exec $NDB_IMPORT --state-dir=$MYSQLTEST_VARDIR/tmp
40 --keep-state --log-level=1 --missing-ai-column
41 --fields-terminated-by="::" --csvopt=n
42 test
43 $MYSQLTEST_VARDIR/tmp/t1.csv >> $NDB_TOOLS_OUTPUT 2>&1;
44
45 create table t1ver like t1;
46
47 --disable_query_log
48 eval load data local infile '$MYSQLTEST_VARDIR/tmp/t1.csv' into table t1ver
49 FIELDS TERMINATED BY '::'
50 lines terminated by $lt_default(a,c);
51 --enable_query_log
52
53 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver";
54 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1";
55 select count(*) from t1ver;
56 select count(*) from t1;
57
58 select count(*) from t1 x, t1ver y
59 where x.a = y.a;
60
61 drop table t1, t1ver;
62
63 --echo Auto increment coulumn NOT being a part of the primary key
64 --eval create table t1 (a int primary key, b $col_type not null auto_increment, c bigint, key(b)) engine ndb
65 exec $NDB_IMPORT --state-dir=$MYSQLTEST_VARDIR/tmp
66 --keep-state --log-level=1 --missing-ai-column
67 --fields-terminated-by="::" --csvopt=n
68 test
69 $MYSQLTEST_VARDIR/tmp/t1.csv >> $NDB_TOOLS_OUTPUT 2>&1;
70
71 create table t1ver like t1;
72
73 --disable_query_log
74 eval load data local infile '$MYSQLTEST_VARDIR/tmp/t1.csv' into table t1ver
75 FIELDS TERMINATED BY '::'
76 lines terminated by $lt_default(a,c);
77 --enable_query_log
78
79 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver";
80 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1";
81 select count(*) from t1ver;
82 select count(*) from t1;
83
84 select count(*) from t1 x, t1ver y
85 where x.a = y.a;
86
87 drop table t1, t1ver;
88
89 --echo Auto increment coulumn being the last column in a table
90 --eval create table t1 (a int, b bigint, c $col_type not null auto_increment primary key) engine ndb
91 exec $NDB_IMPORT --state-dir=$MYSQLTEST_VARDIR/tmp
92 --keep-state --log-level=1 --missing-ai-column
93 --fields-terminated-by="::" --csvopt=n
94 test
95 $MYSQLTEST_VARDIR/tmp/t1.csv >> $NDB_TOOLS_OUTPUT 2>&1;
96
97 create table t1ver like t1;
98
99 --disable_query_log
100 eval load data local infile '$MYSQLTEST_VARDIR/tmp/t1.csv' into table t1ver
101 FIELDS TERMINATED BY '::'
102 lines terminated by $lt_default(a,b);
103 --enable_query_log
104
105 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver";
106 select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1";
107 select count(*) from t1ver;
108 select count(*) from t1;
109
110 select count(*) from t1 x, t1ver y
111 where x.b = y.b;
112
113 drop table t1, t1ver;