diff options
author | unknown <iggy@rolltop.ignatz42.dyndns.org> | 2006-11-21 21:10:02 -0500 |
---|---|---|
committer | unknown <iggy@rolltop.ignatz42.dyndns.org> | 2006-11-21 21:10:02 -0500 |
commit | 0c7d10bde7378e101e6ce4c0caa818fb0688f3db (patch) | |
tree | c505244d4f29337835050d6689727ea7df80c669 | |
parent | e7065e0643e7d59baccf917acdc15add5b7fcdbf (diff) | |
download | mariadb-git-0c7d10bde7378e101e6ce4c0caa818fb0688f3db.tar.gz |
Bug#19799 delimiter command not working correctly when sourcing a sql file
- Client side readline functions unconditionally search for Unix '\n' line
endings. In this case, the delimiter statement was set to '//\r' instead
of the intended '//'. When removing the '\n' check for and remove
preceeding '\r' character as well.
client/readline.cc:
Bug#19799 delimiter command not working correctly when sourcing a sql file
- When removing the '\n' character, check for and remove preceeding '\r'
character as well.
mysql-test/r/mysql.result:
Bug#19799 delimiter command not working correctly when sourcing a sql file
- Added Results.
mysql-test/t/mysql_delimiter.sql:
Bug#19799 delimiter command not working correctly when sourcing a sql file
- Added Tests.
mysql-test/t/mysql_delimiter_19799.sql:
Bug#19799 delimiter command not working correctly when sourcing a sql file
- File containing delimiter statement followed by '\r\n' line ending.
-rw-r--r-- | client/readline.cc | 3 | ||||
-rw-r--r-- | mysql-test/r/mysql.result | 4 | ||||
-rw-r--r-- | mysql-test/t/mysql_delimiter.sql | 9 | ||||
-rwxr-xr-x | mysql-test/t/mysql_delimiter_19799.sql | 1 |
4 files changed, 16 insertions, 1 deletions
diff --git a/client/readline.cc b/client/readline.cc index 3d524633d69..52abe1045b7 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -51,7 +51,8 @@ char *batch_readline(LINE_BUFFER *line_buff) if (!(pos=intern_read_line(line_buff,&out_length))) return 0; if (out_length && pos[out_length-1] == '\n') - out_length--; /* Remove '\n' */ + if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */ + out_length--; /* Remove '\r' */ line_buff->read_length=out_length; pos[out_length]=0; return pos; diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 14267afc27e..b76b2c1e3b7 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -36,6 +36,10 @@ Tables_in_test t1 t2 t3 +Database +information_schema +mysql +test _ Test delimiter : from command line a diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql index fa80c980b29..67075091c01 100644 --- a/mysql-test/t/mysql_delimiter.sql +++ b/mysql-test/t/mysql_delimiter.sql @@ -49,3 +49,12 @@ delimiter ; # Reset delimiter # Bug #11523: \d works differently than delimiter # source t/mysql_delimiter_source.sql +delimiter ; # Reset delimiter + +# +# Bug #19799: delimiter command not working correctly when sourcing a sql file +# with Windows style line endings. +# +source t/mysql_delimiter_19799.sql +show databases// +delimiter ; # Reset delimiter diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql new file mode 100755 index 00000000000..2a3d4378492 --- /dev/null +++ b/mysql-test/t/mysql_delimiter_19799.sql @@ -0,0 +1 @@ +delimiter // |