Commit 0c7d10bd authored by unknown's avatar unknown
Browse files

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.
parent e7065e06
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ Tables_in_test
t1
t2
t3
Database
information_schema
mysql
test
_
Test delimiter : from command line
a
+9 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
delimiter //