diff options
author | unknown <jimw@mysql.com> | 2005-06-10 20:11:20 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-06-10 20:11:20 -0700 |
commit | 871977f26f523a3587c24273e3ebc61ccd26890f (patch) | |
tree | d705e8bae3b02592b69a73dc9dce5f1923786c53 /client | |
parent | 9b7f8f709675d21e844b1a9ffa9ea4039b26b64c (diff) | |
parent | da4838a0f8026f701c6e16eb0af3816403f3da1a (diff) | |
download | mariadb-git-871977f26f523a3587c24273e3ebc61ccd26890f.tar.gz |
Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into mysql.com:/home/jimw/my/mysql-5.0-clean
client/mysql.cc:
Auto merged
mysql-test/r/lowercase_table2.result:
Auto merged
sql/mysqld.cc:
Auto merged
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index bc0cceda0cc..96b523d8dc8 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -953,6 +953,7 @@ static int read_lines(bool execute_commands) { #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__) char linebuffer[254]; + String buffer; #endif char *line; char in_string=0; @@ -994,8 +995,24 @@ static int read_lines(bool execute_commands) *p = '\0'; } #else - linebuffer[0]= (char) sizeof(linebuffer); - line= _cgets(linebuffer); + buffer.length(0); + /* _cgets() expects the buffer size - 3 as the first byte */ + linebuffer[0]= (char) sizeof(linebuffer) - 3; + do + { + line= _cgets(linebuffer); + buffer.append(line, (unsigned char)linebuffer[1]); + /* + If _cgets() gets an input line that is linebuffer[0] bytes + long, the next call to _cgets() will return immediately with + linebuffer[1] == 0, and it does the same thing for input that + is linebuffer[0]-1 bytes long. So it appears that even though + _cgets() replaces the newline (which is two bytes on Window) with + a nil, it still needs the space in the linebuffer for it. This is, + naturally, undocumented. + */ + } while (linebuffer[0] <= linebuffer[1] + 1); + line= buffer.c_ptr(); #endif /* __NETWARE__ */ #else if (opt_outfile) @@ -1052,6 +1069,9 @@ static int read_lines(bool execute_commands) status.exit_status=0; } } +#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__) + buffer.free(); +#endif return status.exit_status; } |