Skip to content

Commit 506c7fd

Browse files
author
Mikael Ronstrom
committed
Merge MySQL 5.1.35 into MySQL 5.4
2 parents 4557f4e + fbb96b3 commit 506c7fd

File tree

805 files changed

+37083
-8745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

805 files changed

+37083
-8745
lines changed

.bzrignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,8 @@ mysql-test/linux_sys_vars.inc
12951295
mysql-test/load_sysvars.inc
12961296
mysql-test/mtr
12971297
mysql-test/mysql-test-run
1298+
mysql-test/mysql-test-gcov.err
1299+
mysql-test/mysql-test-gcov.msg
12981300
mysql-test/mysql-test-run-shell
12991301
mysql-test/mysql-test-run.log
13001302
mysql-test/mysql_test_run_new

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ IF(MSVC)
144144
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
145145
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
146146
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
147-
147+
148+
# Mark 32 bit executables large address aware so they can
149+
# use > 2GB address space
150+
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
151+
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
152+
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)
153+
148154
# Disable automatic manifest generation.
149155
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
150156
${CMAKE_EXE_LINKER_FLAGS})

README

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
This is a release of MySQL, a dual-license SQL database server.
2-
MySQL is brought to you by the MySQL team at MySQL AB.
2+
MySQL is brought to you by the MySQL team at Sun Microsystems, Inc.
33

44
License information can be found in these files:
55
- For GPL (free) distributions, see the COPYING file and
66
the EXCEPTIONS-CLIENT file.
77
- For commercial distributions, see the LICENSE.mysql file.
88

9+
GPLv2 Disclaimer
10+
For the avoidance of doubt, except that if any license choice
11+
other than GPL or LGPL is available it will apply instead, Sun
12+
elects to use only the General Public License version 2 (GPLv2)
13+
at this time for any software where a choice of GPL license versions
14+
is made available with the language indicating that GPLv2 or any
15+
later version may be used, or where a choice of which version of
16+
the GPL is applied is otherwise unspecified.
917

1018
For further information about MySQL or additional documentation, see:
1119
- The latest information about MySQL: http://www.mysql.com

client/my_readline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ typedef struct st_line_buffer
2929

3030
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
3131
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
32-
extern char *batch_readline(LINE_BUFFER *buffer);
32+
extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated);
3333
extern void batch_readline_end(LINE_BUFFER *buffer);

client/mysql.cc

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const char *VER= "14.14";
4949
#define MAX_COLUMN_LENGTH 1024
5050

5151
/* Buffer to hold 'version' and 'version_comment' */
52-
#define MAX_SERVER_VERSION_LENGTH 128
52+
static char *server_version= NULL;
5353

5454
/* Array of options to pass to libemysqld */
5555
#define MAX_SERVER_ARGS 64
@@ -115,6 +115,8 @@ extern "C" {
115115
#define PROMPT_CHAR '\\'
116116
#define DEFAULT_DELIMITER ";"
117117

118+
#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L)
119+
118120
typedef struct st_status
119121
{
120122
int exit_status;
@@ -246,11 +248,11 @@ typedef struct {
246248

247249
static COMMANDS commands[] = {
248250
{ "?", '?', com_help, 1, "Synonym for `help'." },
249-
{ "clear", 'c', com_clear, 0, "Clear command."},
251+
{ "clear", 'c', com_clear, 0, "Clear the current input statement."},
250252
{ "connect",'r', com_connect,1,
251253
"Reconnect to the server. Optional arguments are db and host." },
252254
{ "delimiter", 'd', com_delimiter, 1,
253-
"Set statement delimiter. NOTE: Takes the rest of the line as new delimiter." },
255+
"Set statement delimiter." },
254256
#ifdef USE_POPEN
255257
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
256258
#endif
@@ -1045,7 +1047,7 @@ static void fix_history(String *final_command);
10451047

10461048
static COMMANDS *find_command(char *name,char cmd_name);
10471049
static bool add_line(String &buffer,char *line,char *in_string,
1048-
bool *ml_comment);
1050+
bool *ml_comment, bool truncated);
10491051
static void remove_cntrl(String &buffer);
10501052
static void print_table_data(MYSQL_RES *result);
10511053
static void print_table_data_html(MYSQL_RES *result);
@@ -1117,7 +1119,7 @@ int main(int argc,char *argv[])
11171119
exit(1);
11181120
}
11191121
if (status.batch && !status.line_buff &&
1120-
!(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin)))
1122+
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
11211123
{
11221124
free_defaults(defaults_argv);
11231125
my_end(0);
@@ -1198,7 +1200,7 @@ int main(int argc,char *argv[])
11981200
#endif
11991201
sprintf(buff, "%s",
12001202
#ifndef NOT_YET
1201-
"Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n");
1203+
"Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n");
12021204
#else
12031205
"Type 'help [[%]function name[%]]' to get help on usage of function.\n");
12041206
#endif
@@ -1234,6 +1236,7 @@ sig_handler mysql_end(int sig)
12341236
glob_buffer.free();
12351237
old_buffer.free();
12361238
processed_prompt.free();
1239+
my_free(server_version,MYF(MY_ALLOW_ZERO_PTR));
12371240
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
12381241
my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR));
12391242
my_free(histfile,MYF(MY_ALLOW_ZERO_PTR));
@@ -1810,13 +1813,14 @@ static int read_and_execute(bool interactive)
18101813
ulong line_number=0;
18111814
bool ml_comment= 0;
18121815
COMMANDS *com;
1816+
bool truncated= 0;
18131817
status.exit_status=1;
18141818

