mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for:
bug #26215: mysql command line client should not strip comments from SQL statements and bug #11230: Keeping comments when storing stored procedures With the introduction of multiline comments support in the command line client (mysql) in MySQL 4.1, it became impossible to preserve client-side comments within single SQL statements or stored routines. This feature was useful for monitoring tools and maintenance. The patch adds a new option to the command line client ('--enable-comments', '-c') which allows to preserve SQL comments and send them to the server for single SQL statements, and to keep comments in the code for stored procedures / functions / triggers. The patch is a modification of the contributed patch from bug #11230 with the following changes: - code style changes to conform to the coding guidelines - changed is_prefix() to my_strnncoll() to detect the DELIMITER command, since the first one is case-sensitive and not charset-aware - renamed t/comments-51.* to t/mysql_comments.* - removed tests for comments in triggers since 5.0 does not have SHOW CREATE TRIGGER (those tests will be added back in 5.1). The test cases are only for bug #11230. No automated test case for bug #26215 is possible due to the test suite deficiencies (though the cases from the bug report were tested manually).
This commit is contained in:
37
mysql-test/t/mysql_comments.test
Normal file
37
mysql-test/t/mysql_comments.test
Normal file
@ -0,0 +1,37 @@
|
||||
# This test should work in embedded server after we fix mysqltest
|
||||
-- source include/not_embedded.inc
|
||||
###################### mysql_comments.test #############################
|
||||
# #
|
||||
# Testing of comments handling by the command line client (mysql) #
|
||||
# #
|
||||
# Creation: #
|
||||
# 2007-10-29 akopytov Implemented this test as a part of fixes for #
|
||||
# bug #26215 and bug #11230 #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Bug #11230: Keeping comments when storing stored procedures
|
||||
#
|
||||
|
||||
# See the content of mysql_comments.sql
|
||||
# Set the test database to a known state before running the tests.
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop function if exists foofct;
|
||||
drop procedure if exists empty;
|
||||
drop procedure if exists foosp;
|
||||
drop procedure if exists nicesp;
|
||||
drop trigger if exists t1_empty;
|
||||
drop trigger if exists t1_bi;
|
||||
--enable_warnings
|
||||
|
||||
# Test without comments
|
||||
--echo "Pass 1 : --disable-comments"
|
||||
--exec $MYSQL --disable-comments test 2>&1 < "./t/mysql_comments.sql"
|
||||
|
||||
# Test with comments
|
||||
--echo "Pass 2 : --enable-comments"
|
||||
--exec $MYSQL --enable-comments test 2>&1 < "./t/mysql_comments.sql"
|
||||
|
||||
--echo End of 5.0 tests
|
Reference in New Issue
Block a user