Skip to content

Commit b4ba815

Browse files
Merge [email protected]:/home/bk/mysql-5.1
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel
2 parents 26d2908 + fb4e9b0 commit b4ba815

95 files changed

Lines changed: 1933 additions & 872 deletions

Some content is hidden

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

client/client_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ enum options_client
6767
OPT_SLAP_POST_QUERY,
6868
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
6969
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
70-
OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_WRITE_BINLOG
70+
OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_WRITE_BINLOG
7171
};

client/mysql.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -885,14 +885,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
885885
opt_nopager= 1;
886886
break;
887887
case OPT_MYSQL_PROTOCOL:
888-
{
889-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
890-
{
891-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
892-
exit(1);
893-
}
888+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
889+
opt->name);
894890
break;
895-
}
896891
break;
897892
case 'A':
898893
opt_rehash= 0;

client/mysqladmin.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
287287
#endif
288288
break;
289289
case OPT_MYSQL_PROTOCOL:
290-
{
291-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
292-
{
293-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
294-
exit(1);
295-
}
290+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
291+
opt->name);
296292
break;
297293
}
298-
}
299294
if (error)
300295
{
301296
usage();

client/mysqlbinlog.cc

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -944,14 +944,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
944944
remote_opt= 1;
945945
break;
946946
case OPT_MYSQL_PROTOCOL:
947-
{
948-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
949-
{
950-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
951-
exit(1);
952-
}
947+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
948+
opt->name);
953949
break;
954-
}
955950
case OPT_START_DATETIME:
956951
start_datetime= convert_str_to_timestamp(start_datetime_str);
957952
break;
@@ -1104,7 +1099,7 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
11041099
uint logname_len;
11051100
NET* net;
11061101
int error= 0;
1107-
my_off_t old_off= start_position_mot;
1102+
my_off_t old_off= min(start_position_mot, BIN_LOG_HEADER_SIZE);
11081103
char fname[FN_REFLEN+1];
11091104
DBUG_ENTER("dump_remote_log_entries");
11101105

@@ -1167,7 +1162,7 @@ could be out of memory");
11671162
}
11681163
if (len < 8 && net->read_pos[0] == 254)
11691164
break; // end of data
1170-
DBUG_PRINT("info",( "len: %lu, net->read_pos[5]: %d\n",
1165+
DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",
11711166
len, net->read_pos[5]));
11721167
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
11731168
len - 1, &error_msg,
@@ -1256,10 +1251,17 @@ could be out of memory");
12561251
}
12571252
}
12581253
/*
1259-
Let's adjust offset for remote log as for local log to produce
1260-
similar text.
1254+
Let's adjust offset for remote log as for local log to produce
1255+
similar text and to have --stop-position to work identically.
1256+
1257+
Exception - the server sends Format_description_log_event
1258+
in the beginning of the dump, and only after it the event from
1259+
start_position. Let the old_off reflect it.
12611260
*/
1262-
old_off+= len-1;
1261+
if (old_off < start_position_mot)
1262+
old_off= start_position_mot;
1263+
else
1264+
old_off+= len-1;
12631265
}
12641266

12651267
err:

client/mysqlcheck.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
315315
break;
316316
case 'V': print_version(); exit(0);
317317
case OPT_MYSQL_PROTOCOL:
318-
{
319-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
320-
{
321-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
322-
exit(1);
323-
}
318+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
319+
opt->name);
324320
break;
325321
}
326-
}
327322
return 0;
328323
}
329324