18151819
for (;;)
18161820
{
18171821
if (!interactive)
18181822
{
1819-
line=batch_readline(status.line_buff);
1823+
line=batch_readline(status.line_buff, &truncated);
18201824
/*
18211825
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
18221826
Editors like "notepad" put this marker in
@@ -1913,7 +1917,7 @@ static int read_and_execute(bool interactive)
19131917
#endif
19141918
continue;
19151919
}
1916-
if (add_line(glob_buffer,line,&in_string,&ml_comment))
1920+
if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated))
19171921
break;
19181922
}
19191923
/* if in batch mode, send last query even if it doesn't end with \g or go */
@@ -1999,7 +2003,7 @@ static COMMANDS *find_command(char *name,char cmd_char)
19992003

20002004

20012005
static bool add_line(String &buffer,char *line,char *in_string,
2002-
bool *ml_comment)
2006+
bool *ml_comment, bool truncated)
20032007
{
20042008
uchar inchar;
20052009
char buff[80], *pos, *out;
@@ -2245,8 +2249,23 @@ static bool add_line(String &buffer,char *line,char *in_string,
22452249
}
22462250
if (out != line || !buffer.is_empty())
22472251
{
2248-
*out++='\n';
22492252
uint length=(uint) (out-line);
2253+
2254+
if (!truncated &&
2255+
(length < 9 ||
2256+
my_strnncoll (charset_info,
2257+
(uchar *)line, 9, (const uchar *) "delimiter", 9)))
2258+
{
2259+
/*
2260+
Don't add a new line in case there's a DELIMITER command to be
2261+
added to the glob buffer (e.g. on processing a line like
2262+
"<command>;DELIMITER <non-eof>") : similar to how a new line is
2263+
not added in the case when the DELIMITER is the first command
2264+
entered with an empty glob buffer.
2265+
*/
2266+
*out++='\n';
2267+
length++;
2268+
}
22502269
if (buffer.length() + length >= buffer.alloced_length())
22512270
buffer.realloc(buffer.length()+length+IO_SIZE);
22522271
if ((!*ml_comment || preserve_comments) && buffer.append(line, length))
@@ -2648,7 +2667,7 @@ static void get_current_db()
26482667
(res= mysql_use_result(&mysql)))
26492668
{
26502669
MYSQL_ROW row= mysql_fetch_row(res);
2651-
if (row[0])
2670+
if (row && row[0])
26522671
current_db= my_strdup(row[0], MYF(MY_WME));
26532672
mysql_free_result(res);
26542673
}
@@ -2855,7 +2874,7 @@ com_charset(String *buffer __attribute__((unused)), char *line)
28552874
param= get_arg(buff, 0);
28562875
if (!param || !*param)
28572876
{
2858-
return put_info("Usage: \\C char_setname | charset charset_name",
2877+
return put_info("Usage: \\C charset_name | charset charset_name",
28592878
INFO_ERROR, 0);
28602879
}
28612880
new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME));
@@ -3907,7 +3926,7 @@ static int com_source(String *buffer, char *line)
39073926
return put_info(buff, INFO_ERROR, 0);
39083927
}
39093928

3910-
if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file)))
3929+
if (!(line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, sql_file)))
39113930
{
39123931
my_fclose(sql_file,MYF(0));
39133932
return put_info("Can't initialize batch_readline", INFO_ERROR, 0);
@@ -4347,34 +4366,44 @@ select_limit, max_join_size);
43474366
static const char *
43484367
server_version_string(MYSQL *con)
43494368
{
4350-
static char buf[MAX_SERVER_VERSION_LENGTH] = "";
4351-
43524369
/* Only one thread calls this, so no synchronization is needed */
4353-
if (buf[0] == '\0')
4370+
if (server_version == NULL)
43544371
{
4355-
char *bufp = buf;
43564372
MYSQL_RES *result;
43574373

4358-
bufp= strnmov(buf, mysql_get_server_info(con), sizeof buf);
4359-
43604374
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
43614375
if (!mysql_query(con, "select @@version_comment limit 1") &&
43624376
(result = mysql_use_result(con)))
43634377
{
43644378
MYSQL_ROW cur = mysql_fetch_row(result);
43654379
if (cur && cur[0])
43664380
{
4367-
bufp = strxnmov(bufp, sizeof buf - (bufp - buf), " ", cur[0], NullS);
4381+
/* version, space, comment, \0 */
4382+
size_t len= strlen(mysql_get_server_info(con)) + strlen(cur[0]) + 2;
4383+
4384+
if ((server_version= (char *) my_malloc(len, MYF(MY_WME))))
4385+
{
4386+
char *bufp;
4387+
bufp = strmov(server_version, mysql_get_server_info(con));
4388+
bufp = strmov(bufp, " ");
4389+
(void) strmov(bufp, cur[0]);
4390+
}
43684391
}
43694392
mysql_free_result(result);
43704393
}
43714394

4372-
/* str*nmov doesn't guarantee NUL-termination */
4373-
if (bufp == buf + sizeof buf)
4374-
buf[sizeof buf - 1] = '\0';
4395+
/*
4396+
If for some reason we didn't get a version_comment, we'll
4397+
keep things simple.
4398+
*/
4399+
4400+
if (server_version == NULL)
4401+
{
4402+
server_version= strdup(mysql_get_server_info(con));
4403+
}
43754404
}
43764405

4377-
return buf;
4406+
return server_version ? server_version : "";
43784407
}
43794408

