Skip to content

Commit e00a614

Browse files
authored
[PATCH] View name contains space, backup fails (#3)
* Improved unit tests * Migrated to latest shunit2 & now using github as source * Added test cases & improved tests * Bug fix for `View name contains space` * Added exit codes & added tests
1 parent adda452 commit e00a614

40 files changed

+867
-49
lines changed

.travis.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ before_script: |
3434
before_install:
3535
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('testbench'), host='%', password_last_changed=FROM_UNIXTIME(1523829600) where User='root'; update user set plugin='mysql_native_password'; delete from user where User != 'root' OR host != '%'; delete from user where User = 'sys'; FLUSH PRIVILEGES;"
3636
- sudo service mysql restart
37-
- "[ -f shunit2-2.0.3.tgz ] || wget http://downloads.sourceforge.net/shunit2/shunit2-2.0.3.tgz -O shunit2-2.0.3.tgz"
38-
- tar zxf shunit2-2.0.3.tgz && rm shunit2-2.0.3.tgz
39-
- chmod +x ./shunit2-2.0.3/src/shell/shunit2
37+
- wget https://github.com/kward/shunit2/archive/v2.1.7.tar.gz -O shunit2-2.1.7.tar.gz && tar zxf shunit2-2.1.7.tar.gz && rm shunit2-2.1.7.tar.gz
38+
- chmod +x ./shunit2-2.1.7/shunit2
4039

4140
script:
4241
- kcov --include-pattern=backup.sh,tests.sh --exclude-pattern=coverage coverage ./tests.sh

backup.sh

+26-18
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ if [ ! -z "${SKIP_DATABASES}" ]; then
9595
# Split on ,
9696
SKIP_DATABASES=$(echo -e "${SKIP_DATABASES}" | tr "," "\n")
9797
for DB in ${SKIP_DATABASES} ; do
98-
VIEW_LIST_SQL="${VIEW_LIST_SQL}'${DB}'," ;
98+
VIEW_LIST_SQL="${VIEW_LIST_SQL}'${DB}'," ;
9999
done
100100
VIEW_LIST_SQL="${VIEW_LIST_SQL: : -1}"
101101
VIEW_LIST_SQL="${VIEW_LIST_SQL});"
@@ -107,65 +107,73 @@ fi
107107
VIEWS_LIST=$(mysql ${MYSQL_CONN} -ANe"${VIEW_LIST_SQL}")
108108

109109
if [ "$?" -ne 0 ]; then
110-
exitWithMsg 204 "Views listing failed"
110+
exitWithMsg 205 "Views listing failed"
111111
fi
112112

113-
VIEW_IGNORE_ARG=""
113+
VIEW_IGNORE_ARG=()
114114
# Split on :!
115115
VIEWS=$(echo -e "${VIEWS_LIST}" | tr ":!" "\n")
116+
# echo -e "${VIEWS}"
116117

118+
oldIFS=$IFS
119+
IFS=$'\n'
117120
for VIEW in $VIEWS; do # Concat ignore command
118-
VIEW_IGNORE_ARG="${VIEW_IGNORE_ARG} --ignore-table=${VIEW}"
121+
# Replace ` in ${VIEW}, does not work with ` for --ignore-table
122+
VIEW="${VIEW//\`/}"
123+
#VIEW=$(printf '%q' "${VIEW}")
124+
VIEW_IGNORE_ARG+=(--ignore-table=${VIEW} )
119125
done
120-
# Replace ` in ${VIEW_IGNORE_ARG}, does not work with ` in table/database names
121-
VIEW_IGNORE_ARG=${VIEW_IGNORE_ARG//\`/}
122-
# echo -e "${VIEW_IGNORE_ARG}"
123-
126+
IFS=$oldIFS
127+
# echo "${VIEW_IGNORE_ARG[@]}";
124128
echo "Structure..."
125-
mysqldump ${MYSQLDUMP_DEFAULTS} --routines=FALSE --triggers=FALSE --events=FALSE --no-data ${VIEW_IGNORE_ARG} --databases ${DBS} > ${BACKUP_DIR}/structure.sql
129+
mysqldump ${MYSQLDUMP_DEFAULTS} --skip-add-drop-table --routines=FALSE --triggers=FALSE --events=FALSE --no-data "${VIEW_IGNORE_ARG[@]}" --databases ${DBS} > ${BACKUP_DIR}/structure.sql
126130

127131
if [ "$?" -ne 0 ]; then
128-
exitWithMsg 205 "Structure dump failed"
132+
exitWithMsg 207 "Structure dump failed"
129133
fi
130134

131135
echo "Data ..."
132-
mysqldump ${MYSQLDUMP_DEFAULTS} --routines=FALSE --triggers=FALSE --events=FALSE --no-create-info ${VIEW_IGNORE_ARG} --databases ${DBS} > ${BACKUP_DIR}/database.sql
136+
mysqldump ${MYSQLDUMP_DEFAULTS} --routines=FALSE --triggers=FALSE --events=FALSE --no-create-info "${VIEW_IGNORE_ARG[@]}" --databases ${DBS} > ${BACKUP_DIR}/database.sql
133137

134138
if [ "$?" -ne 0 ]; then
135-
exitWithMsg 205 "Data dump failed"
139+
exitWithMsg 208 "Data dump failed"
136140
fi
137141

138142
echo "Routines ..."
139143
mysqldump ${MYSQLDUMP_DEFAULTS} --routines=TRUE --triggers=FALSE --events=FALSE --no-create-info --no-data --no-create-db --databases ${DBS} > ${BACKUP_DIR}/routines.sql
140144

141145
if [ "$?" -ne 0 ]; then
142-
exitWithMsg 205 "Routines dump failed"
146+
exitWithMsg 209 "Routines dump failed"
143147
fi
144148

145149
echo "Triggers ..."
146150
mysqldump ${MYSQLDUMP_DEFAULTS} --routines=FALSE --triggers=TRUE --events=FALSE --no-create-info --no-data --no-create-db --databases ${DBS} > ${BACKUP_DIR}/triggers.sql
147151

148152
if [ "$?" -ne 0 ]; then
149-
exitWithMsg 205 "Triggers dump failed"
153+
exitWithMsg 210 "Triggers dump failed"
150154
fi
151155

152156
echo "Events ..."
153157
mysqldump ${MYSQLDUMP_DEFAULTS} --routines=FALSE --triggers=FALSE --events=TRUE --no-create-info --no-data --no-create-db --databases ${DBS} > ${BACKUP_DIR}/events.sql
154158

155159
if [ "$?" -ne 0 ]; then
156-
exitWithMsg 205 "Events dump failed"
160+
exitWithMsg 211 "Events dump failed"
157161
fi
158162

159163
echo "Views ..."
160164
VIEWS_SHOW_SQL=""
165+
oldIFS=$IFS
166+
IFS=$'\n'
161167
for VIEW in $VIEWS; do # Concat SHOW CREATE VIEW command
162168
VIEWS_SHOW_SQL="${VIEWS_SHOW_SQL}SHOW CREATE VIEW ${VIEW};"
163169
done
170+
IFS=$oldIFS
171+
164172
# echo -e "${VIEWS_SHOW_SQL}"
165173
echo ${VIEWS_SHOW_SQL} | sed 's/;/\\G/g' | mysql ${MYSQL_CONN} > ${BACKUP_DIR}/views.sql
166174

167175
if [ "$?" -ne 0 ]; then
168-
exitWithMsg 205 "Views dump failed"
176+
exitWithMsg 212 "Views dump failed"
169177
fi
170178

171179
#Keeps lines starting with Create
@@ -185,7 +193,7 @@ echo "Users ..."
185193
mysqldump ${MYSQLDUMP_DEFAULTS} mysql --no-create-info --complete-insert --tables user db > ${BACKUP_DIR}/users.sql
186194

187195
if [ "$?" -ne 0 ]; then
188-
exitWithMsg 205 "Users dump failed"
196+
exitWithMsg 213 "Users dump failed"
189197
fi
190198

191199
echo "Grants ..."
@@ -195,7 +203,7 @@ GRANTS_LIST=$(mysql ${MYSQL_CONN} -ANe"${GRANTS_SQL}")
195203
echo ${GRANTS_LIST} | mysql --default-character-set=utf8 --skip-comments ${MYSQL_CONN} | sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/-- \1 --/;/--/{x;p;x;}' > ${BACKUP_DIR}/grants.sql
196204

197205
if [ "$?" -ne 0 ]; then
198-
exitWithMsg 205 "Grants dump failed"
206+
exitWithMsg 214 "Grants dump failed"
199207
fi
200208

201209
# Removes double backslashes > \\

samples/empty/create.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE DATABASE testbench CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

samples/empty/createuser.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE USER 'grantfail'@'%' IDENTIFIED BY 'testbench';

samples/empty/deleteuser.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP USER 'grantfail'@'%';

samples/empty/destroy.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP DATABASE testbench;

samples/empty/grantToDB.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GRANT ALL PRIVILEGES ON mysql.db TO 'grantfail'@'%';

samples/empty/grantToTestBench.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GRANT ALL PRIVILEGES ON testbench.* TO 'grantfail'@'%';

samples/empty/grantToUsers.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GRANT ALL PRIVILEGES ON mysql.user TO 'grantfail'@'%';

samples/withdata0/create.sql

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE DATABASE testbench CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
2+
USE testbench;
3+
4+
CREATE TABLE `table hérétique ! @*:` (
5+
`ma première colonne` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
6+
`qui utilise encore du latin sérieux` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL
7+
) ENGINE=InnoDB DEFAULT CHARSET=big5 COMMENT="Une table horrible";
8+
9+
ALTER TABLE `table hérétique ! @*:` ADD PRIMARY KEY (`ma première colonne`);
10+
ALTER TABLE `table hérétique ! @*:` ADD INDEX(`qui utilise encore du latin sérieux`);
11+
ALTER TABLE `table hérétique ! @*:` ADD UNIQUE(`ma première colonne`);
12+
ALTER TABLE `table hérétique ! @*:` ADD KEY `les cons` (`qui utilise encore du latin sérieux`) USING BTREE;

samples/withdata0/database.sql

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
3+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
4+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
5+
/*!40101 SET NAMES utf8 */;
6+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
7+
/*!40103 SET TIME_ZONE='+00:00' */;
8+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
9+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
10+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
11+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
12+
13+
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testbench` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
14+
15+
USE `testbench`;
16+
17+
LOCK TABLES `table hérétique ! @*:` WRITE;
18+
/*!40000 ALTER TABLE `table hérétique ! @*:` DISABLE KEYS */;
19+
/*!40000 ALTER TABLE `table hérétique ! @*:` ENABLE KEYS */;
20+
UNLOCK TABLES;
21+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
22+
23+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
24+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
25+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
26+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
27+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
28+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
29+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
30+

samples/withdata0/destroy.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP DATABASE testbench;

samples/withdata0/events.sql

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
3+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
4+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
5+
/*!40101 SET NAMES utf8 */;
6+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
7+
/*!40103 SET TIME_ZONE='+00:00' */;
8+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
9+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
10+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
11+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
12+
13+
USE `testbench`;
14+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
15+
16+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
17+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
18+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
19+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
20+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
21+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
22+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
23+

samples/withdata0/grants.sql

Whitespace-only changes.

samples/withdata0/routines.sql

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
3+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
4+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
5+
/*!40101 SET NAMES utf8 */;
6+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
7+
/*!40103 SET TIME_ZONE='+00:00' */;
8+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
9+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
10+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
11+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
12+
13+
USE `testbench`;
14+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
15+
16+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
17+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
18+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
19+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
20+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
21+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
22+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
23+

samples/withdata0/structure.sql

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
3+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
4+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
5+
/*!40101 SET NAMES utf8 */;
6+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
7+
/*!40103 SET TIME_ZONE='+00:00' */;
8+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
9+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
10+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
11+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
12+
13+
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testbench` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
14+
15+
USE `testbench`;
16+
/*!40101 SET @saved_cs_client = @@character_set_client */;
17+
/*!40101 SET character_set_client = utf8 */;
18+
CREATE TABLE `table hérétique ! @*:` (
19+
`ma première colonne` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
20+
`qui utilise encore du latin sérieux` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
21+
PRIMARY KEY (`ma première colonne`),
22+
UNIQUE KEY `ma première colonne` (`ma première colonne`),
23+
KEY `qui utilise encore du latin sérieux` (`qui utilise encore du latin sérieux`),
24+
KEY `les cons` (`qui utilise encore du latin sérieux`) USING BTREE
25+
) ENGINE=InnoDB DEFAULT CHARSET=big5 COMMENT='Une table horrible';
26+
/*!40101 SET character_set_client = @saved_cs_client */;
27+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
28+
29+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
30+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
31+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
32+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
33+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
34+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
35+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
36+

samples/withdata0/triggers.sql

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
3+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
4+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
5+
/*!40101 SET NAMES utf8 */;
6+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
7+
/*!40103 SET TIME_ZONE='+00:00' */;
8+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
9+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
10+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
11+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
12+
13+
USE `testbench`;
14+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
15+
16+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
17+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
18+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
19+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
20+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
21+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
22+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
23+

samples/withdata0/users.sql

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
3+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
4+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
5+
/*!40101 SET NAMES utf8 */;
6+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
7+
/*!40103 SET TIME_ZONE='+00:00' */;
8+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
9+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
10+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
11+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
12+
13+
LOCK TABLES `user` WRITE;
14+
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
15+
INSERT INTO `user` (`Host`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Create_user_priv`, `Event_priv`, `Trigger_priv`, `Create_tablespace_priv`, `ssl_type`, `ssl_cipher`, `x509_issuer`, `x509_subject`, `max_questions`, `max_updates`, `max_connections`, `max_user_connections`, `plugin`, `authentication_string`, `password_expired`, `password_last_changed`, `password_lifetime`, `account_locked`) VALUES ('%','root','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'mysql_native_password','*750C8C7EB2023688A4CE3F4B0E804064E19D4503','N','2018-04-15 22:00:00',NULL,'N');
16+
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
17+
UNLOCK TABLES;
18+
19+
LOCK TABLES `db` WRITE;
20+
/*!40000 ALTER TABLE `db` DISABLE KEYS */;
21+
INSERT INTO `db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Execute_priv`, `Event_priv`, `Trigger_priv`) VALUES ('localhost','performance_schema','mysql.session','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
22+
INSERT INTO `db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Execute_priv`, `Event_priv`, `Trigger_priv`) VALUES ('localhost','sys','mysql.sys','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y');
23+
/*!40000 ALTER TABLE `db` ENABLE KEYS */;
24+
UNLOCK TABLES;
25+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
26+
27+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
28+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
29+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
30+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
31+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
32+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
33+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
34+

samples/withdata0/views.sql

Whitespace-only changes.

samples/withdata1/create.sql

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CREATE DATABASE testbench CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
2+
USE testbench;
3+
4+
CREATE TABLE `table hérétique ! @*:` (
5+
`ma première colonne` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
6+
`qui utilise encore du latin sérieux` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL
7+
) ENGINE=InnoDB DEFAULT CHARSET=big5 COMMENT="Une table horrible";
8+
9+
ALTER TABLE `table hérétique ! @*:` ADD PRIMARY KEY (`ma première colonne`);
10+
ALTER TABLE `table hérétique ! @*:` ADD INDEX(`qui utilise encore du latin sérieux`);
11+
ALTER TABLE `table hérétique ! @*:` ADD UNIQUE(`ma première colonne`);
12+
ALTER TABLE `table hérétique ! @*:` ADD KEY `les cons` (`qui utilise encore du latin sérieux`) USING BTREE;
13+
CREATE ALGORITHM=UNDEFINED DEFINER=`testbench`@`%` SQL SECURITY DEFINER VIEW `je te vois` AS select `table hérétique ! @*:`.`ma première colonne` AS `ma première colonne`,`table hérétique ! @*:`.`qui utilise encore du latin sérieux` AS `qui utilise encore du latin sérieux` from `table hérétique ! @*:` ;

samples/withdata1/database.sql

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
3+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
4+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
5+
/*!40101 SET NAMES utf8 */;
6+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
7+
/*!40103 SET TIME_ZONE='+00:00' */;
8+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
9+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
10+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
11+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
12+
13+
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testbench` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
14+
15+
USE `testbench`;
16+
17+
LOCK TABLES `table hérétique ! @*:` WRITE;
18+
/*!40000 ALTER TABLE `table hérétique ! @*:` DISABLE KEYS */;
19+
/*!40000 ALTER TABLE `table hérétique ! @*:` ENABLE KEYS */;
20+
UNLOCK TABLES;
21+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
22+
23+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
24+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
25+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
26+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
27+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
28+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
29+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
30+

samples/withdata1/destroy.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP DATABASE testbench;

0 commit comments

Comments
 (0)