summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-05-25 12:57:29 +0300
committerunknown <monty@mysql.com>2005-05-25 12:57:29 +0300
commitaa3a934b9d2e7585d9e40a4f56a060bad718baf5 (patch)
tree7e2cfec0d164861e5f7ef1edf9024ba69c156cc9 /sql
parent605f7061dc2ca28d78ad652b9b5a7225f55ccb9a (diff)
parent549f56dc3d7fdae2cf7d8ebfbc8a118bf21f12a0 (diff)
downloadmariadb-git-aa3a934b9d2e7585d9e40a4f56a060bad718baf5.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1 sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/sql_repl.cc36
3 files changed, 22 insertions, 21 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index d6dcd9ce9ae..904b4675c74 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -420,7 +420,7 @@ static const uint signed_longlong_len=19;
static const char *unsigned_longlong_str="18446744073709551615";
static const uint unsigned_longlong_len=20;
-inline static uint int_token(const char *str,uint length)
+static inline uint int_token(const char *str,uint length)
{
if (length < long_len) // quick normal case
return NUM;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 80c68dad247..8786304f893 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2823,8 +2823,8 @@ unsent_create_error:
TABLE *table= tables->table;
/* Skip first table, which is the table we are inserting in */
- lex->select_lex.table_list.first= (byte*) first_local_table->next;
- tables= (TABLE_LIST *) lex->select_lex.table_list.first;
+ select_lex->table_list.first= (byte*) first_local_table->next;
+ tables= (TABLE_LIST *) select_lex->table_list.first;
first_local_table->next= 0;
if (!(res= mysql_prepare_insert(thd, tables, first_local_table,
@@ -5394,6 +5394,7 @@ int multi_update_precheck(THD *thd, TABLE_LIST *tables)
1 error (message is sent to user)
-1 error (message is not sent to user)
*/
+
int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
{
DBUG_ENTER("multi_delete_precheck");
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 24b78bc9a3d..4249c9e1809 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -152,7 +152,8 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
File file;
DBUG_ENTER("open_binlog");
- if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
+ if ((file = my_open(log_file_name, O_RDONLY | O_BINARY | O_SHARE,
+ MYF(MY_WME))) < 0)
{
sql_print_error("Failed to open log (\
file '%s', errno %d)", log_file_name, my_errno);
@@ -1338,13 +1339,11 @@ int show_binlogs(THD* thd)
{
IO_CACHE *index_file;
LOG_INFO cur;
- IO_CACHE log;
File file;
- const char *errmsg= 0;
- MY_STAT stat_area;
char fname[FN_REFLEN];
List<Item> field_list;
uint length;
+ int cur_dir_len;
Protocol *protocol= thd->protocol;
DBUG_ENTER("show_binlogs");
@@ -1364,34 +1363,35 @@ int show_binlogs(THD* thd)
index_file=mysql_bin_log.get_index_file();
mysql_bin_log.get_current_log(&cur);
- int cur_dir_len = dirname_length(cur.log_file_name);
+ cur_dir_len= dirname_length(cur.log_file_name);
reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0);
/* The file ends with EOF or empty line */
while ((length=my_b_gets(index_file, fname, sizeof(fname))) > 1)
{
- fname[--length] = '\0'; /* remove the newline */
+ int dir_len;
+ ulonglong file_length= 0; // Length if open fails
+ fname[--length] = '\0'; // remove the newline
protocol->prepare_for_resend();
- int dir_len = dirname_length(fname);
- protocol->store(fname + dir_len, length-dir_len, &my_charset_bin);
- if(!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length-dir_len)))
+ dir_len= dirname_length(fname);
+ length-= dir_len;
+ protocol->store(fname + dir_len, length, &my_charset_bin);
+
+ if (!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length)))
+ file_length= cur.pos; /* The active log, use the active position */
+ else
{
- /* this is the active log, use the active position */
- protocol->store((ulonglong) cur.pos);
- } else {
/* this is an old log, open it and find the size */
- if ((file=open_binlog(&log, fname+dir_len, &errmsg)) >= 0)
+ if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY,
+ MYF(0))) >= 0)
{
- protocol->store((ulonglong) my_b_filelength(&log));
- end_io_cache(&log);
+ file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0));
my_close(file, MYF(0));
- } else {
- /* the file wasn't openable, but 0 is an invalid value anyway */
- protocol->store((ulonglong) 0);
}
}
+ protocol->store(file_length);
if (protocol->write())
goto err;
}