43804409
static int

client/mysqladmin.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
837837
bool old= (find_type(argv[0], &command_typelib, 2) ==
838838
ADMIN_OLD_PASSWORD);
839839
#ifdef __WIN__
840-
uint pw_len= strlen(pw);
840+
uint pw_len= (uint) strlen(pw);
841841
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
842842
printf("Warning: single quotes were not trimmed from the password by"
843843
" your command\nline client, as you might have expected.\n");

client/mysqlbinlog.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static Exit_status safe_connect();
128128
class Load_log_processor
129129
{
130130
char target_dir_name[FN_REFLEN];
131-
int target_dir_name_len;
131+
size_t target_dir_name_len;
132132

133133
/*
134134
When we see first event corresponding to some LOAD DATA statement in
@@ -285,9 +285,9 @@ class Load_log_processor
285285
File prepare_new_file_for_old_format(Load_log_event *le, char *filename);
286286
Exit_status load_old_format_file(NET* net, const char *server_fname,
287287
uint server_fname_len, File file);
288-
Exit_status process_first_event(const char *bname, uint blen,
288+
Exit_status process_first_event(const char *bname, size_t blen,
289289
const uchar *block,
290-
uint block_len, uint file_id,
290+
size_t block_len, uint file_id,
291291
Create_file_log_event *ce);
292292
};
293293

@@ -305,7 +305,7 @@ class Load_log_processor
305305
File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
306306
char *filename)
307307
{
308-
uint len;
308+
size_t len;
309309
char *tail;
310310
File file;
311311

@@ -319,7 +319,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
319319
return -1;
320320
}
321321

322-
le->set_fname_outside_temp_buf(filename,len+strlen(tail));
322+
le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail));
323323

324324
return file;
325325
}
@@ -411,9 +411,9 @@ Exit_status Load_log_processor::load_old_format_file(NET* net,
411411
@retval OK_CONTINUE No error, the program should continue.
412412
*/
413413
Exit_status Load_log_processor::process_first_event(const char *bname,
414-
uint blen,
414+
size_t blen,
415415
const uchar *block,
416-
uint block_len,
416+
size_t block_len,
417417
uint file_id,
418418
Create_file_log_event *ce)
419419
{
@@ -456,7 +456,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
456456
}
457457

458458
if (ce)
459-
ce->set_fname_outside_temp_buf(fname, strlen(fname));
459+
ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname));
460460

461461
if (my_write(file, (uchar*)block, block_len, MYF(MY_WME|MY_NABP)))
462462
{
@@ -1189,7 +1189,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
11891189
long dummy_my_timezone;
11901190
my_bool dummy_in_dst_time_gap;
11911191
/* We require a total specification (date AND time) */
1192-
if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) !=
1192+
if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) !=
11931193
MYSQL_TIMESTAMP_DATETIME || was_cut)
11941194
{
11951195
error("Incorrect date and time argument: %s", str);

client/mysqlcheck.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int get_options(int *argc, char ***argv)
349349

350350
if (!what_to_do)
351351
{
352-
int pnlen = strlen(my_progname);
352+
size_t pnlen= strlen(my_progname);
353353

354354
if (pnlen < 6) /* name too short */
355355
what_to_do = DO_CHECK;
@@ -448,7 +448,8 @@ static int process_selected_tables(char *db, char **table_names, int tables)
448448
space is for more readable output in logs and in case of error
449449
*/
450450
char *table_names_comma_sep, *end;
451-
int i, tot_length = 0;
451+
size_t tot_length= 0;
452+
int i= 0;
452453

453454
for (i = 0; i < tables; i++)
454455
tot_length+= fixed_name_length(*(table_names + i)) + 2;
@@ -464,7 +465,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
464465
*end++= ',';
465466
}
466467
*--end = 0;
467-
handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1);
468+
handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1));
468469
my_free(table_names_comma_sep, MYF(0));
469470
}
470471
else
@@ -486,7 +487,7 @@ static uint fixed_name_length(const char *name)
486487
else if (*p == '.')
487488
extra_length+= 2;
488489
}
489-
return (p - name) + extra_length;
490+
return (uint) ((p - name) + extra_length);
490491
}
491492

492493

0 commit comments

Comments
 (0)