client/mysqldump.c

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ static char *opt_password=0,*current_user=0,
109109
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
110110
*where=0, *order_by=0,
111111
*opt_compatible_mode_str= 0,
112-
*err_ptr= 0;
112+
*err_ptr= 0,
113+
*log_error_file= NULL;
113114
static char **defaults_argv= 0;
114115
static char compatible_mode_normal_str[255];
115116
static ulong opt_compatible_mode= 0;
@@ -120,7 +121,9 @@ static my_string opt_mysql_unix_port=0;
120121
static int first_error=0;
121122
static DYNAMIC_STRING extended_row;
122123
#include <sslopt-vars.h>
123-
FILE *md_result_file= 0;
124+
FILE *md_result_file= 0;
125+
FILE *stderror_file=0;
126+
124127
#ifdef HAVE_SMEM
125128
static char *shared_memory_base_name=0;
126129
#endif
@@ -320,6 +323,9 @@ static struct my_option my_long_options[] =
320323
0, 0, 0, 0, 0, 0},
321324
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
322325
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
326+
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
327+
(gptr*) &log_error_file, (gptr*) &log_error_file, 0, GET_STR,
328+
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
323329
{"master-data", OPT_MASTER_DATA,
324330
"This causes the binary log position and filename to be appended to the "
325331
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
@@ -801,14 +807,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
801807
break;
802808
}
803809
case (int) OPT_MYSQL_PROTOCOL:
804-
{
805-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
806-
{
807-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
808-
exit(1);
809-
}
810-
break;
811-
}
810+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
811+
opt->name);
812+
break;
812813
}
813814
return 0;
814815
}
@@ -4210,6 +4211,16 @@ int main(int argc, char **argv)
42104211
free_resources(0);
42114212
exit(exit_code);
42124213
}
4214+
4215+
if (log_error_file)
4216+
{
4217+
if(!(stderror_file= freopen(log_error_file, "a+", stderr)))
4218+
{
4219+
free_resources(0);
4220+
exit(EX_MYSQLERR);
4221+
}
4222+
}
4223+
42134224
if (connect_to_db(current_host, current_user, opt_password))
42144225
{
42154226
free_resources(0);
@@ -4273,5 +4284,9 @@ int main(int argc, char **argv)
42734284
if (!path)
42744285
write_footer(md_result_file);
42754286
free_resources();
4287+
4288+
if (stderror_file)
4289+
fclose(stderror_file);
4290+
42764291
return(first_error);
42774292
} /* main */

client/mysqlimport.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
231231
break;
232232
#endif
233233
case OPT_MYSQL_PROTOCOL:
234-
{
235-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
236-
{
237-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
238-
exit(1);
239-
}
234+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
235+
opt->name);
240236
break;
241-
}
242237
case '#':
243238
DBUG_PUSH(argument ? argument : "d:t:o");
244239
break;

client/mysqlshow.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
287287
#endif
288288
break;
289289
case OPT_MYSQL_PROTOCOL:
290-
{
291-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
292-
{
293-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
294-
exit(1);
295-
}
290+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
291+
opt->name);
296292
break;
297-
}
298293
case '#':
299294
DBUG_PUSH(argument ? argument : "d:t:o");
300295
break;

client/mysqlslap.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -689,14 +689,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
689689
#endif
690690
break;
691691
case OPT_MYSQL_PROTOCOL:
692-
{
693-
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
694-
{
695-
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
696-
exit(1);
697-
}
698-
break;
699-
}
692+
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
693+
opt->name);
694+
break;
700695
case '#':
701696
DBUG_PUSH(argument ? argument : default_dbug_option);
702697
break;

include/my_time.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ typedef long my_time_t;
5151

5252
/* two-digit years < this are 20..; >= this are 19.. */
5353
#define YY_PART_YEAR 70
54-
/* apply above magic to years < this */
55-
#define YY_MAGIC_BELOW 200
5654

5755
/* Flags to str_to_datetime */
5856
#define TIME_FUZZY_DATE 1
@@ -95,6 +93,7 @@ int check_time_range(struct st_mysql_time *, int *warning);
9593

9694
long calc_daynr(uint year,uint month,uint day);
9795
uint calc_days_in_year(uint year);
96+
uint year_2000_handling(uint year);
9897

9998
void init_time(void);
10099

0 commit comments

Comments
 (0)