Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1929 05/10/12 17:19:20 tomas@stripped[tomas] +86 -0
my.patch
strings/my_strtoll10.c
1.13 05/10/12 17:18:10 tomas@stripped[tomas] +2 -2
Import patch my.patch
strings/longlong2str-x86.s
1.13 05/10/12 17:18:10 tomas@stripped[tomas] +74 -67
Import patch my.patch
strings/decimal.c
1.64 05/10/12 17:18:10 tomas@stripped[tomas] +1 -1
Import patch my.patch
storage/ndb/tools/ndb_config.cpp
1.15 05/10/12 17:18:09 tomas@stripped[tomas] +1 -3
Import patch my.patch
storage/ndb/tools/Makefile.am
1.25 05/10/12 17:18:09 tomas@stripped[tomas] +1 -1
Import patch my.patch
storage/ndb/src/mgmsrv/ConfigInfo.cpp
1.73 05/10/12 17:18:05 tomas@stripped[tomas] +2 -2
Import patch my.patch
storage/myisam/mi_search.c
1.61 05/10/12 17:17:59 tomas@stripped[tomas] +20 -25
Import patch my.patch
storage/myisam/mi_rkey.c
1.22 05/10/12 17:17:59 tomas@stripped[tomas] +2 -2
Import patch my.patch
sql/unireg.cc
1.68 05/10/12 17:17:55 tomas@stripped[tomas] +15 -20
Import patch my.patch
sql/table.h
1.115 05/10/12 17:17:55 tomas@stripped[tomas] +2 -0
Import patch my.patch
sql/table.cc
1.183 05/10/12 17:17:55 tomas@stripped[tomas] +29 -51
Import patch my.patch
sql/structs.h
1.51 05/10/12 17:17:55 tomas@stripped[tomas] +1 -1
Import patch my.patch
sql/sql_view.cc
1.71 05/10/12 17:17:55 tomas@stripped[tomas] +1 -1
Import patch my.patch
sql/sql_update.cc
1.175 05/10/12 17:17:55 tomas@stripped[tomas] +3 -0
Import patch my.patch
sql/sql_table.cc
1.275 05/10/12 17:17:55 tomas@stripped[tomas] +12 -10
Import patch my.patch
sql/sql_show.cc
1.274 05/10/12 17:17:55 tomas@stripped[tomas] +3 -5
Import patch my.patch
sql/sql_select.cc
1.367 05/10/12 17:17:55 tomas@stripped[tomas] +4 -19
Import patch my.patch
sql/sql_prepare.cc
1.153 05/10/12 17:17:55 tomas@stripped[tomas] +56 -52
Import patch my.patch
sql/sql_parse.cc
1.479 05/10/12 17:17:55 tomas@stripped[tomas] +115 -57
Import patch my.patch
sql/sql_manager.cc
1.7 05/10/12 17:17:54 tomas@stripped[tomas] +5 -7
Import patch my.patch
sql/sql_insert.cc
1.174 05/10/12 17:17:54 tomas@stripped[tomas] +1 -1
Import patch my.patch
sql/sql_class.cc
1.216 05/10/12 17:17:54 tomas@stripped[tomas] +5 -9
Import patch my.patch
sql/sql_base.cc
1.278 05/10/12 17:17:54 tomas@stripped[tomas] +2 -2
Import patch my.patch
sql/sp_head.cc
1.191 05/10/12 17:17:54 tomas@stripped[tomas] +2 -3
Import patch my.patch
sql/sp_cache.cc
1.16 05/10/12 17:17:54 tomas@stripped[tomas] +1 -1
Import patch my.patch
sql/sp.cc
1.94 05/10/12 17:17:54 tomas@stripped[tomas] +15 -16
Import patch my.patch
sql/slave.cc
1.257 05/10/12 17:17:54 tomas@stripped[tomas] +1 -1
Import patch my.patch
sql/password.c
1.39 05/10/12 17:17:54 tomas@stripped[tomas] +5 -8
Import patch my.patch
sql/parse_file.cc
1.17 05/10/12 17:17:54 tomas@stripped[tomas] +3 -4
Import patch my.patch
sql/opt_range.cc
1.182 05/10/12 17:17:54 tomas@stripped[tomas] +7 -3
Import patch my.patch
sql/mysqld.cc
1.485 05/10/12 17:17:54 tomas@stripped[tomas] +0 -99
Import patch my.patch
sql/log_event.cc
1.190 05/10/12 17:17:54 tomas@stripped[tomas] +14 -9
Import patch my.patch
sql/item_strfunc.h
1.98 05/10/12 17:17:54 tomas@stripped[tomas] +1 -1
Import patch my.patch
sql/item_strfunc.cc
1.258 05/10/12 17:17:54 tomas@stripped[tomas] +27 -15
Import patch my.patch
sql/item_func.cc
1.259 05/10/12 17:17:54 tomas@stripped[tomas] +52 -76
Import patch my.patch
sql/item.h
1.174 05/10/12 17:17:54 tomas@stripped[tomas] +11 -5
Import patch my.patch
sql/item.cc
1.152 05/10/12 17:17:54 tomas@stripped[tomas] +49 -53
Import patch my.patch
sql/handler.h
1.162 05/10/12 17:17:54 tomas@stripped[tomas] +0 -1
Import patch my.patch
sql/handler.cc
1.189 05/10/12 17:17:54 tomas@stripped[tomas] +17 -26
Import patch my.patch
sql/ha_ndbcluster.cc
1.214 05/10/12 17:17:54 tomas@stripped[tomas] +4 -3
Import patch my.patch
sql/ha_federated.cc
1.40 05/10/12 17:17:54 tomas@stripped[tomas] +60 -28
Import patch my.patch
server-tools/instance-manager/thread_registry.cc
1.9 05/10/12 17:17:54 tomas@stripped[tomas] +4 -9
Import patch my.patch
server-tools/instance-manager/password.c
1.2 05/10/12 17:17:54 tomas@stripped[tomas] +521 -0
Import patch my.patch
server-tools/instance-manager/instance.cc
1.29 05/10/12 17:17:54 tomas@stripped[tomas] +1 -1
Import patch my.patch
scripts/make_win_src_distribution.sh
1.44 05/10/12 17:17:54 tomas@stripped[tomas] +1 -1
Import patch my.patch
scripts/make_binary_distribution.sh
1.97 05/10/12 17:17:54 tomas@stripped[tomas] +0 -1
Import patch my.patch
mysys/thr_mutex.c
1.28 05/10/12 17:17:53 tomas@stripped[tomas] +1 -1
Import patch my.patch
mysys/thr_lock.c
1.50 05/10/12 17:17:53 tomas@stripped[tomas] +4 -5
Import patch my.patch
mysys/my_os2cond.c
1.6 05/10/12 17:17:53 tomas@stripped[tomas] +88 -63
Import patch my.patch
mysys/mf_keycache.c
1.56 05/10/12 17:17:53 tomas@stripped[tomas] +8 -9
Import patch my.patch
mysys/mf_format.c
1.22 05/10/12 17:17:53 tomas@stripped[tomas] +9 -7
Import patch my.patch
mysql-test/t/view.test
1.117 05/10/12 17:17:53 tomas@stripped[tomas] +4 -27
Import patch my.patch
mysql-test/t/type_float.test
1.28 05/10/12 17:17:53 tomas@stripped[tomas] +0 -13
Import patch my.patch
mysql-test/t/subselect2.test
1.6 05/10/12 17:17:53 tomas@stripped[tomas] +0 -2
Import patch my.patch
mysql-test/t/select.test
1.83 05/10/12 17:17:53 tomas@stripped[tomas] +0 -4
Import patch my.patch
mysql-test/t/rpl_multi_update3.test
1.6 05/10/12 17:17:53 tomas@stripped[tomas] +0 -59
Import patch my.patch
mysql-test/t/range.test
1.37 05/10/12 17:17:53 tomas@stripped[tomas] +0 -5
Import patch my.patch
mysql-test/t/mysqlshow.test
1.4 05/10/12 17:17:53 tomas@stripped[tomas] +0 -4
Import patch my.patch
mysql-test/t/mysql.test
1.5 05/10/12 17:17:53 tomas@stripped[tomas] +1 -1
Import patch my.patch
mysql-test/t/func_str.test
1.84 05/10/12 17:17:53 tomas@stripped[tomas] +0 -2
Import patch my.patch
mysql-test/t/federated.test
1.16 05/10/12 17:17:53 tomas@stripped[tomas] +0 -2
Import patch my.patch
mysql-test/t/ctype_utf8.test
1.73 05/10/12 17:17:53 tomas@stripped[tomas] +1 -5
Import patch my.patch
mysql-test/t/alter_table.test
1.42 05/10/12 17:17:53 tomas@stripped[tomas] +5 -5
Import patch my.patch
mysql-test/r/view.result
1.125 05/10/12 17:17:53 tomas@stripped[tomas] +5 -30
Import patch my.patch
mysql-test/r/user_var-binlog.result
1.6 05/10/12 17:17:53 tomas@stripped[tomas] +2 -2
Import patch my.patch
mysql-test/r/type_float.result
1.43 05/10/12 17:17:53 tomas@stripped[tomas] +0 -15
Import patch my.patch
mysql-test/r/subselect2.result
1.13 05/10/12 17:17:53 tomas@stripped[tomas] +0 -3
Import patch my.patch
mysql-test/r/select.result
1.100 05/10/12 17:17:53 tomas@stripped[tomas] +0 -7
Import patch my.patch
mysql-test/r/rpl_multi_update3.result
1.5 05/10/12 17:17:52 tomas@stripped[tomas] +0 -72
Import patch my.patch
mysql-test/r/range.result
1.44 05/10/12 17:17:52 tomas@stripped[tomas] +0 -7
Import patch my.patch
mysql-test/r/ndb_config.result
1.7 05/10/12 17:17:52 tomas@stripped[tomas] +1 -0
Import patch my.patch
mysql-test/r/mysqlshow.result
1.3 05/10/12 17:17:52 tomas@stripped[tomas] +0 -1
Import patch my.patch
mysql-test/r/mysqldump.result
1.75 05/10/12 17:17:52 tomas@stripped[tomas] +34 -36
Import patch my.patch
mysql-test/r/mysql.result
1.5 05/10/12 17:17:52 tomas@stripped[tomas] +0 -1
Import patch my.patch
mysql-test/r/func_str.result
1.110 05/10/12 17:17:52 tomas@stripped[tomas] +2 -8
Import patch my.patch
mysql-test/r/federated.result
1.19 05/10/12 17:17:52 tomas@stripped[tomas] +0 -6
Import patch my.patch
mysql-test/r/ctype_utf8.result
1.77 05/10/12 17:17:52 tomas@stripped[tomas] +16 -18
Import patch my.patch
include/mysql_com.h
1.104 05/10/12 17:17:52 tomas@stripped[tomas] +1 -1
Import patch my.patch
include/my_sys.h
1.175 05/10/12 17:17:52 tomas@stripped[tomas] +1 -0
Import patch my.patch
config/ac-macros/yassl.m4
1.8 05/10/12 17:17:52 tomas@stripped[tomas] +1 -1
Import patch my.patch
cmd-line-utils/readline/complete.c
1.17 05/10/12 17:17:52 tomas@stripped[tomas] +1 -1
Import patch my.patch
client/mysqltest.c
1.163 05/10/12 17:17:52 tomas@stripped[tomas] +9 -7
Import patch my.patch
client/mysqldump.c
1.206 05/10/12 17:17:51 tomas@stripped[tomas] +61 -69
Import patch my.patch
client/mysql.cc
1.185 05/10/12 17:17:51 tomas@stripped[tomas] +27 -49
Import patch my.patch
BUILD/SETUP.sh
1.49 05/10/12 17:17:51 tomas@stripped[tomas] +0 -4
Import patch my.patch
BUILD/FINISH.sh
1.32 05/10/12 17:17:51 tomas@stripped[tomas] +1 -1
Import patch my.patch
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/5.1-fault
--- 1.184/client/mysql.cc 2005-10-08 01:48:54 +02:00
+++ 1.185/client/mysql.cc 2005-10-12 17:17:51 +02:00
@@ -320,7 +320,7 @@
static void fix_history(String *final_command);
#endif
-static COMMANDS *find_command(char *name,char cmd_name);
+static COMMANDS *find_command (char *name,char cmd_name);
static bool add_line(String &buffer,char *line,char *in_string,
bool *ml_comment);
static void remove_cntrl(String &buffer);
@@ -1109,12 +1109,10 @@
}
-static COMMANDS *find_command(char *name,char cmd_char)
+static COMMANDS *find_command (char *name,char cmd_char)
{
uint len;
char *end;
- DBUG_ENTER("find_command");
- DBUG_PRINT("enter",("name: '%s' char: %d", name ? name : "NULL", cmd_char));
if (!name)
{
@@ -1126,16 +1124,12 @@
while (my_isspace(charset_info,*name))
name++;
/*
- If there is an \\g in the row or if the row has a delimiter but
- this is not a delimiter command, let add_line() take care of
- parsing the row and calling find_command()
+ As special case we allow row that starts with word delimiter
+ to be able to change delimiter if someone has delimiter 'delimiter'.
*/
if (strstr(name, "\\g") || (strstr(name, delimiter) &&
- strlen(name) >= 9 &&
- my_strnncoll(charset_info,(uchar*) name,
- 9,
- (const uchar*) "delimiter", 9)))
- DBUG_RETURN((COMMANDS *) 0);
+ strncmp(name, "delimiter", 9)))
+ return ((COMMANDS *) 0);
if ((end=strcont(name," \t")))
{
len=(uint) (end - name);
@@ -1151,18 +1145,15 @@
for (uint i= 0; commands[i].name; i++)
{
if (commands[i].func &&
- ((name &&
+ ((name &&
!my_strnncoll(charset_info,(uchar*)name,len,
(uchar*)commands[i].name,len) &&
!commands[i].name[len] &&
(!end || (end && commands[i].takes_params))) ||
!name && commands[i].cmd_char == cmd_char))
- {
- DBUG_PRINT("exit",("found command: %s", commands[i].name));
- DBUG_RETURN(&commands[i]);
- }
+ return (&commands[i]);
}
- DBUG_RETURN((COMMANDS *) 0);
+ return ((COMMANDS *) 0);
}
@@ -1173,16 +1164,15 @@
char buff[80], *pos, *out;
COMMANDS *com;
bool need_space= 0;
- DBUG_ENTER("add_line");
if (!line[0] && buffer.is_empty())
- DBUG_RETURN(0);
+ return 0;
#ifdef HAVE_READLINE
if (status.add_to_history && line[0] && not_in_history(line))
add_history(line);
#endif
#ifdef USE_MB
- char *end_of_line=line+(uint) strlen(line);
+ char *strend=line+(uint) strlen(line);
#endif
for (pos=out=line ; (inchar= (uchar) *pos) ; pos++)
@@ -1191,14 +1181,13 @@
buffer.is_empty())
continue;
#ifdef USE_MB
- int length;
+ int l;
if (use_mb(charset_info) &&
- (length= my_ismbchar(charset_info, pos, end_of_line)))
- {
- while (length--)
- *out++ = *pos++;
- pos--;
- continue;
+ (l = my_ismbchar(charset_info, pos, strend))) {
+ while (l--)
+ *out++ = *pos++;
+ pos--;
+ continue;
}
#endif
if (!*ml_comment && inchar == '\\')
@@ -1218,7 +1207,7 @@
const String tmp(line,(uint) (out-line), charset_info);
buffer.append(tmp);
if ((*com->func)(&buffer,pos-1) > 0)
- DBUG_RETURN(1); // Quit
+ return 1; // Quit
if (com->takes_params)
{
for (pos++ ;
@@ -1236,40 +1225,29 @@
{
sprintf(buff,"Unknown command '\\%c'.",inchar);
if (put_info(buff,INFO_ERROR) > 0)
- DBUG_RETURN(1);
+ return 1;
*out++='\\';
*out++=(char) inchar;
continue;
}
}
- else if (!*ml_comment && !*in_string &&
- (*pos == *delimiter && is_prefix(pos + 1, delimiter + 1) ||
- buffer.length() == 0 && (out - line) >= 9 &&
- !my_strcasecmp(charset_info, line, "delimiter")))
+
+ else if (!*ml_comment && (*pos == *delimiter &&
+ is_prefix(pos + 1, delimiter + 1)) &&
+ !*in_string)
{
uint old_delimiter_length= delimiter_length;
if (out != line)
buffer.append(line, (uint) (out - line)); // Add this line
if ((com= find_command(buffer.c_ptr(), 0)))
{
- if (com->func == com_delimiter)
- {
- /*
- Delimiter wants the get rest of the given line as argument to
- allow one to change ';' to ';;' and back
- */
- char *end= strend(pos);
- buffer.append(pos, (uint) (end - pos));
- /* Ensure pos will point at \0 after the pos+= below */
- pos= end - old_delimiter_length + 1;
- }
if ((*com->func)(&buffer, buffer.c_ptr()) > 0)
- DBUG_RETURN(1); // Quit
+ return 1; // Quit
}
else
{
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
- DBUG_RETURN(1);
+ return 1;
}
buffer.length(0);
out= line;
@@ -1321,9 +1299,9 @@
if (buffer.length() + length >= buffer.alloced_length())
buffer.realloc(buffer.length()+length+IO_SIZE);
if (!(*ml_comment) && buffer.append(line,length))
- DBUG_RETURN(1);
+ return 1;
}
- DBUG_RETURN(0);
+ return 0;
}
/*****************************************************************
--- 1.205/client/mysqldump.c 2005-10-11 23:58:17 +02:00
+++ 1.206/client/mysqldump.c 2005-10-12 17:17:51 +02:00
@@ -30,7 +30,7 @@
** master/autocommit code by Brian Aker <brian@stripped>
** SSL by
** Andrei Errapart <andreie@stripped>
-** Tõnu Samuel <tonu@stripped>
+** Tõnu Samuel <tonu@stripped>
** XML by Gary Huntress <ghuntress@stripped> 10/10/01, cleaned up
** and adapted to mysqldump 05/11/01 by Jani Tolonen
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
@@ -1172,25 +1172,23 @@
This function has logic to print the appropriate syntax depending on whether
this is a procedure or functions
- RETURN
- 0 Success
- 1 Error
+ RETURN 0 succes, 1 if error
*/
-static uint dump_routines_for_db(char *db)
+static uint dump_routines_for_db (char *db)
{
char query_buff[512];
- const char *routine_type[]= {"FUNCTION", "PROCEDURE"};
- char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3];
- char *routine_name;
+ const char *routine_type[]={"FUNCTION", "PROCEDURE"};
+ char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3], *routine_name;
int i;
- FILE *sql_file= md_result_file;
+ FILE *sql_file = md_result_file;
MYSQL_RES *routine_res, *routine_list_res;
MYSQL_ROW row, routine_list_row;
+
DBUG_ENTER("dump_routines_for_db");
- DBUG_PRINT("enter", ("db: '%s'", db));
mysql_real_escape_string(sock, db_name_buff, db, strlen(db));
+ DBUG_PRINT("enter", ("db: '%s'", db_name_buff));
/* nice comments */
if (opt_comments)
@@ -1203,10 +1201,10 @@
if (lock_tables)
mysql_query(sock, "LOCK TABLES mysql.proc READ");
- fprintf(sql_file, "DELIMITER ;;\n");
+ fprintf(sql_file, "DELIMITER //\n");
/* 0, retrieve and dump functions, 1, procedures */
- for (i= 0; i <= 1; i++)
+ for (i=0; i <= 1; i++)
{
my_snprintf(query_buff, sizeof(query_buff),
"SHOW %s STATUS WHERE Db = '%s'",
@@ -1218,18 +1216,18 @@
if (mysql_num_rows(routine_list_res))
{
- while ((routine_list_row= mysql_fetch_row(routine_list_res)))
+ while((routine_list_row= mysql_fetch_row(routine_list_res)))
{
DBUG_PRINT("info", ("retrieving CREATE %s for %s", routine_type[i],
name_buff));
- routine_name= quote_name(routine_list_row[1], name_buff, 0);
+ routine_name=quote_name(routine_list_row[1], name_buff, 0);
my_snprintf(query_buff, sizeof(query_buff), "SHOW CREATE %s %s",
routine_type[i], routine_name);
if (mysql_query_with_error_report(sock, &routine_res, query_buff))
DBUG_RETURN(1);
- while ((row= mysql_fetch_row(routine_res)))
+ while ((row=mysql_fetch_row(routine_res)))
{
/*
if the user has EXECUTE privilege he see routine names, but NOT the
@@ -1240,18 +1238,16 @@
if (strlen(row[2]))
{
if (opt_drop)
- fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;;\n",
+ fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */ //\n",
routine_type[i], routine_name);
/*
- we need to change sql_mode only for the CREATE
- PROCEDURE/FUNCTION otherwise we may need to re-quote routine_name
+ we need to change sql_mode only for the CREATE PROCEDURE/FUNCTION
+ otherwise we may need to re-quote routine_name
*/;
- fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\"*/;;\n",
+ fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\"*/ //\n",
row[1] /* sql_mode */);
- fprintf(sql_file, "/*!50003 %s */;;\n", row[2]);
- fprintf(sql_file,
- "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/"
- ";;\n");
+ fprintf(sql_file, "/*!50003 %s */ //\n", row[2]);
+ fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/ //\n");
}
} /* end of routine printing */
} /* end of list of routines */
@@ -1287,7 +1283,7 @@
{
MYSQL_RES *tableRes;
MYSQL_ROW row;
- my_bool init=0, delayed, write_data, complete_insert;
+ my_bool init=0;
uint num_fields;
char *result_table, *opt_quoted_table;
const char *insert_option;
@@ -1296,33 +1292,31 @@
char query_buff[512];
FILE *sql_file = md_result_file;
int len;
+
DBUG_ENTER("get_table_structure");
- DBUG_PRINT("enter", ("db: %s table: %s", db, table));
+ DBUG_PRINT("enter", ("db: %s, table: %s", db, table));
*ignore_flag= check_if_ignore_table(table, table_type);
- delayed= opt_delayed;
- if (delayed && (*ignore_flag & IGNORE_INSERT_DELAYED))
- {
- delayed= 0;
+ if (opt_delayed && (*ignore_flag & IGNORE_INSERT_DELAYED))
if (verbose)
fprintf(stderr,
- "-- Warning: Unable to use delayed inserts for table '%s' "
- "because it's of type %s\n", table, table_type);
- }
+ "-- Unable to use delayed inserts for table '%s' because it's of\
+ type %s\n", table, table_type);
- complete_insert= 0;
- if ((write_data= !(*ignore_flag & IGNORE_DATA)))
+ if (!(*ignore_flag & IGNORE_DATA))
{
- complete_insert= opt_complete_insert;
if (!insert_pat_inited)
insert_pat_inited= init_dynamic_string(&insert_pat, "", 1024, 1024);
else
dynstr_set(&insert_pat, "");
}
- insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
- delayed ? " DELAYED " : opt_ignore ? " IGNORE " : "");
+ insert_option= ((opt_delayed && opt_ignore &&
+ !(*ignore_flag & IGNORE_INSERT_DELAYED)) ?
+ " DELAYED IGNORE " :
+ opt_delayed && !(*ignore_flag & IGNORE_INSERT_DELAYED) ? " DELAYED " :
+ opt_ignore ? " IGNORE " : "");
if (verbose)
fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
@@ -1454,18 +1448,17 @@
}
/*
- If write_data is true, then we build up insert statements for
- the table's data. Note: in subsequent lines of code, this test
- will have to be performed each time we are appending to
- insert_pat.
+ if *ignore_flag & IGNORE_DATA is true, then we don't build up insert statements
+ for the table's data. Note: in subsequent lines of code, this test will
+ have to be performed each time we are appending to insert_pat.
*/
- if (write_data)
+ if (!(*ignore_flag & IGNORE_DATA))
{
dynstr_append_mem(&insert_pat, "INSERT ", 7);
dynstr_append(&insert_pat, insert_option);
dynstr_append_mem(&insert_pat, "INTO ", 5);
dynstr_append(&insert_pat, opt_quoted_table);
- if (complete_insert)
+ if (opt_complete_insert)
{
dynstr_append_mem(&insert_pat, " (", 2);
}
@@ -1479,16 +1472,15 @@
while ((row=mysql_fetch_row(tableRes)))
{
- if (complete_insert)
+ if (init)
{
- if (init)
- {
+ if (opt_complete_insert && !(*ignore_flag & IGNORE_DATA))
dynstr_append_mem(&insert_pat, ", ", 2);
- }
- init=1;
+ }
+ init=1;
+ if (opt_complete_insert && !(*ignore_flag & IGNORE_DATA))
dynstr_append(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
- }
}
num_fields= (uint) mysql_num_rows(tableRes);
mysql_free_result(tableRes);
@@ -1536,7 +1528,7 @@
check_io(sql_file);
}
- if (write_data)
+ if (!(*ignore_flag & IGNORE_DATA))
{
dynstr_append_mem(&insert_pat, "INSERT ", 7);
dynstr_append(&insert_pat, insert_option);
@@ -1562,11 +1554,11 @@
fputs(",\n",sql_file);
check_io(sql_file);
}
- if (complete_insert)
+ if (opt_complete_insert && !(*ignore_flag & IGNORE_DATA))
dynstr_append_mem(&insert_pat, ", ", 2);
}
init=1;
- if (opt_complete_insert)
+ if (opt_complete_insert && !(*ignore_flag & IGNORE_DATA))
dynstr_append(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
if (!tFlag)
@@ -1727,7 +1719,7 @@
check_io(sql_file);
}
}
- if (opt_complete_insert)
+ if (opt_complete_insert && !(*ignore_flag & IGNORE_DATA))
{
dynstr_append_mem(&insert_pat, ") VALUES ", 9);
if (!extended_insert)
@@ -1761,6 +1753,7 @@
char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
char query_buff[512];
FILE *sql_file = md_result_file;
+
DBUG_ENTER("dump_triggers_for_table");
DBUG_PRINT("enter", ("db: %s, table: %s", db, table));
result_table= quote_name(table, table_buff, 1);
@@ -1778,11 +1771,11 @@
}
if (mysql_num_rows(result))
fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n\
-DELIMITER ;;\n");
+DELIMITER //;\n");
while ((row=mysql_fetch_row(result)))
{
- fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n\
-/*!50003 CREATE TRIGGER %s %s %s ON %s FOR EACH ROW%s */;;\n\n",
+ fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\" */ //\n\
+/*!50003 CREATE TRIGGER %s %s %s ON %s FOR EACH ROW%s */ //\n\n",
row[6], /* sql_mode */
quote_name(row[0], name_buff, 0), /* Trigger */
row[4], /* Timing */
@@ -1792,8 +1785,8 @@
}
if (mysql_num_rows(result))
fprintf(sql_file,
- "DELIMITER ;\n"
- "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;\n");
+ "DELIMITER ;//\n\
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;");
mysql_free_result(result);
DBUG_VOID_RETURN;
}
@@ -1819,10 +1812,10 @@
/*
- Allow the user to specify field terminator strings like:
- "'", "\", "\\" (escaped backslash), "\t" (tab), "\n" (newline)
- This is done by doubling ' and add a end -\ if needed to avoid
- syntax errors from the SQL parser.
+** Allow the user to specify field terminator strings like:
+** "'", "\", "\\" (escaped backslash), "\t" (tab), "\n" (newline)
+** This is done by doubleing ' and add a end -\ if needed to avoid
+** syntax errors from the SQL parser.
*/
static char *field_escape(char *to,const char *from,uint length)
@@ -1881,7 +1874,7 @@
{
char ignore_flag;
char query_buf[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3];
- char table_type[NAME_LEN];
+ char table_type[NAME_LEN];
char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
char *query= query_buf;
int error= 0;
@@ -1896,7 +1889,7 @@
Make sure you get the create table info before the following check for
--no-data flag below. Otherwise, the create table info won't be printed.
*/
- num_fields= get_table_structure(table, db, table_type, &ignore_flag);
+ num_fields= get_table_structure(table, db, (char *)&table_type, &ignore_flag);
/* Check --no-data flag */
if (dFlag)
@@ -1908,9 +1901,7 @@
DBUG_VOID_RETURN;
}
- DBUG_PRINT("info",
- ("ignore_flag: %x num_fields: %d", (int) ignore_flag,
- num_fields));
+ DBUG_PRINT("info", ("ignore_flag %x num_fields %d", ignore_flag, num_fields));
/*
If the table type is a merge table or any type that has to be
_completely_ ignored and no data dumped
@@ -1919,7 +1910,7 @@
{
if (verbose)
fprintf(stderr,
- "-- Warning: Skipping data for table '%s' because it's of type %s\n",
+ "-- Skipping data for table '%s' because it's of type %s\n",
table, table_type);
DBUG_VOID_RETURN;
}
@@ -1936,6 +1927,7 @@
result_table= quote_name(table,table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0);
+
if (verbose)
fprintf(stderr, "-- Sending SELECT query...\n");
if (path)
@@ -2997,7 +2989,7 @@
DBUG_RETURN(result); /* assume table is ok */
}
if (!(row[1]))
- strmake(table_type, "VIEW", NAME_LEN-1);
+ strmake(table_type,"VIEW", NAME_LEN-1);
else
{
/*
--- 1.174/include/my_sys.h 2005-10-08 01:48:54 +02:00
+++ 1.175/include/my_sys.h 2005-10-12 17:17:52 +02:00
@@ -98,6 +98,7 @@
#define MY_RETURN_REAL_PATH 32 /* return full path for file */
#define MY_SAFE_PATH 64 /* Return NULL if too long path */
#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */
+#define MY_UNIX_PATH 256 /* convert path to UNIX format */
/* My seek flags */
#define MY_SEEK_SET 0
--- 1.103/include/mysql_com.h 2005-10-12 15:36:10 +02:00
+++ 1.104/include/mysql_com.h 2005-10-12 17:17:52 +02:00
@@ -411,7 +411,7 @@
const unsigned char *hash_stage2);
void get_salt_from_password(unsigned char *res, const char *password);
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
-char *octet2hex(char *to, const char *str, unsigned int len);
+void octet2hex(char *to, const unsigned char *str, unsigned int len);
/* end of password.c */
--- 1.21/storage/myisam/mi_rkey.c 2005-10-12 15:36:17 +02:00
+++ 1.22/storage/myisam/mi_rkey.c 2005-10-12 17:17:59 +02:00
@@ -31,8 +31,8 @@
HA_KEYSEG *last_used_keyseg;
uint pack_key_length, use_key_length, nextflag;
DBUG_ENTER("mi_rkey");
- DBUG_PRINT("enter", ("base: %lx buf: %lx inx: %d search_flag: %d",
- (long) info, (long) buf, inx, search_flag));
+ DBUG_PRINT("enter", ("base: %p buf: %p inx: %d search_flag: %d",
+ info, buf, inx, search_flag));
if ((inx = _mi_check_index(info,inx)) < 0)
DBUG_RETURN(my_errno);
--- 1.60/storage/myisam/mi_search.c 2005-10-12 15:36:17 +02:00
+++ 1.61/storage/myisam/mi_search.c 2005-10-12 17:17:59 +02:00
@@ -259,16 +259,15 @@
{
mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
- DBUG_PRINT("error",("Found wrong key: length: %u page: %lx end: %lx",
- length, (long) page, (long) end));
+ DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p",
+ length, page, end));
DBUG_RETURN(MI_FOUND_WRONG_KEY);
}
if ((flag=ha_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag,
¬_used)) >= 0)
break;
#ifdef EXTRA_DEBUG
- DBUG_PRINT("loop",("page: %lx key: '%s' flag: %d", (long) page, t_buff,
- flag));
+ DBUG_PRINT("loop",("page: %p key: '%s' flag: %d", page, t_buff, flag));
#endif
memcpy(buff,t_buff,length);
*ret_pos=page;
@@ -276,7 +275,7 @@
if (flag == 0)
memcpy(buff,t_buff,length); /* Result is first key */
*last_key= page == end;
- DBUG_PRINT("exit",("flag: %d ret_pos: %lx", flag, (long) *ret_pos));
+ DBUG_PRINT("exit",("flag: %d ret_pos: %p", flag, *ret_pos));
DBUG_RETURN(flag);
} /* _mi_seq_search */
@@ -416,8 +415,8 @@
{
mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
- DBUG_PRINT("error",("Found wrong key: length: %u page: %lx end: %lx",
- length, (long) page, (long) end));
+ DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p",
+ length, page, end));
DBUG_RETURN(MI_FOUND_WRONG_KEY);
}
@@ -551,7 +550,7 @@
*last_key= page == end;
- DBUG_PRINT("exit",("flag: %d ret_pos: %lx", flag, (long) *ret_pos));
+ DBUG_PRINT("exit",("flag: %d ret_pos: %p", flag, *ret_pos));
DBUG_RETURN(flag);
} /* _mi_prefix_search */
@@ -813,8 +812,8 @@
if (length > keyseg->length)
{
DBUG_PRINT("error",
- ("Found too long null packed key: %u of %u at %lx",
- length, keyseg->length, (long) *page_pos));
+ ("Found too long null packed key: %u of %u at %p",
+ length, keyseg->length, *page_pos));
DBUG_DUMP("key",(char*) *page_pos,16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
@@ -870,8 +869,8 @@
}
if (length > (uint) keyseg->length)
{
- DBUG_PRINT("error",("Found too long packed key: %u of %u at %lx",
- length, keyseg->length, (long) *page_pos));
+ DBUG_PRINT("error",("Found too long packed key: %u of %u at %p",
+ length, keyseg->length, *page_pos));
DBUG_DUMP("key",(char*) *page_pos,16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
@@ -936,8 +935,8 @@
{
if (length > keyinfo->maxlength)
{
- DBUG_PRINT("error",("Found too long binary packed key: %u of %u at %lx",
- length, keyinfo->maxlength, (long) *page_pos));
+ DBUG_PRINT("error",("Found too long binary packed key: %u of %u at %p",
+ length, keyinfo->maxlength, *page_pos));
DBUG_DUMP("key",(char*) *page_pos,16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
@@ -984,8 +983,8 @@
length-=tmp;
from=page; from_end=page_end;
}
- DBUG_PRINT("info",("key: %lx from: %lx length: %u",
- (long) key, (long) from, length));
+ DBUG_PRINT("info",("key: %p from: %p length: %u",
+ key, from, length));
memcpy_overlap((byte*) key, (byte*) from, (size_t) length);
key+=length;
from+=length;
@@ -1042,8 +1041,7 @@
}
}
}
- DBUG_PRINT("exit",("page: %lx length: %u", (long) page,
- *return_key_length));
+ DBUG_PRINT("exit",("page: %p length: %u", page, *return_key_length));
DBUG_RETURN(page);
} /* _mi_get_key */
@@ -1095,7 +1093,7 @@
uint nod_flag;
uchar *lastpos;
DBUG_ENTER("_mi_get_last_key");
- DBUG_PRINT("enter",("page: %lx endpos: %lx", (long) page, (long) endpos));
+ DBUG_PRINT("enter",("page: %p endpos: %p", page, endpos));
nod_flag=mi_test_if_nod(page);
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
@@ -1115,16 +1113,14 @@
*return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,lastkey);
if (*return_key_length == 0)
{
- DBUG_PRINT("error",("Couldn't find last key: page: %lx",
- (long) page));
+ DBUG_PRINT("error",("Couldn't find last key: page: %p", page));
mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0);
}
}
}
- DBUG_PRINT("exit",("lastpos: %lx length: %u", (long) lastpos,
- *return_key_length));
+ DBUG_PRINT("exit",("lastpos: %p length: %u", lastpos, *return_key_length));
DBUG_RETURN(lastpos);
} /* _mi_get_last_key */
@@ -1663,8 +1659,7 @@
ref_length=0;
next_length_pack=0;
}
- DBUG_PRINT("test",("length: %d next_key: %lx", length,
- (long) next_key));
+ DBUG_PRINT("test",("length: %d next_key: %p", length, next_key));
{
uint tmp_length;
--- 1.21/mysys/mf_format.c 2005-10-06 16:54:24 +02:00
+++ 1.22/mysys/mf_format.c 2005-10-12 17:17:53 +02:00
@@ -17,12 +17,13 @@
#include "mysys_priv.h"
#include <m_string.h>
-/*
- Formats a filename with possible replace of directory of extension
- Function can handle the case where 'to' == 'name'
- For a description of the flag values, consult my_sys.h
- The arguments should be in unix format.
-*/
+ /*
+ Formats a filename with possible replace of directory of extension
+ Function can handle the case where 'to' == 'name'
+ For a description of the flag values, consult my_sys.h
+ The arguments should be in unix format.
+ */
+
my_string fn_format(my_string to, const char *name, const char *dir,
const char *extension, uint flag)
@@ -53,7 +54,8 @@
pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
if (flag & MY_UNPACK_FILENAME)
(void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
-
+ if (flag & MY_UNIX_PATH)
+ to_unix_path(dev); /* Fix to MySQL representation */
if ((pos= (char*) strchr(name,FN_EXTCHAR)) != NullS)
{
if ((flag & MY_REPLACE_EXT) == 0) /* If we should keep old ext */
--- 1.55/mysys/mf_keycache.c 2005-10-11 23:58:17 +02:00
+++ 1.56/mysys/mf_keycache.c 2005-10-12 17:17:53 +02:00
@@ -2750,12 +2750,9 @@
gettimeofday(&now, &tz);
/* Prepare timeout value */
timeout.tv_sec= now.tv_sec + KEYCACHE_TIMEOUT;
- /*
- timeval uses microseconds.
- timespec uses nanoseconds.
- 1 nanosecond = 1000 micro seconds
- */
- timeout.tv_nsec= now.tv_usec * 1000;
+ timeout.tv_nsec= now.tv_usec * 1000; /* timeval uses microseconds. */
+ /* timespec uses nanoseconds. */
+ /* 1 nanosecond = 1000 micro seconds. */
KEYCACHE_THREAD_TRACE_END("started waiting");
#if defined(KEYCACHE_DEBUG)
cnt++;
@@ -2765,15 +2762,17 @@
#endif
rc= pthread_cond_timedwait(cond, mutex, &timeout);
KEYCACHE_THREAD_TRACE_BEGIN("finished waiting");
- if (rc == ETIMEDOUT || rc == ETIME)
- {
#if defined(KEYCACHE_DEBUG)
+ if (rc == ETIMEDOUT)
+ {
fprintf(keycache_debug_log,"aborted by keycache timeout\n");
fclose(keycache_debug_log);
abort();
+ }
#endif
+
+ if (rc == ETIMEDOUT)
keycache_dump();
- }
#if defined(KEYCACHE_DEBUG)
KEYCACHE_DBUG_ASSERT(rc != ETIMEDOUT);
--- 1.49/mysys/thr_lock.c 2005-10-11 23:58:17 +02:00
+++ 1.50/mysys/thr_lock.c 2005-10-12 17:17:53 +02:00
@@ -408,10 +408,9 @@
set_timespec(wait_timeout, table_lock_wait_timeout);
while (!thread_var->abort || in_wait_list)
{
- int rc= (can_deadlock ?
- pthread_cond_timedwait(cond, &data->lock->mutex,
- &wait_timeout) :
- pthread_cond_wait(cond, &data->lock->mutex));
+ int rc= can_deadlock ? pthread_cond_timedwait(cond, &data->lock->mutex,
+ &wait_timeout) :
+ pthread_cond_wait(cond, &data->lock->mutex);
/*
We must break the wait if one of the following occurs:
- the connection has been aborted (!thread_var->abort), but
@@ -427,7 +426,7 @@
*/
if (data->cond == 0)
break;
- if (rc == ETIMEDOUT || rc == ETIME)
+ if (rc == ETIMEDOUT)
{
result= THR_LOCK_WAIT_TIMEOUT;
break;
--- 1.27/mysys/thr_mutex.c 2005-10-11 23:58:17 +02:00
+++ 1.28/mysys/thr_mutex.c 2005-10-12 17:17:53 +02:00
@@ -239,7 +239,7 @@
pthread_mutex_unlock(&mp->global);
error=pthread_cond_timedwait(cond,&mp->mutex,abstime);
#ifdef EXTRA_DEBUG
- if (error && (error != EINTR && error != ETIMEDOUT && error != ETIME))
+ if (error && (error != EINTR && error != ETIMEDOUT))
{
fprintf(stderr,"safe_mutex: Got error: %d (%d) when doing a safe_mutex_timedwait at %s, line %d\n", error, errno, file, line);
}
--- 1.16/cmd-line-utils/readline/complete.c 2005-10-11 13:52:20 +02:00
+++ 1.17/cmd-line-utils/readline/complete.c 2005-10-12 17:17:52 +02:00
@@ -21,7 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
-#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__)
+#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 500
#endif
--- 1.96/scripts/make_binary_distribution.sh 2005-10-10 17:12:23 +02:00
+++ 1.97/scripts/make_binary_distribution.sh 2005-10-12 17:17:54 +02:00
@@ -226,7 +226,6 @@
$CP mysql-test/lib/*.pl $BASE/mysql-test/lib
$CP mysql-test/lib/*.sql $BASE/mysql-test/lib
-$CP mysql-test/t/*.def $BASE/mysql-test/t
$CP mysql-test/include/*.inc $BASE/mysql-test/include
$CP mysql-test/t/*.def $BASE/mysql-test/t
$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
--- 1.188/sql/handler.cc 2005-10-12 15:36:11 +02:00
+++ 1.189/sql/handler.cc 2005-10-12 17:17:54 +02:00
@@ -186,18 +186,15 @@
THD *thd= current_thd;
show_table_alias_st *table_alias;
handlerton **types;
+ const char *ptr= name;
- if (thd && !my_strnncoll(&my_charset_latin1,
- (const uchar *)name, namelen,
- (const uchar *)"DEFAULT", 7))
+ if (thd && !my_strcasecmp(&my_charset_latin1, ptr, "DEFAULT"))
return (enum db_type) thd->variables.table_type;
retest:
for (types= sys_table_types; *types; types++)
{
- if (!my_strnncoll(&my_charset_latin1,
- (const uchar *)name, namelen,
- (const uchar *)(*types)->name, strlen((*types)->name)))
+ if (!my_strcasecmp(&my_charset_latin1, ptr, (*types)->name))
return (enum db_type) (*types)->db_type;
}
@@ -206,20 +203,15 @@
*/
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
- if (!my_strnncoll(&my_charset_latin1,
- (const uchar *)name, namelen,
- (const uchar *)table_alias->alias, strlen(table_alias->alias)))
+ if (!my_strcasecmp(&my_charset_latin1, ptr, table_alias->alias))
{
- name= table_alias->type;
- namelen= strlen(name);
+ ptr= table_alias->type;
goto retest;
}
}
return DB_TYPE_UNKNOWN;
}
-
-
const char *ha_get_storage_engine(enum db_type db_type)
{
handlerton **types;
@@ -228,9 +220,9 @@
if (db_type == (*types)->db_type)
return (*types)->name;
}
- return "*NONE*";
-}
+ return "none";
+}
bool ha_check_storage_engine_flag(enum db_type db_type, uint32 flag)
{
@@ -238,9 +230,15 @@
for (types= sys_table_types; *types; types++)
{
if (db_type == (*types)->db_type)
- return test((*types)->flags & flag);
+ {
+ if ((*types)->flags & flag)
+ return TRUE;
+ else
+ return FALSE;
+ }
}
- return FALSE; // No matching engine
+
+ return FALSE;
}
@@ -914,24 +912,17 @@
DBUG_RETURN(error);
}
-
int ha_commit_or_rollback_by_xid(XID *xid, bool commit)
{
handlerton **types;
int res= 1;
for (types= sys_table_types; *types; types++)
- {
if ((*types)->state == SHOW_OPTION_YES && (*types)->recover)
- {
- if ((*(commit ? (*types)->commit_by_xid :
- (*types)->rollback_by_xid))(xid));
- res= 0;
- }
- }
+ res= res &&
+ (*(commit ? (*types)->commit_by_xid : (*types)->rollback_by_xid))(xid);
return res;
}
-
#ifndef DBUG_OFF
/* this does not need to be multi-byte safe or anything */
--- 1.161/sql/handler.h 2005-10-12 15:36:11 +02:00
+++ 1.162/sql/handler.h 2005-10-12 17:17:54 +02:00
@@ -664,7 +664,6 @@
uint options; /* OR of HA_CREATE_ options */
uint raid_type,raid_chunks;
uint merge_insert_method;
- uint extra_size; /* length of extra data segment */
bool table_existed; /* 1 in create if table existed */
bool frm_only; /* 1 if no ha_create_table() */
bool varchar; /* 1 if table has a VARCHAR */
--- 1.151/sql/item.cc 2005-10-12 15:36:11 +02:00
+++ 1.152/sql/item.cc 2005-10-12 17:17:54 +02:00
@@ -817,12 +817,9 @@
{
DBUG_ASSERT(fixed);
Item *it= this_item();
- String *res= it->val_str(sp);
+ String *ret= it->val_str(sp);
null_value= it->null_value;
- if (!res)
- return NULL;
-
/*
This way we mark returned value of val_str as const,
so that various functions (e.g. CONCAT) won't try to
@@ -839,11 +836,12 @@
Item_param class contain some more details on the topic.
*/
- if (res != &str_value)
- str_value.set(res->ptr(), res->length(), res->charset());
- else
- res->mark_as_const();
- return &str_value;
+ if (!ret)
+ return NULL;
+
+ str_value_ptr.set(ret->ptr(), ret->length(),
+ ret->charset());
+ return &str_value_ptr;
}
@@ -860,13 +858,17 @@
bool Item_splocal::is_null()
{
Item *it= this_item();
- return it->is_null();
+ bool ret= it->is_null();
+ null_value= it->null_value;
+ return ret;
}
Item *
Item_splocal::this_item()
{
+ THD *thd= current_thd;
+
return thd->spcont->get_item(m_offset);
}
@@ -880,23 +882,25 @@
Item *
Item_splocal::this_const_item() const
{
+ THD *thd= current_thd;
+
return thd->spcont->get_item(m_offset);
}
Item::Type
Item_splocal::type() const
{
- if (thd && thd->spcont)
+ THD *thd= current_thd;
+
+ if (thd->spcont)
return thd->spcont->get_item(m_offset)->type();
return NULL_ITEM; // Anything but SUBSELECT_ITEM
}
-bool Item_splocal::fix_fields(THD *thd_arg, Item **ref)
+bool Item_splocal::fix_fields(THD *, Item **)
{
- Item *it;
- thd= thd_arg; // Must be set before this_item()
- it= this_item();
+ Item *it= this_item();
DBUG_ASSERT(it->fixed);
max_length= it->max_length;
decimals= it->decimals;
@@ -924,7 +928,6 @@
/*****************************************************************************
Item_name_const methods
*****************************************************************************/
-
double Item_name_const::val_real()
{
DBUG_ASSERT(fixed);
@@ -963,7 +966,9 @@
bool Item_name_const::is_null()
{
- return value_item->is_null();
+ bool ret= value_item->is_null();
+ null_value= value_item->null_value;
+ return ret;
}
Item::Type Item_name_const::type() const
@@ -972,7 +977,7 @@
}
-bool Item_name_const::fix_fields(THD *thd, Item **ref)
+bool Item_name_const::fix_fields(THD *thd, Item **)
{
char buf[128];
String *item_name;
@@ -2778,7 +2783,7 @@
*/
/* ARGSUSED */
-bool Item::fix_fields(THD *thd, Item **ref)
+bool Item::fix_fields(THD *thd, Item ** ref)
{
// We do not check fields which are fixed during construction
@@ -4765,7 +4770,8 @@
bool Item_ref::is_null()
{
DBUG_ASSERT(fixed);
- return (*ref)->is_null();
+ (void) (*ref)->val_int_result();
+ return (*ref)->null_value;
}
@@ -5235,21 +5241,32 @@
}
case ROW_RESULT:
{
- Item_row *item_row= (Item_row*) item;
- Item_row *comp_item_row= (Item_row*) comp_item;
- uint col;
new_item= 0;
/*
If item and comp_item are both Item_rows and have same number of cols
- then process items in Item_row one by one.
- We can't ignore NULL values here as this item may be used with <=>, in
- which case NULL's are significant.
+ then process items in Item_row one by one. If Item_row contain nulls
+ substitute it by Item_null. Otherwise just return.
*/
- DBUG_ASSERT(item->result_type() == comp_item->result_type());
- DBUG_ASSERT(item_row->cols() == comp_item_row->cols());
- col= item_row->cols();
- while (col-- > 0)
- resolve_const_item(thd, item_row->addr(col), comp_item_row->el(col));
+ if (item->result_type() == comp_item->result_type() &&
+ ((Item_row*)item)->cols() == ((Item_row*)comp_item)->cols())
+ {
+ Item_row *item_row= (Item_row*)item,*comp_item_row= (Item_row*)comp_item;
+ if (item_row->null_inside())
+ new_item= (Item*) new Item_null(name);
+ else
+ {
+ int i= item_row->cols() - 1;
+ for (; i >= 0; i--)
+ {
+ if (item_row->maybe_null && item_row->el(i)->is_null())
+ {
+ new_item= (Item*) new Item_null(name);
+ break;
+ }
+ resolve_const_item(thd, item_row->addr(i), comp_item_row->el(i));
+ }
+ }
+ }
break;
}
case REAL_RESULT:
@@ -5704,8 +5721,6 @@
bool Item_type_holder::join_types(THD *thd, Item *item)
{
- uint max_length_orig= max_length;
- uint decimals_orig= decimals;
DBUG_ENTER("Item_type_holder::join_types");
DBUG_PRINT("info:", ("was type %d len %d, dec %d name %s",
fld_type, max_length, decimals,
@@ -5732,10 +5747,7 @@
}
else
max_length= max(max_length, display_length(item));
-
- switch (Field::result_merge_type(fld_type))
- {
- case STRING_RESULT:
+ if (Field::result_merge_type(fld_type) == STRING_RESULT)
{
const char *old_cs, *old_derivation;
old_cs= collation.collation->name;
@@ -5749,23 +5761,7 @@
"UNION");
DBUG_RETURN(TRUE);
}
- break;
- }
- case REAL_RESULT:
- {
- if (decimals != NOT_FIXED_DEC)
- {
- int delta1= max_length_orig - decimals_orig;
- int delta2= item->max_length - item->decimals;
- max_length= min(max(delta1, delta2) + decimals,
- (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7);
- }
- else
- max_length= (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7;
- break;
}
- default:;
- };
maybe_null|= item->maybe_null;
get_full_info(item);
--- 1.173/sql/item.h 2005-10-11 23:58:18 +02:00
+++ 1.174/sql/item.h 2005-10-12 17:17:54 +02:00
@@ -721,7 +721,13 @@
public:
LEX_STRING m_name;
- THD *thd;
+
+ /*
+ Buffer, pointing to the string value of the item. We need it to
+ protect internal buffer from changes. See comment to analogous
+ member in Item_param for more details.
+ */
+ String str_value_ptr;
/*
Position of this reference to SP variable in the statement (the
@@ -733,10 +739,10 @@
Value of 0 means that this object doesn't corresponding to reference to
SP variable in query text.
*/
- uint pos_in_query;
+ int pos_in_query;
- Item_splocal(LEX_STRING name, uint offset, uint pos_in_q=0)
- : m_offset(offset), m_name(name), thd(0), pos_in_query(pos_in_q)
+ Item_splocal(LEX_STRING name, uint offset, int pos_in_q=0)
+ : m_offset(offset), m_name(name), pos_in_query(pos_in_q)
{
maybe_null= TRUE;
}
@@ -1616,7 +1622,7 @@
}
Item *real_item()
{
- return ref ? (*ref)->real_item() : this;
+ return (ref && *ref) ? (*ref)->real_item() : this;
}
bool walk(Item_processor processor, byte *arg)
{ return (*ref)->walk(processor, arg); }
--- 1.258/sql/item_func.cc 2005-10-11 23:58:18 +02:00
+++ 1.259/sql/item_func.cc 2005-10-12 17:17:54 +02:00
@@ -32,11 +32,6 @@
#include "sp_rcontext.h"
#include "sp.h"
-#ifdef NO_EMBEDDED_ACCESS_CHECKS
-#define sp_restore_security_context(A,B) while (0) {}
-#endif
-
-
bool check_reserved_words(LEX_STRING *name)
{
if (!my_strcasecmp(system_charset_info, name->str, "GLOBAL") ||
@@ -2020,6 +2015,7 @@
{
String *res;
LINT_INIT(res);
+ null_value= 0;
for (uint i=0; i < arg_count ; i++)
{
if (i == 0)
@@ -2034,11 +2030,14 @@
if ((cmp_sign < 0 ? cmp : -cmp) < 0)
res=res2;
}
+ else
+ res= 0;
}
if ((null_value= args[i]->null_value))
- return 0;
+ break;
}
- res->set_charset(collation.collation);
+ if (res) // If !NULL
+ res->set_charset(collation.collation);
return res;
}
case ROW_RESULT:
@@ -2055,6 +2054,7 @@
{
DBUG_ASSERT(fixed == 1);
double value=0.0;
+ null_value= 0;
for (uint i=0; i < arg_count ; i++)
{
if (i == 0)
@@ -2076,6 +2076,7 @@
{
DBUG_ASSERT(fixed == 1);
longlong value=0;
+ null_value= 0;
for (uint i=0; i < arg_count ; i++)
{
if (i == 0)
@@ -2096,21 +2097,21 @@
my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
{
DBUG_ASSERT(fixed == 1);
- my_decimal tmp_buf, *tmp, *res;
- LINT_INIT(res);
-
+ my_decimal tmp_buf, *tmp, *res= NULL;
+ null_value= 0;
for (uint i=0; i < arg_count ; i++)
{
if (i == 0)
res= args[i]->val_decimal(dec);
else
{
- tmp= args[i]->val_decimal(&tmp_buf); // Zero if NULL
- if (tmp && (my_decimal_cmp(tmp, res) * cmp_sign) < 0)
+ tmp= args[i]->val_decimal(&tmp_buf);
+ if (args[i]->null_value)
+ res= 0;
+ else if ((my_decimal_cmp(tmp, res) * cmp_sign) < 0)
{
if (tmp == &tmp_buf)
{
- /* Move value out of tmp_buf as this will be reused on next loop */
my_decimal2decimal(tmp, dec);
res= dec;
}
@@ -2119,10 +2120,7 @@
}
}
if ((null_value= args[i]->null_value))
- {
- res= 0;
break;
- }
}
return res;
}
@@ -3033,13 +3031,9 @@
thd->mysys_var->current_cond= &ull->cond;
set_timespec(abstime,lock_timeout);
- while (ull->locked && !thd->killed)
- {
- int error= pthread_cond_timedwait(&ull->cond, &LOCK_user_locks, &abstime);
- if (error == ETIMEDOUT || error == ETIME)
- break;
- }
-
+ while (!thd->killed &&
+ pthread_cond_timedwait(&ull->cond, &LOCK_user_locks,
+ &abstime) != ETIMEDOUT && ull->locked) ;
if (ull->locked)
{
if (!--ull->count)
@@ -3083,7 +3077,7 @@
struct timespec abstime;
THD *thd=current_thd;
User_level_lock *ull;
- int error;
+ int error=0;
/*
In slave thread no need to get locks, everything is serialized. Anyway
@@ -3139,29 +3133,22 @@
thd->mysys_var->current_cond= &ull->cond;
set_timespec(abstime,timeout);
- error= 0;
- while (ull->locked && !thd->killed)
- {
- error= pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime);
- if (error == ETIMEDOUT || error == ETIME)
- break;
- error= 0;
- }
-
+ while (!thd->killed &&
+ (error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime))
+ != ETIMEDOUT && error != EINVAL && ull->locked) ;
+ if (thd->killed)
+ error=EINTR; // Return NULL
if (ull->locked)
{
if (!--ull->count)
- {
- DBUG_ASSERT(0);
delete ull; // Should never happen
- }
- if (!error) // Killed (thd->killed != 0)
+ if (error != ETIMEDOUT)
{
error=1;
null_value=1; // Return NULL
}
}
- else // We got the lock
+ else
{
ull->locked=1;
ull->thread=thd->real_id;
@@ -3283,7 +3270,6 @@
str->append(')');
}
-
/* This function is just used to create tests with time gaps */
longlong Item_func_sleep::val_int()
@@ -3304,14 +3290,10 @@
thd->mysys_var->current_mutex= &LOCK_user_locks;
thd->mysys_var->current_cond= &cond;
- error= 0;
- while (!thd->killed)
- {
- error= pthread_cond_timedwait(&cond, &LOCK_user_locks, &abstime);
- if (error == ETIMEDOUT || error == ETIME)
- break;
- error= 0;
- }
+ while (!thd->killed &&
+ (error= pthread_cond_timedwait(&cond, &LOCK_user_locks,
+ &abstime)) != ETIMEDOUT &&
+ error != EINVAL) ;
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
@@ -3321,7 +3303,7 @@
pthread_mutex_unlock(&LOCK_user_locks);
pthread_cond_destroy(&cond);
- return test(!error); // Return 1 killed
+ return (error == ETIMEDOUT) ? 0 : 1;
}
@@ -4750,7 +4732,10 @@
ER_FAILED_ROUTINE_BREAK_BINLOG,
ER(ER_FAILED_ROUTINE_BREAK_BINLOG));
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, save_ctx);
+#endif
+
error:
DBUG_RETURN(res);
}
@@ -4864,12 +4849,11 @@
find_and_check_access()
thd thread handler
want_access requested access
- save backup of security context
+ backup backup of security context or 0
RETURN
FALSE Access granted
TRUE Requested access can't be granted or function doesn't exists
- In this case security context is not changed and *save = 0
NOTES
Checks if requested access to function can be granted to user.
@@ -4884,11 +4868,12 @@
bool
Item_func_sp::find_and_check_access(THD *thd, ulong want_access,
- Security_context **save)
+ Security_context **backup)
{
- bool res= TRUE;
-
- *save= 0; // Safety if error
+ bool res;
+ Security_context *local_save,
+ **save= (backup ? backup : &local_save);
+ res= TRUE;
if (! m_sp && ! (m_sp= sp_find_function(thd, m_name, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
@@ -4898,31 +4883,26 @@
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_routine_access(thd, want_access,
m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
+ {
goto error;
+ }
sp_change_security_context(thd, m_sp, save);
- /*
- If we changed context to run as another user, we need to check the
- access right for the new context again as someone may have deleted
- this person the right to use the procedure
-
- TODO:
- Cache if the definer has the right to use the object on the first
- usage and only reset the cache if someone does a GRANT statement
- that 'may' affect this.
- */
if (*save &&
check_routine_access(thd, want_access,
m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
{
- sp_restore_security_context(thd, *save);
- *save= 0; // Safety
- goto error;
+ goto error_check_ctx;
}
-#endif
- res= FALSE; // no error
-
+ res= FALSE;
+error_check_ctx:
+ if (*save && (res || !backup))
+ sp_restore_security_context(thd, local_save);
error:
+#else
+ res= 0;
+error:
+#endif
return res;
}
@@ -4932,11 +4912,7 @@
bool res;
DBUG_ASSERT(fixed == 0);
res= Item_func::fix_fields(thd, ref);
- if (!res)
- {
- Security_context *save_ctx;
- if (!(res= find_and_check_access(thd, EXECUTE_ACL, &save_ctx)))
- sp_restore_security_context(thd, save_ctx);
- }
+ if (!res && find_and_check_access(thd, EXECUTE_ACL, NULL))
+ res= 1;
return res;
}
--- 1.257/sql/item_strfunc.cc 2005-10-11 23:58:18 +02:00
+++ 1.258/sql/item_strfunc.cc 2005-10-12 17:17:54 +02:00
@@ -1964,16 +1964,21 @@
int32 num=(int32) args[i]->val_int();
if (!args[i]->null_value)
{
- if (num&0xFF000000L) {
- str->append((char)(num>>24));
- goto b2;
- } else if (num&0xFF0000L) {
- b2: str->append((char)(num>>16));
- goto b1;
- } else if (num&0xFF00L) {
- b1: str->append((char)(num>>8));
+#ifdef USE_MB
+ if (use_mb(collation.collation))
+ {
+ if (num&0xFF000000L) {
+ str->append((char)(num>>24));
+ goto b2;
+ } else if (num&0xFF0000L) {
+b2: str->append((char)(num>>16));
+ goto b1;
+ } else if (num&0xFF00L) {
+b1: str->append((char)(num>>8));
+ }
}
- str->append((char) num);
+#endif
+ str->append((char)num);
}
}
str->set_charset(collation.collation);
@@ -1992,7 +1997,7 @@
enum MYSQL_ERROR::enum_warning_level level;
uint diff= str->length() - wlen;
set_if_smaller(diff, 3);
- octet2hex(hexbuf, str->ptr() + wlen, diff);
+ octet2hex(hexbuf, (const uchar*) str->ptr() + wlen, diff);
if (thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))
{
@@ -2431,7 +2436,6 @@
String *Item_func_hex::val_str(String *str)
{
- String *res;
DBUG_ASSERT(fixed == 1);
if (args[0]->result_type() != STRING_RESULT)
{
@@ -2460,16 +2464,24 @@
}
/* Convert given string to a hex string, character by character */
- res= args[0]->val_str(str);
- if (!res || tmp_value.alloc(res->length()*2+1))
+ String *res= args[0]->val_str(str);
+ const char *from, *end;
+ char *to;
+ if (!res || tmp_value.alloc(res->length()*2))
{
null_value=1;
return 0;
}
null_value=0;
tmp_value.length(res->length()*2);
-
- octet2hex((char*) tmp_value.ptr(), res->ptr(), res->length());
+ for (from=res->ptr(), end=from+res->length(), to= (char*) tmp_value.ptr();
+ from < end ;
+ from++, to+=2)
+ {
+ uint tmp=(uint) (uchar) *from;
+ to[0]=_dig_vec_upper[tmp >> 4];
+ to[1]=_dig_vec_upper[tmp & 15];
+ }
return &tmp_value;
}
--- 1.97/sql/item_strfunc.h 2005-10-11 23:58:18 +02:00
+++ 1.98/sql/item_strfunc.h 2005-10-12 17:17:54 +02:00
@@ -484,7 +484,7 @@
String *val_str(String *);
void fix_length_and_dec()
{
- collation.set(&my_charset_bin);
+ collation.set(default_charset());
maybe_null=0; max_length=arg_count;
}
const char *func_name() const { return "char"; }
--- 1.189/sql/log_event.cc 2005-10-12 15:36:12 +02:00
+++ 1.190/sql/log_event.cc 2005-10-12 17:17:54 +02:00
@@ -122,9 +122,8 @@
static inline char* slave_load_file_stem(char*buf, uint file_id,
int event_server_id)
{
- fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "", MY_UNPACK_FILENAME);
- to_unix_path(buf);
-
+ fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "",
+ MY_UNPACK_FILENAME | MY_UNIX_PATH);
buf = strend(buf);
buf = int10_to_str(::server_id, buf, 10);
*buf++ = '-';
@@ -213,18 +212,24 @@
/*
Transforms a string into "" or its expression in 0x... form.
*/
-
char *str_to_hex(char *to, const char *from, uint len)
{
+ char *p= to;
if (len)
{
- *to++= '0';
- *to++= 'x';
- to= octet2hex(to, from, len);
+ p= strmov(p, "0x");
+ for (uint i= 0; i < len; i++, p+= 2)
+ {
+ /* val[i] is char. Casting to uchar helps greatly if val[i] < 0 */
+ uint tmp= (uint) (uchar) from[i];
+ p[0]= _dig_vec_upper[tmp >> 4];
+ p[1]= _dig_vec_upper[tmp & 15];
+ }
+ *p= 0;
}
else
- to= strmov(to, "\"\"");
- return to; // pointer to end 0 of 'to'
+ p= strmov(p, "\"\"");
+ return p; // pointer to end 0 of 'to'
}
/*
--- 1.484/sql/mysqld.cc 2005-10-12 15:36:12 +02:00
+++ 1.485/sql/mysqld.cc 2005-10-12 17:17:54 +02:00
@@ -585,20 +585,6 @@
#include "sslopt-vars.h"
#ifdef HAVE_OPENSSL
-#include <openssl/crypto.h>
-#ifndef HAVE_YASSL
-typedef struct CRYPTO_dynlock_value
-{
- rw_lock_t lock;
-} openssl_lock_t;
-
-static openssl_lock_t *openssl_stdlocks;
-static openssl_lock_t *openssl_dynlock_create(const char *, int);
-static void openssl_dynlock_destroy(openssl_lock_t *, const char *, int);
-static void openssl_lock_function(int, int, const char *, int);
-static void openssl_lock(int, openssl_lock_t *, const char *, int);
-static unsigned long openssl_id_function();
-#endif
char *des_key_file;
struct st_VioSSLAcceptorFd *ssl_acceptor_fd;
#endif /* HAVE_OPENSSL */
@@ -1187,11 +1173,6 @@
(void) pthread_mutex_destroy(&LOCK_user_conn);
#ifdef HAVE_OPENSSL
(void) pthread_mutex_destroy(&LOCK_des_key_file);
-#ifndef HAVE_YASSL
- for (int i= 0; i < CRYPTO_num_locks(); ++i)
- (void) rwlock_destroy(&openssl_stdlocks[i].lock);
- OPENSSL_free(openssl_stdlocks);
-#endif
#endif
#ifdef HAVE_REPLICATION
(void) pthread_mutex_destroy(&LOCK_rpl_status);
@@ -2748,17 +2729,6 @@
(void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST);
#ifdef HAVE_OPENSSL
(void) pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
-#ifndef HAVE_YASSL
- openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() *
- sizeof(openssl_lock_t));
- for (int i= 0; i < CRYPTO_num_locks(); ++i)
- (void) my_rwlock_init(&openssl_stdlocks[i].lock, NULL);
- CRYPTO_set_dynlock_create_callback(openssl_dynlock_create);
- CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy);
- CRYPTO_set_dynlock_lock_callback(openssl_lock);
- CRYPTO_set_locking_callback(openssl_lock_function);
- CRYPTO_set_id_callback(openssl_id_function);
-#endif
#endif
(void) my_rwlock_init(&LOCK_sys_init_connect, NULL);
(void) my_rwlock_init(&LOCK_sys_init_slave, NULL);
@@ -2789,75 +2759,6 @@
}
return 0;
}
-
-
-#if defined(HAVE_OPENSSL) && !defined(HAVE_YASSL)
-static unsigned long openssl_id_function()
-{
- return (unsigned long) pthread_self();
-}
-
-
-static openssl_lock_t *openssl_dynlock_create(const char *file, int line)
-{
- openssl_lock_t *lock= new openssl_lock_t;
- my_rwlock_init(&lock->lock, NULL);
- return lock;
-}
-
-
-static void openssl_dynlock_destroy(openssl_lock_t *lock, const char *file,
- int line)
-{
- rwlock_destroy(&lock->lock);
- delete lock;
-}
-
-
-static void openssl_lock_function(int mode, int n, const char *file, int line)
-{
- if (n < 0 || n > CRYPTO_num_locks())
- {
- /* Lock number out of bounds. */
- sql_print_error("Fatal: OpenSSL interface problem (n = %d)", n);
- abort();
- }
- openssl_lock(mode, &openssl_stdlocks[n], file, line);
-}
-
-
-static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
- int line)
-{
- int err;
- char const *what;
-
- switch (mode) {
- case CRYPTO_LOCK|CRYPTO_READ:
- what = "read lock";
- err = rw_rdlock(&lock->lock);
- break;
- case CRYPTO_LOCK|CRYPTO_WRITE:
- what = "write lock";
- err = rw_wrlock(&lock->lock);
- break;
- case CRYPTO_UNLOCK|CRYPTO_READ:
- case CRYPTO_UNLOCK|CRYPTO_WRITE:
- what = "unlock";
- err = rw_unlock(&lock->lock);
- break;
- default:
- /* Unknown locking mode. */
- sql_print_error("Fatal: OpenSSL interface problem (mode=0x%x)", mode);
- abort();
- }
- if (err)
- {
- sql_print_error("Fatal: can't %s OpenSSL %s lock", what);
- abort();
- }
-}
-#endif /* HAVE_OPENSSL */
static void init_ssl()
--- 1.181/sql/opt_range.cc 2005-10-12 15:36:13 +02:00
+++ 1.182/sql/opt_range.cc 2005-10-12 17:17:54 +02:00
@@ -7045,15 +7045,19 @@
*/
if (thd->query_id == cur_field->query_id)
{
+ bool is_covered= FALSE;
KEY_PART_INFO *key_part= cur_index_info->key_part;
KEY_PART_INFO *key_part_end= key_part + cur_index_info->key_parts;
- for (;;)
+ for (; key_part != key_part_end ; key_part++)
{
if (key_part->field == cur_field)
+ {
+ is_covered= TRUE;
break;
- if (++key_part == key_part_end)
- goto next_index; // Field was not part of key
+ }
}
+ if (!is_covered)
+ goto next_index;
}
}
}
--- 1.38/sql/password.c 2005-10-11 23:58:18 +02:00
+++ 1.39/sql/password.c 2005-10-12 17:17:54 +02:00
@@ -316,21 +316,18 @@
octet2hex()
buf OUT output buffer. Must be at least 2*len+1 bytes
str, len IN the beginning and the length of the input string
-
- RETURN
- buf+len*2
*/
-char *octet2hex(char *to, const char *str, uint len)
+void
+octet2hex(char *to, const unsigned char *str, uint len)
{
- const byte *str_end= str + len;
+ const uint8 *str_end= str + len;
for (; str != str_end; ++str)
{
- *to++= _dig_vec_upper[((uchar) *str) >> 4];
- *to++= _dig_vec_upper[((uchar) *str) & 0x0F];
+ *to++= _dig_vec_upper[(*str & 0xF0) >> 4];
+ *to++= _dig_vec_upper[*str & 0x0F];
}
*to= '\0';
- return to;
}
--- 1.256/sql/slave.cc 2005-10-12 15:36:13 +02:00
+++ 1.257/sql/slave.cc 2005-10-12 17:17:54 +02:00
@@ -2371,7 +2371,7 @@
else
pthread_cond_wait(&data_cond, &data_lock);
DBUG_PRINT("info",("Got signal of master update or timed out"));
- if (error == ETIMEDOUT || error == ETIME)
+ if (error == ETIMEDOUT)
{
error= -1;
break;
--- 1.277/sql/sql_base.cc 2005-10-12 15:36:14 +02:00
+++ 1.278/sql/sql_base.cc 2005-10-12 17:17:54 +02:00
@@ -2789,6 +2789,7 @@
Natural_join_column *nj_col;
Field *found_field;
Query_arena *arena, backup;
+
DBUG_ENTER("find_field_in_natural_join");
DBUG_PRINT("enter", ("field name: '%s', ref 0x%lx",
name, (ulong) ref));
@@ -2813,7 +2814,6 @@
if (nj_col->view_field)
{
- Item *item;
/*
The found field is a view field, we do as in find_field_in_view()
and return a pointer to pointer to the Item of that field.
@@ -2821,7 +2821,7 @@
if (register_tree_change)
arena= thd->activate_stmt_arena_if_needed(&backup);
- item= nj_col->create_item(thd);
+ Item *item= nj_col->create_item(thd);
if (register_tree_change && arena)
thd->restore_active_arena(arena, &backup);
--- 1.215/sql/sql_class.cc 2005-10-08 01:48:57 +02:00
+++ 1.216/sql/sql_class.cc 2005-10-12 17:17:54 +02:00
@@ -1703,19 +1703,15 @@
int Statement_map::insert(Statement *statement)
{
- int res= my_hash_insert(&st_hash, (byte *) statement);
- if (res)
- return res;
+ int rc= my_hash_insert(&st_hash, (byte *) statement);
if (statement->name.str)
{
- if ((res= my_hash_insert(&names_hash, (byte*)statement)))
- {
+ if ((rc= my_hash_insert(&names_hash, (byte*)statement)))
hash_delete(&st_hash, (byte*)statement);
- return res;
- }
}
- last_found_statement= statement;
- return res;
+ if (rc == 0)
+ last_found_statement= statement;
+ return rc;
}
--- 1.173/sql/sql_insert.cc 2005-10-12 15:36:14 +02:00
+++ 1.174/sql/sql_insert.cc 2005-10-12 17:17:54 +02:00
@@ -1822,7 +1822,7 @@
#endif
if (thd->killed || di->status)
break;
- if (error == ETIMEDOUT || error == ETIME)
+ if (error == ETIMEDOUT)
{
thd->killed= THD::KILL_CONNECTION;
break;
--- 1.478/sql/sql_parse.cc 2005-10-12 15:36:15 +02:00
+++ 1.479/sql/sql_parse.cc 2005-10-12 17:17:55 +02:00
@@ -2319,6 +2319,8 @@
LEX *lex= thd->lex;
/* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
SELECT_LEX *select_lex= &lex->select_lex;
+ bool slave_fake_lock= 0;
+ MYSQL_LOCK *fake_prev_lock= 0;
/* first table of first SELECT_LEX */
TABLE_LIST *first_table= (TABLE_LIST*) select_lex->table_list.first;
/* list of all tables in query */
@@ -2367,21 +2369,34 @@
#ifdef HAVE_REPLICATION
if (thd->slave_thread)
{
+ if (lex->sql_command == SQLCOM_UPDATE_MULTI)
+ {
+ DBUG_PRINT("info",("need faked locked tables"));
+
+ if (check_multi_update_lock(thd))
+ goto error;
+
+ /* Fix for replication, the tables are opened and locked,
+ now we pretend that we have performed a LOCK TABLES action */
+
+ fake_prev_lock= thd->locked_tables;
+ if (thd->lock)
+ thd->locked_tables= thd->lock;
+ thd->lock= 0;
+ slave_fake_lock= 1;
+ }
/*
- Check if statment should be skipped because of slave filtering
- rules
+ Skip if we are in the slave thread, some table rules have been
+ given and the table list says the query should not be replicated.
Exceptions are:
- - UPDATE MULTI: For this statement, we want to check the filtering
- rules later in the code
- SET: we always execute it (Not that many SET commands exists in
the binary log anyway -- only 4.1 masters write SET statements,
in 5.0 there are no SET statements in the binary log)
- DROP TEMPORARY TABLE IF EXISTS: we always execute it (otherwise we
have stale files on slave caused by exclusion of one tmp table).
*/
- if (!(lex->sql_command == SQLCOM_UPDATE_MULTI) &&
- !(lex->sql_command == SQLCOM_SET_OPTION) &&
+ if (!(lex->sql_command == SQLCOM_SET_OPTION) &&
!(lex->sql_command == SQLCOM_DROP_TABLE &&
lex->drop_temporary && lex->drop_if_exists) &&
all_tables_not_ok(thd, all_tables))
@@ -2404,7 +2419,7 @@
}
#endif
}
-#endif /* HAVE_REPLICATION */
+#endif /* !HAVE_REPLICATION */
/*
When option readonly is set deny operations which change tables.
@@ -3196,36 +3211,23 @@
if (result != 2)
break;
case SQLCOM_UPDATE_MULTI:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- /* if we switched from normal update, rights are checked */
- if (result != 2)
{
- if ((res= multi_update_precheck(thd, all_tables)))
- break;
- }
- else
- res= 0;
-
- if ((res= mysql_multi_update_prepare(thd)))
- break;
-
-#ifdef HAVE_REPLICATION
- /* Check slave filtering rules */
- if (thd->slave_thread && all_tables_not_ok(thd, all_tables))
- {
- /* we warn the slave SQL thread */
- my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
- break;
- }
-#endif /* HAVE_REPLICATION */
+ DBUG_ASSERT(first_table == all_tables && first_table != 0);
+ /* if we switched from normal update, rights are checked */
+ if (result != 2)
+ {
+ if ((res= multi_update_precheck(thd, all_tables)))
+ break;
+ }
+ else
+ res= 0;
- res= mysql_multi_update(thd, all_tables,
- &select_lex->item_list,
- &lex->value_list,
- select_lex->where,
- select_lex->options,
- lex->duplicates, lex->ignore, unit, select_lex);
+ res= mysql_multi_update(thd, all_tables,
+ &select_lex->item_list,
+ &lex->value_list,
+ select_lex->where,
+ select_lex->options,
+ lex->duplicates, lex->ignore, unit, select_lex);
break;
}
case SQLCOM_REPLACE:
@@ -4526,8 +4528,7 @@
command[thd->lex->create_view_mode].length);
view_store_options(thd, first_table, &buff);
buff.append("VIEW ", 5);
- /* Test if user supplied a db (ie: we did not use thd->db) */
- if (first_table->db != thd->db && first_table->db[0])
+ if (!first_table->current_db_used)
{
append_identifier(thd, &buff, first_table->db,
first_table->db_length);
@@ -4775,6 +4776,14 @@
res= 1;
cleanup:
+ if (unlikely(slave_fake_lock))
+ {
+ DBUG_PRINT("info",("undoing faked lock"));
+ thd->lock= thd->locked_tables;
+ thd->locked_tables= fake_prev_lock;
+ if (thd->lock == thd->locked_tables)
+ thd->lock= 0;
+ }
DBUG_RETURN(res || thd->net.report_error);
}
@@ -4845,6 +4854,7 @@
bool db_is_pattern= test(want_access & GRANT_ACL);
#endif
ulong dummy;
+ const char *db_name;
DBUG_ENTER("check_access");
DBUG_PRINT("enter",("db: %s want_access: %lu master_access: %lu",
db ? db : "", want_access, sctx->master_access));
@@ -4862,16 +4872,15 @@
DBUG_RETURN(TRUE); /* purecov: tested */
}
+ db_name= db ? db : thd->db;
if (schema_db)
{
if (want_access & ~(SELECT_ACL | EXTRA_ACL))
{
if (!no_errors)
- {
- const char *db_name= db ? db : thd->db;
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
- sctx->priv_user, sctx->priv_host, db_name);
- }
+ sctx->priv_user,
+ sctx->priv_host, db_name);
DBUG_RETURN(TRUE);
}
else
@@ -5046,16 +5055,11 @@
tables->db= db;
tables->table_name= tables->alias= name;
- /*
- The following test is just a shortcut for check_access() (to avoid
- calculating db_access) under the assumption that it's common to
- give persons global right to execute all stored SP (but not
- necessary to create them).
- */
- if ((thd->security_ctx->master_access & want_access) == want_access)
+ if ((thd->security_ctx->master_access & want_access) == want_access &&
+ !thd->db)
tables->grant.privilege= want_access;
else if (check_access(thd,want_access,db,&tables->grant.privilege,
- 0, no_errors, 0))
+ 0, no_errors, test(tables->schema_table)))
return TRUE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -6142,12 +6146,14 @@
{
ptr->db= thd->db;
ptr->db_length= thd->db_length;
+ ptr->current_db_used= 1;
}
else
{
/* The following can't be "" as we may do 'casedn_str()' on it */
ptr->db= empty_c_string;
ptr->db_length= 0;
+ ptr->current_db_used= 1;
}
if (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
ptr->db= thd->strdup(ptr->db);
@@ -6910,6 +6916,57 @@
return 0;
}
+/*
+ Setup locking for multi-table updates. Used by the replication slave.
+ Replication slave SQL thread examines (all_tables_not_ok()) the
+ locking state of referenced tables to determine if the query has to
+ be executed or ignored. Since in multi-table update, the
+ 'default' lock is read-only, this lock is corrected early enough by
+ calling this function, before the slave decides to execute/ignore.
+
+ SYNOPSIS
+ check_multi_update_lock()
+ thd Current thread
+
+ RETURN VALUES
+ 0 ok
+ 1 error
+*/
+static bool check_multi_update_lock(THD *thd)
+{
+ bool res= 1;
+ LEX *lex= thd->lex;
+ TABLE_LIST *table, *tables= lex->query_tables;
+ DBUG_ENTER("check_multi_update_lock");
+
+ if (check_db_used(thd, tables))
+ goto error;
+
+ /*
+ Ensure that we have UPDATE or SELECT privilege for each table
+ The exact privilege is checked in mysql_multi_update()
+ */
+ for (table= tables ; table ; table= table->next_local)
+ {
+ TABLE_LIST *save= table->next_local;
+ table->next_local= 0;
+ if ((check_access(thd, UPDATE_ACL, table->db,
+ &table->grant.privilege,0,1, test(table->schema_table)) ||
+ (grant_option && check_grant(thd, UPDATE_ACL, table,0,1,1))) &&
+ check_one_table_access(thd, SELECT_ACL, table))
+ goto error;
+ table->next_local= save;
+ }
+
+ if (mysql_multi_update_prepare(thd))
+ goto error;
+
+ res= 0;
+
+error:
+ DBUG_RETURN(res);
+}
+
Comp_creator *comp_eq_creator(bool invert)
{
@@ -7396,9 +7453,9 @@
Assign as view definer current user
SYNOPSIS
- default_view_definer()
- sctx current security context
- definer structure where it should be assigned
+ default_definer()
+ Secytity_context current decurity context
+ definer structure where it should be assigned
RETURN
FALSE OK
@@ -7409,14 +7466,15 @@
{
definer->user.str= sctx->priv_user;
definer->user.length= strlen(sctx->priv_user);
-
- if (!*sctx->priv_host)
+ if (*sctx->priv_host != 0)
+ {
+ definer->host.str= sctx->priv_host;
+ definer->host.length= strlen(sctx->priv_host);
+ }
+ else
{
my_error(ER_NO_VIEW_USER, MYF(0));
return TRUE;
}
-
- definer->host.str= sctx->priv_host;
- definer->host.length= strlen(sctx->priv_host);
return FALSE;
}
--- 1.366/sql/sql_select.cc 2005-10-12 15:36:16 +02:00
+++ 1.367/sql/sql_select.cc 2005-10-12 17:17:55 +02:00
@@ -2486,11 +2486,11 @@
and use them in equality propagation process (see details in
OptimizerKBAndTodo)
*/
- if ((cond->functype() != Item_func::BETWEEN) ||
- ((Item_func_between*) cond)->negated ||
- !value[0]->eq(value[1], field->binary()))
+ if ((cond->functype() == Item_func::BETWEEN) &&
+ value[0]->eq(value[1], field->binary()))
+ eq_func= TRUE;
+ else
return;
- eq_func= TRUE;
}
if (field->result_type() == STRING_RESULT)
@@ -6269,21 +6269,6 @@
{
Item *left_item= ((Item_func*) item)->arguments()[0];
Item *right_item= ((Item_func*) item)->arguments()[1];
-
- if (left_item->type() == Item::REF_ITEM &&
- ((Item_ref*)left_item)->ref_type() == Item_ref::VIEW_REF)
- {
- if (((Item_ref*)left_item)->depended_from)
- return FALSE;
- left_item= left_item->real_item();
- }
- if (right_item->type() == Item::REF_ITEM &&
- ((Item_ref*)right_item)->ref_type() == Item_ref::VIEW_REF)
- {
- if (((Item_ref*)right_item)->depended_from)
- return FALSE;
- right_item= right_item->real_item();
- }
if (left_item->type() == Item::FIELD_ITEM &&
right_item->type() == Item::FIELD_ITEM &&
!((Item_field*)left_item)->depended_from &&
--- 1.273/sql/sql_show.cc 2005-10-12 15:36:16 +02:00
+++ 1.274/sql/sql_show.cc 2005-10-12 17:17:55 +02:00
@@ -1031,11 +1031,6 @@
packet->append(" COMMENT=", 9);
append_unescaped(packet, share->comment, strlen(share->comment));
}
- if (share->connect_string.length)
- {
- packet->append(" CONNECTION=", 12);
- append_unescaped(packet, share->connect_string.str, share->connect_string.length);
- }
if (file->raid_type)
{
uint length;
@@ -1288,6 +1283,9 @@
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thread_info *thd_info;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *sctx;
+#endif
time_t now= time(0);
while ((thd_info=thread_infos.get()))
{
--- 1.274/sql/sql_table.cc 2005-10-12 15:41:19 +02:00
+++ 1.275/sql/sql_table.cc 2005-10-12 17:17:55 +02:00
@@ -1773,6 +1773,14 @@
mysql_bin_log.write(&qinfo);
}
error= FALSE;
+ goto end;
+
+warn:
+ error= 0;
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ alias);
+ create_info->table_existed= 1; // Mark that table existed
end:
VOID(pthread_mutex_unlock(&LOCK_open));
@@ -1787,13 +1795,6 @@
no_err:
delete file;
DBUG_RETURN(FALSE);
-warn:
- error= FALSE;
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- alias);
- create_info->table_existed= 1; // Mark that table existed
- goto end;
}
/*
@@ -3866,14 +3867,15 @@
if (create_info->row_type == ROW_TYPE_NOT_USED)
create_info->row_type= table->s->row_type;
- DBUG_PRINT("info", ("old type: %d new type: %d", old_db_type, new_db_type));
- if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED) ||
- ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED))
+ DBUG_PRINT("info", ("old type: %d new type: %d", old_db_type, new_db_type));
+ if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED)
+ || ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED))
{
DBUG_PRINT("info", ("doesn't support alter"));
my_error(ER_ILLEGAL_HA, MYF(0), table_name);
DBUG_RETURN(TRUE);
}
+ DBUG_PRINT("info", ("supports alter"));
thd->proc_info="setup";
if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) &&
--- 1.174/sql/sql_update.cc 2005-10-12 15:36:17 +02:00
+++ 1.175/sql/sql_update.cc 2005-10-12 17:17:55 +02:00
@@ -946,6 +946,9 @@
multi_update *result;
DBUG_ENTER("mysql_multi_update");
+ if (mysql_multi_update_prepare(thd))
+ DBUG_RETURN(TRUE);
+
if (!(result= new multi_update(table_list,
thd->lex->select_lex.leaf_tables,
fields, values,
--- 1.50/sql/structs.h 2005-10-08 01:48:58 +02:00
+++ 1.51/sql/structs.h 2005-10-12 17:17:55 +02:00
@@ -20,7 +20,7 @@
struct st_table;
class Field;
-#define STRING_WITH_LEN(X) ((char*) X), (sizeof(X)-1)
+#define STRING_WITH_LEN(X) X, (sizeof(X)-1)
typedef struct st_lex_string
{
--- 1.182/sql/table.cc 2005-10-12 15:42:42 +02:00
+++ 1.183/sql/table.cc 2005-10-12 17:17:55 +02:00
@@ -303,42 +303,6 @@
}
#endif
- record_offset= (ulong) (uint2korr(head+6)+
- ((uint2korr(head+14) == 0xffff ?
- uint4korr(head+47) : uint2korr(head+14))));
-
- if ((n_length= uint2korr(head+55)))
- {
- /* Read extra data segment */
- char *buff, *next_chunk, *buff_end;
- if (!(next_chunk= buff= my_malloc(n_length, MYF(MY_WME))))
- goto err;
- if (my_pread(file, (byte*)buff, n_length, record_offset + share->reclength,
- MYF(MY_NABP)))
- {
- my_free(buff, MYF(0));
- goto err;
- }
- share->connect_string.length= uint2korr(buff);
- if (! (share->connect_string.str= strmake_root(&outparam->mem_root,
- next_chunk + 2, share->connect_string.length)))
- {
- my_free(buff, MYF(0));
- goto err;
- }
- next_chunk+= share->connect_string.length + 2;
- buff_end= buff + n_length;
- if (next_chunk + 2 < buff_end)
- {
- uint str_db_type_length= uint2korr(next_chunk);
- share->db_type= ha_resolve_by_name(next_chunk + 2, str_db_type_length);
- DBUG_PRINT("enter", ("Setting dbtype to: %d - %d - '%.*s'\n", share->db_type,
- str_db_type_length, str_db_type_length, next_chunk + 2));
- next_chunk+= str_db_type_length + 2;
- }
- my_free(buff, MYF(0));
- }
-
error=4;
outparam->reginfo.lock_type= TL_UNLOCK;
outparam->current_lock=F_UNLCK;
@@ -358,6 +322,9 @@
goto err; /* purecov: inspected */
share->default_values= (byte *) record;
+ record_offset= (ulong) (uint2korr(head+6)+
+ ((uint2korr(head+14) == 0xffff ?
+ uint4korr(head+47) : uint2korr(head+14))));
if (my_pread(file,(byte*) record, (uint) share->reclength,
record_offset, MYF(MY_NABP)))
goto err; /* purecov: inspected */
@@ -375,7 +342,20 @@
else
outparam->record[1]= outparam->record[0]; // Safety
}
-
+
+ if ((n_length= uint2korr(head+55)))
+ {
+ /* Read extra block information */
+ char *buff;
+ if (!(buff= alloc_root(&outparam->mem_root, n_length)))
+ goto err;
+ if (my_pread(file, (byte*)buff, n_length, record_offset + share->reclength,
+ MYF(MY_NABP)))
+ goto err;
+ share->connect_string.length= uint2korr(buff);
+ share->connect_string.str= buff+2;
+ }
+
#ifdef HAVE_purify
/*
We need this because when we read var-length rows, we are not updating
@@ -491,11 +471,9 @@
{
outparam->null_flags=null_pos=(uchar*) record+1;
null_bit_pos= (db_create_options & HA_OPTION_PACK_RECORD) ? 0 : 1;
- /*
- null_bytes below is only correct under the condition that
- there are no bit fields. Correct values is set below after the
- table struct is initialized
- */
+ /* null_bytes below is only correct under the condition that
+ there are no bit fields. Correct values is set below after the
+ table struct is initialized */
share->null_bytes= (share->null_fields + null_bit_pos + 7) / 8;
}
else
@@ -919,12 +897,8 @@
#endif
goto err;
- /*
- the correct null_bytes can now be set, since bitfields have been taken
- into account
- */
- share->null_bytes= (null_pos - (uchar*) outparam->null_flags +
- (null_bit_pos + 7) / 8);
+ /* the correct null_bytes can now be set, since bitfields have been taken into account */
+ share->null_bytes= null_pos - (uchar*) outparam->null_flags + (null_bit_pos + 7) / 8;
share->last_null_bit_pos= null_bit_pos;
/* The table struct is now initialized; Open the table */
@@ -1436,10 +1410,15 @@
ulong length;
char fill[IO_SIZE];
int create_flags= O_RDWR | O_TRUNC;
+ uint extra_size;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= O_EXCL | O_NOFOLLOW;
+ extra_size= 0;
+ if (create_info->connect_string.length)
+ extra_size= 2+create_info->connect_string.length;
+
#if SIZEOF_OFF_T > 4
/* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */
if (create_info->max_rows > ~(ulong) 0)
@@ -1467,8 +1446,7 @@
fileinfo[4]=1;
int2store(fileinfo+6,IO_SIZE); /* Next block starts here */
key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16;
- length= next_io_size((ulong) (IO_SIZE+key_length+reclength+
- create_info->extra_size));
+ length= next_io_size((ulong) (IO_SIZE+key_length+reclength+extra_size));
int4store(fileinfo+10,length);
tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
int2store(fileinfo+14,tmp_key_length);
@@ -1490,7 +1468,7 @@
int4store(fileinfo+47, key_length);
tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store
int4store(fileinfo+51, tmp);
- int2store(fileinfo+55, create_info->extra_size);
+ int2store(fileinfo+55, extra_size);
bzero(fill,IO_SIZE);
for (; length > IO_SIZE ; length-= IO_SIZE)
{
--- 1.114/sql/table.h 2005-10-12 15:36:17 +02:00
+++ 1.115/sql/table.h 2005-10-12 17:17:55 +02:00
@@ -592,6 +592,8 @@
bool compact_view_format; /* Use compact format for SHOW CREATE VIEW */
/* view where processed */
bool where_processed;
+ /* db part was not defined in table definition */
+ bool current_db_used;
/* FRMTYPE_ERROR if any type is acceptable */
enum frm_type_enum required_type;
char timestamp_buffer[20]; /* buffer for timestamp (19+1) */
--- 1.67/sql/unireg.cc 2005-10-12 15:46:25 +02:00
+++ 1.68/sql/unireg.cc 2005-10-12 17:17:55 +02:00
@@ -76,7 +76,6 @@
uint keys, KEY *key_info,
handler *db_file)
{
- LEX_STRING str_db_type;
uint reclength,info_length,screens,key_info_length,maxlength;
ulong key_buff_length;
File file;
@@ -84,7 +83,6 @@
uchar fileinfo[64],forminfo[288],*keybuff;
TYPELIB formnames;
uchar *screen_buff;
- char buff[2];
#ifdef HAVE_PARTITION_DB
partition_info *part_info= thd->lex->part_info;
#endif
@@ -124,12 +122,6 @@
}
reclength=uint2korr(forminfo+266);
- /* Calculate extra data segment length */
- str_db_type.str= (char *)ha_get_storage_engine(create_info->db_type);
- str_db_type.length= strlen(str_db_type.str);
- create_info->extra_size= 2 + str_db_type.length;
- create_info->extra_size+= create_info->connect_string.length + 2;
-
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys)) < 0)
{
@@ -171,19 +163,16 @@
if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
create_fields,reclength, data_offset, db_file))
goto err;
-
- int2store(buff, create_info->connect_string.length);
- if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
- my_write(file, (const byte*)create_info->connect_string.str,
- create_info->connect_string.length, MYF(MY_NABP)))
+ if (create_info->connect_string.length)
+ {
+ char buff[2];
+ int2store(buff,create_info->connect_string.length);
+ if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
+ my_write(file, (const byte*)create_info->connect_string.str,
+ create_info->connect_string.length, MYF(MY_NABP)))
goto err;
+ }
- int2store(buff, str_db_type.length);
- if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
- my_write(file, (const byte*)str_db_type.str,
- str_db_type.length, MYF(MY_NABP)))
- goto err;
-
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||
@@ -508,10 +497,16 @@
char *dst;
uint length= field->interval->type_lengths[pos], hex_length;
const char *src= field->interval->type_names[pos];
+ const char *srcend= src + length;
hex_length= length * 2;
field->interval->type_lengths[pos]= hex_length;
field->interval->type_names[pos]= dst= sql_alloc(hex_length + 1);
- octet2hex(dst, src, length);
+ for ( ; src < srcend; src++)
+ {
+ *dst++= _dig_vec_upper[((uchar) *src) >> 4];
+ *dst++= _dig_vec_upper[((uchar) *src) & 15];
+ }
+ *dst= '\0';
}
}
--- 1.12/strings/longlong2str-x86.s 2005-10-06 16:54:25 +02:00
+++ 1.13/strings/longlong2str-x86.s 2005-10-12 17:18:10 +02:00
@@ -26,88 +26,95 @@
.type longlong2str_with_dig_vector,@function
longlong2str_with_dig_vector:
- subl $80,%esp # Temporary buffer for up to 64 radix-2 digits
+ subl $80,%esp
pushl %ebp
pushl %esi
pushl %edi
pushl %ebx
- movl 100(%esp),%esi # esi = Lower part of val
- movl 112(%esp),%ebx # ebx = Radix
- movl 104(%esp),%ebp # ebp = Higher part of val
- movl 108(%esp),%edi # edi = dst
-
- testl %ebx,%ebx
- jge .L144 # Radix was positive
- negl %ebx # Change radix to positive
- testl %ebp,%ebp # Test if given value is negative
+ movl 100(%esp),%esi # Lower part of val
+ movl 112(%esp),%ebx # Radix
+ movl 104(%esp),%ebp # Higher part of val
+ movl %ebx,%eax
+ movl 108(%esp),%edi # get dst
+ testl %eax,%eax
jge .L144
+
+ addl $36,%eax
+ cmpl $34,%eax
+ ja .Lerror # Wrong radix
+ testl %ebp,%ebp
+ jge .L146
movb $45,(%edi) # Add sign
incl %edi # Change sign of val
negl %esi
adcl $0,%ebp
negl %ebp
-
-.L144: # Test that radix is between 2 and 36
- movl %ebx, %eax
- addl $-2,%eax # Test that radix is between 2 and 36
+.L146:
+ negl %ebx # Change radix to positive
+ jmp .L148
+ .align 4
+.L144:
+ addl $-2,%eax
cmpl $34,%eax
- ja .Lerror # Radix was not in range
+ ja .Lerror # Radix in range
+
+.L148:
+ movl %esi,%eax # Test if zero (for easy loop)
+ orl %ebp,%eax
+ jne .L150
+ movb $48,(%edi)
+ incl %edi
+ jmp .L10_end
+ .align 4
+.L150:
leal 92(%esp),%ecx # End of buffer
movl %edi, 108(%esp) # Store possible modified dest
movl 116(%esp), %edi # dig_vec_upper
- testl %ebp,%ebp # Test if value > 0xFFFFFFFF
- jne .Llongdiv
- cmpl %ebx, %esi # Test if <= radix, for easy loop
- movl %esi, %eax # Value in eax (for Llow)
- jae .Llow
-
- # Value is one digit (negative or positive)
- movb (%eax,%edi),%bl
- movl 108(%esp),%edi # get dst
- movb %bl,(%edi)
- incl %edi # End null here
- jmp .L10_end
+ jmp .L155
+ .align 4
-.Llongdiv:
- # Value in ebp:esi. div the high part by the radix,
- # then div remainder + low part by the radix.
- movl %ebp,%eax # edx=0,eax=high(from ebp)
+.L153:
+ # val is stored in in ebp:esi
+
+ movl %ebp,%eax # High part of value
xorl %edx,%edx
- decl %ecx
divl %ebx
- movl %eax,%ebp # edx=result of last, eax=low(from esi)
+ movl %eax,%ebp
movl %esi,%eax
divl %ebx
- movl %eax,%esi # ebp:esi = quotient
- movb (%edx,%edi),%dl # Store result number in temporary buffer
+ decl %ecx
+ movl %eax,%esi # quotent in ebp:esi
+ movb (%edx,%edi),%al # al is faster than dl
+ movb %al,(%ecx) # store value in buff
+ .align 4
+.L155:
testl %ebp,%ebp
- movb %dl,(%ecx) # store value in buff
- ja .Llongdiv # (Higher part of val still > 0)
-
+ ja .L153
+ testl %esi,%esi # rest value
+ jl .L153
+ je .L160 # Ready
+ movl %esi,%eax
.align 4
-.Llow: # Do rest with integer precision
- # Value in 0:eax. div 0 + low part by the radix.
- xorl %edx,%edx
- decl %ecx
+
+.L154: # Do rest with integer precision
+ cltd
divl %ebx
+ decl %ecx
movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36
testl %eax,%eax
movb %dl,(%ecx)
- jne .Llow
+ jne .L154
.L160:
movl 108(%esp),%edi # get dst
-
-.Lcopy_end:
- leal 92(%esp),%esi # End of buffer
-.Lmov: # mov temporary buffer to result (%ecx -> %edi)
- movb (%ecx), %al
- movb %al, (%edi)
- incl %ecx
- incl %edi
- cmpl %ecx,%esi
- jne .Lmov
+
+.L10_mov:
+ movl %ecx,%esi
+ leal 92(%esp),%ecx # End of buffer
+ subl %esi,%ecx
+ rep
+ movsb
.L10_end:
movl %edi,%eax # Pointer to end null
@@ -159,23 +166,21 @@
negl %esi # Change sign of val (ebp:esi)
adcl $0,%ebp
negl %ebp
+ .align 4
.L10_10:
leal 92(%esp),%ecx # End of buffer
- testl %ebp,%ebp # Test if value > 0xFFFFFFFF
- jne .L10_longdiv
- cmpl $10, %esi # Test if <= radix, for easy loop
- movl %esi, %ebx # Value in eax (for L10_low)
- jae .L10_low
-
- # Value is one digit (negative or positive)
- addb $48, %bl
- movb %bl,(%edi)
+ movl %esi,%eax # Test if zero (for easy loop)
+ orl %ebp,%eax
+ jne .L10_30 # Not zero
+
+ # Here when value is zero
+ movb $48,(%edi)
incl %edi
jmp .L10_end
.align 4
-.L10_longdiv:
+.L10_20:
# val is stored in in ebp:esi
movl %ebp,%eax # High part of value
xorl %edx,%edx
@@ -190,15 +195,17 @@
.L10_30:
testl %ebp,%ebp
- ja .L10_longdiv
+ ja .L10_20
+ testl %esi,%esi # rest value
+ jl .L10_20 # Unsigned, do ulonglong div once more
+ je .L10_mov # Ready
movl %esi,%ebx # Move val to %ebx
-.L10_low:
# The following code uses some tricks to change division by 10 to
# multiplication and shifts
movl $0xcccccccd,%esi
-.L10_40: # Divide %ebx with 10
+.L10_40:
movl %ebx,%eax
mull %esi
decl %ecx
@@ -211,7 +218,7 @@
movl %edx,%ebx
testl %ebx,%ebx
jne .L10_40
- jmp .Lcopy_end # Shared end with longlong2str
+ jmp .L10_mov # Shared end with longlong10_to_str
.L10end:
.size longlong10_to_str,.L10end-longlong10_to_str
--- 1.76/mysql-test/r/ctype_utf8.result 2005-10-11 23:58:17 +02:00
+++ 1.77/mysql-test/r/ctype_utf8.result 2005-10-12 17:17:52 +02:00
@@ -1079,31 +1079,29 @@
select char(0xff,0x8f);
char(0xff,0x8f)
+Warnings:
+Warning 1300 Invalid utf8 character string: 'FF8F'
set sql_mode=traditional;
select char(0xff,0x8f);
char(0xff,0x8f)
-select convert(char(0xff,0x8f) using utf8);
-convert(char(0xff,0x8f) using utf8)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'FF8F'
select char(195);
char(195)
-select convert(char(195) using utf8);
-convert(char(195) using utf8)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'C3'
select char(196);
char(196)
-select convert(char(196) using utf8);
-convert(char(196) using utf8)
-select hex(char(2557));
-hex(char(2557))
-09FD
-select hex(convert(char(2557) using utf8));
-hex(convert(char(2557) using utf8))
-09FD
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'C4'
+select char(2557);
+char(2557)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'FD'
set names utf8;
create table t1 (a char(1)) default character set utf8;
create table t2 (a char(1)) default character set utf8;
--- 1.72/mysql-test/t/ctype_utf8.test 2005-10-11 23:58:17 +02:00
+++ 1.73/mysql-test/t/ctype_utf8.test 2005-10-12 17:17:53 +02:00
@@ -880,13 +880,9 @@
# incorrect value in strict mode: return NULL with "Error" level warning
set sql_mode=traditional;
select char(0xff,0x8f);
-select convert(char(0xff,0x8f) using utf8);
select char(195);
-select convert(char(195) using utf8);
select char(196);
-select convert(char(196) using utf8);
-select hex(char(2557));
-select hex(convert(char(2557) using utf8));
+select char(2557);
#
# Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters
--- 1.12/mysql-test/r/subselect2.result 2005-10-10 19:38:26 +02:00
+++ 1.13/mysql-test/r/subselect2.result 2005-10-12 17:17:53 +02:00
@@ -14,9 +14,6 @@
, PRIMARY KEY ( DOCID )
) ENGINE=InnoDB
;
-INSERT INTO t1 (DOCID) VALUES ("1"), ("2");
-Warnings:
-Warning 1364 Field 'UUID' doesn't have a default value
CREATE TABLE t2
(
DOCID VARCHAR(32)BINARY NOT NULL
--- 1.124/mysql-test/r/view.result 2005-10-11 23:59:46 +02:00
+++ 1.125/mysql-test/r/view.result 2005-10-12 17:17:53 +02:00
@@ -847,16 +847,13 @@
drop view v1;
create table t1 (a int);
create view v1 as select a from t1;
-create view v3 as select a from t1;
-create database mysqltest;
-rename table v1 to mysqltest.v1;
-ERROR HY000: Changing schema from 'test' to 'mysqltest' is not allowed.
+create database seconddb;
+rename table v1 to seconddb.v1;
+ERROR HY000: Changing schema from 'test' to 'seconddb' is not allowed.
rename table v1 to v2;
-rename table v3 to v1, v2 to t1;
-ERROR 42S01: Table 't1' already exists
drop table t1;
-drop view v2,v3;
-drop database mysqltest;
+drop view v2;
+drop database seconddb;
create view v1 as select 'a',1;
create view v2 as select * from v1 union all select * from v1;
create view v3 as select * from v2 where 1 = (select `1` from v2);
@@ -2301,25 +2298,3 @@
3
DROP VIEW v1;
DROP TABLE t1;
-CREATE TABLE t1 (a INT, b INT, INDEX(a,b));
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 (a INT);
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
-INSERT INTO t3 VALUES (1),(2),(3);
-CREATE VIEW v1 AS SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b;
-CREATE VIEW v2 AS SELECT t3.* FROM t1,t3 WHERE t1.a=t3.a;
-EXPLAIN SELECT t1.* FROM t1 JOIN t2 WHERE t1.a=t2.a AND t1.b=t2.b AND t1.a=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 1 Using where; Using index
-1 SIMPLE t2 ref a a 10 const,test.t1.b 2 Using where; Using index
-EXPLAIN SELECT * FROM v1 WHERE a=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
-1 PRIMARY t2 ref a a 10 const,test.t1.b 2 Using where; Using index
-EXPLAIN SELECT * FROM v2 WHERE a=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3;
--- 1.5/mysql-test/t/subselect2.test 2005-10-07 17:13:58 +02:00
+++ 1.6/mysql-test/t/subselect2.test 2005-10-12 17:17:53 +02:00
@@ -25,8 +25,6 @@
) ENGINE=InnoDB
;
-INSERT INTO t1 (DOCID) VALUES ("1"), ("2");
-
CREATE TABLE t2
(
DOCID VARCHAR(32)BINARY NOT NULL
--- 1.116/mysql-test/t/view.test 2005-10-11 23:59:47 +02:00
+++ 1.117/mysql-test/t/view.test 2005-10-12 17:17:53 +02:00
@@ -790,16 +790,13 @@
#
create table t1 (a int);
create view v1 as select a from t1;
-create view v3 as select a from t1;
-create database mysqltest;
+create database seconddb;
-- error 1450
-rename table v1 to mysqltest.v1;
+rename table v1 to seconddb.v1;
rename table v1 to v2;
---error 1050
-rename table v3 to v1, v2 to t1;
drop table t1;
-drop view v2,v3;
-drop database mysqltest;
+drop view v2;
+drop database seconddb;
#
# bug handling from VIEWs
@@ -2170,23 +2167,3 @@
DROP VIEW v1;
DROP TABLE t1;
-
-#
-# Bug #13327 view wasn't using index for const condition
-#
-
-CREATE TABLE t1 (a INT, b INT, INDEX(a,b));
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 (a INT);
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
-INSERT INTO t3 VALUES (1),(2),(3);
-CREATE VIEW v1 AS SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b;
-CREATE VIEW v2 AS SELECT t3.* FROM t1,t3 WHERE t1.a=t3.a;
-EXPLAIN SELECT t1.* FROM t1 JOIN t2 WHERE t1.a=t2.a AND t1.b=t2.b AND t1.a=1;
-EXPLAIN SELECT * FROM v1 WHERE a=1;
-EXPLAIN SELECT * FROM v2 WHERE a=1;
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3;
-
-
--- 1.16/sql/parse_file.cc 2005-10-11 23:58:18 +02:00
+++ 1.17/sql/parse_file.cc 2005-10-12 17:17:54 +02:00
@@ -372,10 +372,8 @@
if (revision > 0 && !access(arc_path, F_OK))
{
- ulonglong limit= ((revision > num_view_backups) ?
- revision - num_view_backups : 0);
- for (; revision > limit ; revision--)
- {
+ ulonglong limit= (revision > num_view_backups) ? revision - num_view_backups : 0;
+ while (revision > limit) {
my_snprintf(old_path, FN_REFLEN, "%s/%s%s-%04lu",
arc_path, old_name, reg_ext, (ulong)revision);
(void) unpack_filename(old_path, old_path);
@@ -383,6 +381,7 @@
arc_path, new_name, reg_ext, (ulong)revision);
(void) unpack_filename(new_path, new_path);
my_rename(old_path, new_path, MYF(0));
+ revision--;
}
}
return 0;
--- 1.70/sql/sql_view.cc 2005-10-11 23:58:19 +02:00
+++ 1.71/sql/sql_view.cc 2005-10-12 17:17:55 +02:00
@@ -1427,7 +1427,7 @@
/* get view definition and source */
if (parser->parse((gptr)&view_def, thd->mem_root, view_parameters,
- array_elements(view_parameters)-1))
+ sizeof(view_parameters)/sizeof(view_parameters[0])-1))
goto err;
/* rename view and it's backups */
--- 1.4/mysql-test/r/rpl_multi_update3.result 2005-10-10 15:09:43 +02:00
+++ 1.5/mysql-test/r/rpl_multi_update3.result 2005-10-12 17:17:52 +02:00
@@ -122,75 +122,3 @@
i j x y z
1 2 23 24 71
DROP TABLE t1, t2, t3;
-DROP TABLE IF EXISTS t1;
-Warnings:
-Note 1051 Unknown table 't1'
-DROP TABLE IF EXISTS t2;
-Warnings:
-Note 1051 Unknown table 't2'
-CREATE TABLE t1 (
-idp int(11) NOT NULL default '0',
-idpro int(11) default NULL,
-price decimal(19,4) default NULL,
-PRIMARY KEY (idp)
-);
-CREATE TABLE t2 (
-idpro int(11) NOT NULL default '0',
-price decimal(19,4) default NULL,
-nbprice int(11) default NULL,
-PRIMARY KEY (idpro)
-);
-INSERT INTO t1 VALUES
-(1,1,'3.0000'),
-(2,2,'1.0000'),
-(3,1,'1.0000'),
-(4,1,'4.0000'),
-(5,3,'2.0000'),
-(6,2,'4.0000');
-INSERT INTO t2 VALUES
-(1,'0.0000',0),
-(2,'0.0000',0),
-(3,'0.0000',0);
-update
-t2
-join
-( select idpro, min(price) as min_price, count(*) as nbr_price
-from t1
-where idpro>0 and price>0
-group by idpro
-) as table_price
-on t2.idpro = table_price.idpro
-set t2.price = table_price.min_price,
-t2.nbprice = table_price.nbr_price;
-select "-- MASTER AFTER JOIN --" as "";
-
--- MASTER AFTER JOIN --
-select * from t1;
-idp idpro price
-1 1 3.0000
-2 2 1.0000
-3 1 1.0000
-4 1 4.0000
-5 3 2.0000
-6 2 4.0000
-select * from t2;
-idpro price nbprice
-1 1.0000 3
-2 1.0000 2
-3 2.0000 1
-select "-- SLAVE AFTER JOIN --" as "";
-
--- SLAVE AFTER JOIN --
-select * from t1;
-idp idpro price
-1 1 3.0000
-2 2 1.0000
-3 1 1.0000
-4 1 4.0000
-5 3 2.0000
-6 2 4.0000
-select * from t2;
-idpro price nbprice
-1 1.0000 3
-2 1.0000 2
-3 2.0000 1
--- 1.5/mysql-test/t/rpl_multi_update3.test 2005-10-10 15:09:44 +02:00
+++ 1.6/mysql-test/t/rpl_multi_update3.test 2005-10-12 17:17:53 +02:00
@@ -158,63 +158,4 @@
connection master;
DROP TABLE t1, t2, t3;
-##############################################################################
-#
-# BUG#12618
-#
-# TEST: Replication of a statement containing a join in a multi-update.
-
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-
-CREATE TABLE t1 (
- idp int(11) NOT NULL default '0',
- idpro int(11) default NULL,
- price decimal(19,4) default NULL,
- PRIMARY KEY (idp)
-);
-
-CREATE TABLE t2 (
- idpro int(11) NOT NULL default '0',
- price decimal(19,4) default NULL,
- nbprice int(11) default NULL,
- PRIMARY KEY (idpro)
-);
-
-INSERT INTO t1 VALUES
- (1,1,'3.0000'),
- (2,2,'1.0000'),
- (3,1,'1.0000'),
- (4,1,'4.0000'),
- (5,3,'2.0000'),
- (6,2,'4.0000');
-
-INSERT INTO t2 VALUES
- (1,'0.0000',0),
- (2,'0.0000',0),
- (3,'0.0000',0);
-
-# This update sets t2 to the minimal prices for each product
-update
- t2
- join
- ( select idpro, min(price) as min_price, count(*) as nbr_price
- from t1
- where idpro>0 and price>0
- group by idpro
- ) as table_price
-on t2.idpro = table_price.idpro
-set t2.price = table_price.min_price,
- t2.nbprice = table_price.nbr_price;
-
-select "-- MASTER AFTER JOIN --" as "";
-select * from t1;
-select * from t2;
-
-sync_slave_with_master;
-
-select "-- SLAVE AFTER JOIN --" as "";
-select * from t1;
-select * from t2;
-
# End of 4.1 tests
--- 1.43/scripts/make_win_src_distribution.sh 2005-10-12 15:36:10 +02:00
+++ 1.44/scripts/make_win_src_distribution.sh 2005-10-12 17:17:54 +02:00
@@ -289,7 +289,7 @@
for i in COPYING ChangeLog README EXCEPTIONS-CLIENT\
INSTALL-SOURCE INSTALL-WIN \
INSTALL-WIN-SOURCE \
- Docs/INSTALL-BINARY Docs/manual.chm
+ Docs/INSTALL-BINARY
do
print_debug "Copying file '$i'"
if [ -f $i ]
--- 1.2/mysql-test/r/mysqlshow.result 2005-10-06 16:54:24 +02:00
+++ 1.3/mysql-test/r/mysqlshow.result 2005-10-12 17:17:52 +02:00
@@ -1,4 +1,3 @@
-DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (a int, b int);
--- 1.5/mysql-test/r/user_var-binlog.result 2005-10-11 23:58:17 +02:00
+++ 1.6/mysql-test/r/user_var-binlog.result 2005-10-12 17:17:53 +02:00
@@ -11,7 +11,7 @@
master-bin.000001 98 User var 1 139 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
master-bin.000001 139 Query 1 231 use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 231 User var 1 273 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001 273 User var 1 311 @`var2`=_binary 0x61 COLLATE binary
+master-bin.000001 273 User var 1 311 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
master-bin.000001 311 Query 1 411 use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@@ -24,7 +24,7 @@
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
INSERT INTO t1 VALUES(@`a b`);
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`;
-SET @`var2`:=_binary 0x61 COLLATE `binary`;
+SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`;
SET TIMESTAMP=10000;
insert into t1 values (@var1),(@var2);
# End of log file
--- 1.3/mysql-test/t/mysqlshow.test 2005-10-06 16:54:24 +02:00
+++ 1.4/mysql-test/t/mysqlshow.test 2005-10-12 17:17:53 +02:00
@@ -1,10 +1,6 @@
# Can't run test of external client with embedded server
-- source include/not_embedded.inc
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
#
## Bug #5036 mysqlshow is missing a column
#
--- 1.6/mysql-test/r/ndb_config.result 2005-10-12 15:19:41 +02:00
+++ 1.7/mysql-test/r/ndb_config.result 2005-10-12 17:17:52 +02:00
@@ -6,6 +6,7 @@
ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7,
ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800 ndb_mgmd,5,localhost,, mysqld,6,localhost,,
ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
+Cluster configuration warning line 0: Could not use next node id 2 for section [API], using next unused node id 7.
ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15,
shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
--- 1.14/storage/ndb/tools/ndb_config.cpp 2005-10-12 15:22:01 +02:00
+++ 1.15/storage/ndb/tools/ndb_config.cpp 2005-10-12 17:18:09 +02:00
@@ -185,9 +185,7 @@
if (g_nodes && g_connections)
{
- fprintf(stderr,
- "Only one option of --nodes and --connections allowed\n");
- return -1;
+ ndbout_c("Only one option of --nodes and --connections allowed");
}
g_section = CFG_SECTION_NODE; //default
--- 1.72/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2005-10-12 15:22:01 +02:00
+++ 1.73/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2005-10-12 17:18:05 +02:00
@@ -2577,9 +2577,9 @@
id++;
if (id != nextNodeId)
{
- fprintf(stderr,"Cluster configuration warning line %d: "
+ ndbout_c("Cluster configuration warning line %d: "
"Could not use next node id %d for section [%s], "
- "using next unused node id %d.\n",
+ "using next unused node id %d.",
ctx.m_sectionLineno, nextNodeId, ctx.fname, id);
}
ctx.m_currentSection->put("NodeId", id);
--- 1.213/sql/ha_ndbcluster.cc 2005-10-12 15:36:10 +02:00
+++ 1.214/sql/ha_ndbcluster.cc 2005-10-12 17:17:54 +02:00
@@ -6008,6 +6008,7 @@
{
THD *thd; /* needs to be first for thread_stack */
Ndb* ndb;
+ int error= 0;
struct timespec abstime;
my_thread_init();
@@ -6036,9 +6037,9 @@
{
pthread_mutex_lock(&LOCK_ndb_util_thread);
- pthread_cond_timedwait(&COND_ndb_util_thread,
- &LOCK_ndb_util_thread,
- &abstime);
+ error= pthread_cond_timedwait(&COND_ndb_util_thread,
+ &LOCK_ndb_util_thread,
+ &abstime);
pthread_mutex_unlock(&LOCK_ndb_util_thread);
DBUG_PRINT("ndb_util_thread", ("Started, ndb_cache_check_time: %d",
--- 1.43/mysql-test/r/range.result 2005-10-11 23:58:17 +02:00
+++ 1.44/mysql-test/r/range.result 2005-10-12 17:17:52 +02:00
@@ -809,11 +809,4 @@
explain select * from t2 where a = 'a' or a='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref a a 13 const # Using where
-update t1 set a='b' where a<>'a';
-explain select * from t1 where a not between 'b' and 'b';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 13 NULL # Using where
-select * from t1 where a not between 'b' and 'b';
-a filler
-a
drop table t1,t2,t3;
--- 1.99/mysql-test/r/select.result 2005-10-10 19:38:25 +02:00
+++ 1.100/mysql-test/r/select.result 2005-10-12 17:17:53 +02:00
@@ -2628,13 +2628,6 @@
f1
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
f1
-insert into t1 values(1,1),(2,null);
-insert into t2 values(2);
-select * from t1,t2 where f1=f3 and (f1,f2) = (2,null);
-f1 f2 f3
-select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null);
-f1 f2 f3
-2 NULL 2
drop table t1,t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
--- 1.42/mysql-test/r/type_float.result 2005-10-11 13:38:16 +02:00
+++ 1.43/mysql-test/r/type_float.result 2005-10-12 17:17:53 +02:00
@@ -225,21 +225,6 @@
reckey recdesc
109 Has 109 as key
drop table t1;
-create table t1 (d double(10,1));
-create table t2 (d double(10,9));
-insert into t1 values ("100000000.0");
-insert into t2 values ("1.23456780");
-create table t3 select * from t2 union select * from t1;
-select * from t3;
-d
-1.234567800
-100000000.000000000
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `d` double(22,9) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-drop table t1, t2, t3;
create table t1 (s1 float(0,2));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
create table t1 (s1 float(1,2));
--- 1.41/mysql-test/t/alter_table.test 2005-10-12 15:36:10 +02:00
+++ 1.42/mysql-test/t/alter_table.test 2005-10-12 17:17:53 +02:00
@@ -373,24 +373,24 @@
# Bug#11493 - Alter table rename to default database does not work without
# db name qualifying
#
-create database mysqltest;
+create database mysqltest1;
create table t1 (c1 int);
# Move table to other database.
-alter table t1 rename mysqltest.t1;
+alter table t1 rename mysqltest1.t1;
# Assure that it has moved.
--error 1051
drop table t1;
# Move table back.
-alter table mysqltest.t1 rename t1;
+alter table mysqltest1.t1 rename t1;
# Assure that it is back.
drop table t1;
# Now test for correct message if no database is selected.
# Create t1 in 'test'.
create table t1 (c1 int);
# Change to other db.
-use mysqltest;
+use mysqltest1;
# Drop the current db. This de-selects any db.
-drop database mysqltest;
+drop database mysqltest1;
# Now test for correct message.
--error 1046
alter table test.t1 rename t1;
--- 1.36/mysql-test/t/range.test 2005-10-11 23:58:17 +02:00
+++ 1.37/mysql-test/t/range.test 2005-10-12 17:17:53 +02:00
@@ -625,9 +625,4 @@
--replace_column 9 #
explain select * from t2 where a = 'a' or a='a ';
-update t1 set a='b' where a<>'a';
---replace_column 9 #
-explain select * from t1 where a not between 'b' and 'b';
-select * from t1 where a not between 'b' and 'b';
-
drop table t1,t2,t3;
--- 1.82/mysql-test/t/select.test 2005-10-10 17:12:23 +02:00
+++ 1.83/mysql-test/t/select.test 2005-10-12 17:17:53 +02:00
@@ -2189,10 +2189,6 @@
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
-insert into t1 values(1,1),(2,null);
-insert into t2 values(2);
-select * from t1,t2 where f1=f3 and (f1,f2) = (2,null);
-select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null);
drop table t1,t2;
# End of 4.1 tests
--- 1.27/mysql-test/t/type_float.test 2005-10-11 11:43:51 +02:00
+++ 1.28/mysql-test/t/type_float.test 2005-10-12 17:17:53 +02:00
@@ -146,19 +146,6 @@
select * from t1 where reckey=1.09E2;
drop table t1;
-#
-# Bug #13372 (decimal union)
-#
-create table t1 (d double(10,1));
-create table t2 (d double(10,9));
-insert into t1 values ("100000000.0");
-insert into t2 values ("1.23456780");
-create table t3 select * from t2 union select * from t1;
-select * from t3;
-show create table t3;
-drop table t1, t2, t3;
-
-
# End of 4.1 tests
#
--- 1.5/mysys/my_os2cond.c 2005-10-11 23:58:17 +02:00
+++ 1.6/mysys/my_os2cond.c 2005-10-12 17:17:53 +02:00
@@ -22,7 +22,7 @@
** The following is a simple implementation of posix conditions
*****************************************************************************/
-#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
+#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
#include "mysys_priv.h"
#if defined(THREAD) && defined(OS2)
#include <m_string.h>
@@ -31,109 +31,134 @@
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
{
- cond->waiting= 0;
- /* Warp3 FP29 or Warp4 FP4 or better required */
- if (DosCreateEventSem(NULL, &cond->semaphore, 0x0800, 0))
- return ENOMEM;
+ APIRET rc = 0;
+ HEV event;
+ cond->waiting=0;
+ /* Warp3 FP29 or Warp4 FP4 or better required */
+ rc = DosCreateEventSem( NULL, &cond->semaphore, 0x0800, 0);
+ if (rc)
+ return ENOMEM;
+
return 0;
}
int pthread_cond_destroy(pthread_cond_t *cond)
{
- for (;;)
- {
- APIRET rc;
- if ((rc= DosCloseEventSem(cond->semaphore)) != 301)
- return rc ? EINVAL : 0;
- DosPostEventSem(cond->semaphore);
- }
+ APIRET rc;
+
+ do {
+ rc = DosCloseEventSem(cond->semaphore);
+ if (rc == 301) DosPostEventSem(cond->semaphore);
+ } while (rc == 301);
+ if (rc)
+ return EINVAL;
+
+ return 0;
}
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
- int rval= 0;
- cond->waiting++;
- if (mutex)
- pthread_mutex_unlock(mutex);
- if (DosWaitEventSem(cond->semaphore, SEM_INDEFINITE_WAIT))
- rval= EINVAL;
- if (mutex)
- pthread_mutex_lock(mutex);
- cond->waiting--;
- return rval;
+ APIRET rc;
+ int rval;
+
+ rval = 0;
+ cond->waiting++;
+
+ if (mutex) pthread_mutex_unlock(mutex);
+
+ rc = DosWaitEventSem(cond->semaphore,SEM_INDEFINITE_WAIT);
+ if (rc != 0)
+ rval = EINVAL;
+
+ if (mutex) pthread_mutex_lock(mutex);
+
+ cond->waiting--;
+
+ return rval;
}
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- struct timespec *abstime)
+ struct timespec *abstime)
{
struct timeb curtime;
int result;
long timeout;
- int rval= 0;
+ APIRET rc;
+ int rval;
+
+ _ftime(&curtime);
+ timeout= ((long) (abstime->ts_sec - curtime.time)*1000L +
+ (long)((abstime->ts_nsec/1000) - curtime.millitm)/1000L);
+ if (timeout < 0) /* Some safety */
+ timeout = 0L;
+
+ rval = 0;
+ cond->waiting++;
+
+ if (mutex) pthread_mutex_unlock(mutex);
+
+ rc = DosWaitEventSem(cond->semaphore, timeout);
+ if (rc != 0)
+ rval= ETIMEDOUT;
- _ftime(&curtime);
- timeout= ((long) (abstime->ts_sec - curtime.time) * 1000L +
- (long) ((abstime->ts_nsec / 1000) - curtime.millitm) / 1000L);
- if (timeout < 0) /* Some safety */
- timeout= 0L;
-
- cond->waiting++;
-
- if (mutex)
- pthread_mutex_unlock(mutex);
- if (DosWaitEventSem(cond->semaphore, timeout) != 0)
- rval= ETIMEDOUT;
- if (mutex)
- pthread_mutex_lock(mutex);
+ if (mutex) pthread_mutex_lock(mutex);
- cond->waiting--;
+ cond->waiting--;
- return rval;
+ return rval;
}
int pthread_cond_signal(pthread_cond_t *cond)
{
- /* Bring the next thread off the condition queue: */
- DosPostEventSem(cond->semaphore);
- return 0;
+ APIRET rc;
+
+ /* Bring the next thread off the condition queue: */
+ rc = DosPostEventSem(cond->semaphore);
+ return 0;
}
int pthread_cond_broadcast(pthread_cond_t *cond)
{
- int i;
- /* Enter a loop to bring all threads off the condition queue */
- for (i= cond->waiting; i--;)
- DosPostEventSem(cond->semaphore);
- return 0;
+ int i;
+ APIRET rc;
+
+ /*
+ * Enter a loop to bring all threads off the
+ * condition queue:
+ */
+ i = cond->waiting;
+ while (i--) rc = DosPostEventSem(cond->semaphore);
+
+ return 0 ;
}
int pthread_attr_init(pthread_attr_t *connect_att)
{
- connect_att->dwStackSize= 0;
- connect_att->dwCreatingFlag= 0;
- connect_att->priority= 0;
+ connect_att->dwStackSize = 0;
+ connect_att->dwCreatingFlag = 0;
+ connect_att->priority = 0;
return 0;
}
-int pthread_attr_setstacksize(pthread_attr_t *connect_att, DWORD stack)
+int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
{
- connect_att->dwStackSize= stack;
+ connect_att->dwStackSize=stack;
return 0;
}
-int pthread_attr_setprio(pthread_attr_t *connect_att, int priority)
+int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
{
- connect_att->priority= priority;
+ connect_att->priority=priority;
return 0;
}
int pthread_attr_destroy(pthread_attr_t *connect_att)
{
- bzero((gptr) connect_att, sizeof(*connect_att));
+ bzero((gptr) connect_att,sizeof(*connect_att));
return 0;
}
@@ -141,22 +166,22 @@
** Fix localtime_r() to be a bit safer
****************************************************************************/
-struct tm *localtime_r(const time_t *timep, struct tm *tmp)
+struct tm *localtime_r(const time_t *timep,struct tm *tmp)
{
- if (*timep == (time_t) - 1) /* This will crash win32 */
+ if (*timep == (time_t) -1) /* This will crash win32 */
{
- bzero(tmp, sizeof(*tmp));
+ bzero(tmp,sizeof(*tmp));
}
else
{
- struct tm *res= localtime(timep);
- if (!res) /* Wrong date */
+ struct tm *res=localtime(timep);
+ if (!res) /* Wrong date */
{
- bzero(tmp, sizeof(*tmp)); /* Keep things safe */
+ bzero(tmp,sizeof(*tmp)); /* Keep things safe */
return 0;
}
*tmp= *res;
}
return tmp;
}
-#endif /* __WIN__ */
+#endif /* __WIN__ */
--- 1.12/strings/my_strtoll10.c 2005-10-06 16:54:25 +02:00
+++ 1.13/strings/my_strtoll10.c 2005-10-12 17:18:10 +02:00
@@ -21,8 +21,8 @@
#undef ULONGLONG_MAX
/* Needed under MetroWerks Compiler, since MetroWerks compiler does not properly handle a constant expression containing a mod operator */
#if defined(__NETWARE__) && defined(__MWERKS__)
-static ulonglong ulonglong_max= ~(ulonglong) 0;
-#define ULONGLONG_MAX ulonglong_max
+ulonglong tmp;
+#define ULONGLONG_MAX (tmp =(~(ulonglong) 0))
#else
#define ULONGLONG_MAX (~(ulonglong) 0)
#endif /* __NETWARE__ && __MWERKS__ */
--- 1.109/mysql-test/r/func_str.result 2005-10-11 23:58:17 +02:00
+++ 1.110/mysql-test/r/func_str.result 2005-10-12 17:17:52 +02:00
@@ -21,9 +21,6 @@
select concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h');
concat('monty',' was here ','again') length('hello') char(ascii('h')) ord('h')
monty was here again 5 h 104
-select hex(char(256));
-hex(char(256))
-0100
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
locate('he','hello') locate('he','hello',2) locate('lo','hello',2)
1 0 4
@@ -601,7 +598,7 @@
latin1_swedish_ci 4
select collation(char(130)), coercibility(hex(130));
collation(char(130)) coercibility(hex(130))
-binary 4
+latin1_swedish_ci 4
select collation(format(130,10)), coercibility(format(130,10));
collation(format(130,10)) coercibility(format(130,10))
latin1_swedish_ci 4
@@ -723,7 +720,7 @@
`oct(130)` varchar(64) NOT NULL default '',
`conv(130,16,10)` varchar(64) NOT NULL default '',
`hex(130)` varchar(6) NOT NULL default '',
- `char(130)` varbinary(1) NOT NULL default '',
+ `char(130)` varchar(1) NOT NULL default '',
`format(130,10)` varchar(4) NOT NULL default '',
`left(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
`right(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
@@ -821,9 +818,6 @@
SELECT conv(71, 10, 36), conv('1Z', 36, 10);
conv(71, 10, 36) conv('1Z', 36, 10)
1Z 71
-SELECT conv(71, 10, 37), conv('1Z', 37, 10), conv(0,1,10),conv(0,0,10), conv(0,-1,10);
-conv(71, 10, 37) conv('1Z', 37, 10) conv(0,1,10) conv(0,0,10) conv(0,-1,10)
-NULL NULL NULL NULL NULL
create table t1 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
insert into t1 values (1,'aaaaaaaaaa'), (2,'bbbbbbbbbb');
create table t2 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
--- 1.83/mysql-test/t/func_str.test 2005-10-11 23:58:17 +02:00
+++ 1.84/mysql-test/t/func_str.test 2005-10-12 17:17:53 +02:00
@@ -15,7 +15,6 @@
select char_length('\n\t\r\b\0\_\%\\');
select length(_latin1'\n\t\n\b\0\\_\\%\\');
select concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h');
-select hex(char(256));
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE');
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
@@ -468,7 +467,6 @@
#
SELECT conv(71, 10, 36), conv('1Z', 36, 10);
-SELECT conv(71, 10, 37), conv('1Z', 37, 10), conv(0,1,10),conv(0,0,10), conv(0,-1,10);
#
# Bug in SUBSTRING when mixed with CONCAT and ORDER BY (Bug #3089)
--- 1.4/mysql-test/r/mysql.result 2005-10-06 16:54:24 +02:00
+++ 1.5/mysql-test/r/mysql.result 2005-10-12 17:17:52 +02:00
@@ -1,7 +1,6 @@
drop table if exists t1;
create table t1(a int);
insert into t1 values(1);
-ERROR at line 9: DELIMITER must be followed by a 'delimiter' character or string
Test default delimiter ;
a
--- 1.4/mysql-test/t/mysql.test 2005-10-08 01:48:56 +02:00
+++ 1.5/mysql-test/t/mysql.test 2005-10-12 17:17:53 +02:00
@@ -14,7 +14,7 @@
insert into t1 values(1);
# Test delimiters
---exec $MYSQL test 2>&1 < "./t/mysql_delimiter.sql"
+--exec $MYSQL test < "./t/mysql_delimiter.sql"
--disable_query_log
# Test delimiter : supplied on the command line
--- 1.162/client/mysqltest.c 2005-10-12 15:36:10 +02:00
+++ 1.163/client/mysqltest.c 2005-10-12 17:17:52 +02:00
@@ -143,8 +143,7 @@
long code;
} st_error;
-static st_error global_error[] =
-{
+static st_error global_error[] = {
#include <mysqld_ername.h>
{ 0, 0 }
};
@@ -219,8 +218,7 @@
static char *ps_eprint(int);
static void ps_free_reg(void);
-static const char *embedded_server_groups[]=
-{
+static const char *embedded_server_groups[] = {
"server",
"embedded",
"mysqltest_SERVER",
@@ -737,7 +735,9 @@
static int check_result(DYNAMIC_STRING* ds, const char *fname,
my_bool require_option)
{
+ int error= RESULT_OK;
int res= dyn_string_cmp(ds, fname);
+
DBUG_ENTER("check_result");
if (res && require_option)
@@ -747,16 +747,18 @@
break; /* ok */
case RESULT_LENGTH_MISMATCH:
verbose_msg("Result length mismatch");
+ error= RESULT_LENGTH_MISMATCH;
break;
case RESULT_CONTENT_MISMATCH:
verbose_msg("Result content mismatch");
+ error= RESULT_CONTENT_MISMATCH;
break;
default: /* impossible */
die("Unknown error code from dyn_string_cmp()");
}
- if (res != RESULT_OK)
+ if (error)
reject_dump(fname, ds->str, ds->length);
- DBUG_RETURN(res);
+ DBUG_RETURN(error);
}
@@ -1284,7 +1286,7 @@
if (*p != '$')
die("First argument to %s must be a variable (start with $)", name);
v= var_get(p, &p, 1, 0);
- switch (operator) {
+ switch (operator){
case DO_DEC:
v->int_val--;
break;
--- 1.18/mysql-test/r/federated.result 2005-10-11 02:41:06 +02:00
+++ 1.19/mysql-test/r/federated.result 2005-10-12 17:17:52 +02:00
@@ -74,12 +74,6 @@
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@stripped:SLAVE_PORT/federated/t1';
-SHOW CREATE TABLE federated.t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(20) NOT NULL,
- `name` varchar(32) NOT NULL default ''
-) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@stripped:9308/federated/t1'
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t2;
--- 1.15/mysql-test/t/federated.test 2005-10-11 02:41:07 +02:00
+++ 1.16/mysql-test/t/federated.test 2005-10-12 17:17:53 +02:00
@@ -75,8 +75,6 @@
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/federated/t1';
-SHOW CREATE TABLE federated.t2;
-
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
--- 1.39/sql/ha_federated.cc 2005-10-12 15:36:10 +02:00
+++ 1.40/sql/ha_federated.cc 2005-10-12 17:17:54 +02:00
@@ -480,7 +480,6 @@
String query(query_buffer, sizeof(query_buffer), &my_charset_bin);
MYSQL *mysql;
DBUG_ENTER("ha_federated::check_foreign_data_source");
-
/* Zero the length, otherwise the string will have misc chars */
query.length(0);
@@ -565,7 +564,6 @@
char buf[FEDERATED_QUERY_BUFFER_SIZE];
int buf_len;
DBUG_ENTER("ha_federated parse_url_error");
-
if (share->scheme)
{
DBUG_PRINT("info",
@@ -574,9 +572,11 @@
my_free((gptr) share->scheme, MYF(0));
share->scheme= 0;
}
- buf_len= min(table->s->connect_string.length,
- FEDERATED_QUERY_BUFFER_SIZE-1);
- strmake(buf, table->s->connect_string.str, buf_len);
+ buf_len= (table->s->connect_string.length > (FEDERATED_QUERY_BUFFER_SIZE - 1))
+ ? FEDERATED_QUERY_BUFFER_SIZE - 1 : table->s->connect_string.length;
+
+ strnmov(buf, table->s->connect_string.str, buf_len);
+ buf[buf_len]= '\0';
my_error(error_num, MYF(0), buf);
DBUG_RETURN(error_num);
}
@@ -767,9 +767,12 @@
{
ulong *lengths;
Field **field;
+
DBUG_ENTER("ha_federated::convert_row_to_internal_format");
+ // num_fields= mysql_num_fields(stored_result);
lengths= mysql_fetch_lengths(stored_result);
+
memset(record, 0, table->s->null_bytes);
for (field= table->field; *field; field++)
@@ -821,8 +824,13 @@
*buf++= '0';
*buf++= 'x';
- buf= octet2hex(buf, (char*) ptr, len);
- if (to->append((char*) buff, (uint)(buf - buff)))
+ for (; len; ptr++,len--)
+ {
+ uint tmp= (uint)(uchar) *ptr;
+ *buf++= _dig_vec_upper[tmp >> 4];
+ *buf++= _dig_vec_upper[tmp & 15];
+ }
+ if (to->append(buff, (uint)(buf - buff)))
DBUG_RETURN(1);
}
else if (part->key_part_flag & HA_BLOB_PART)
@@ -1119,8 +1127,8 @@
char tmpbuff[FEDERATED_QUERY_BUFFER_SIZE];
String tmp(tmpbuff, sizeof(tmpbuff), system_charset_info);
const key_range *ranges[2]= { start_key, end_key };
- DBUG_ENTER("ha_federated::create_where_from_key");
+ DBUG_ENTER("ha_federated::create_where_from_key");
tmp.length(0);
if (start_key == NULL && end_key == NULL)
DBUG_RETURN(1);
@@ -1326,6 +1334,7 @@
query.append(FEDERATED_FROM);
query.append(FEDERATED_BTICK);
+
if (!(share= (FEDERATED_SHARE *)
my_multi_malloc(MYF(MY_WME),
&share, sizeof(*share),
@@ -1380,8 +1389,8 @@
static int free_share(FEDERATED_SHARE *share)
{
DBUG_ENTER("free_share");
-
pthread_mutex_lock(&federated_mutex);
+
if (!--share->use_count)
{
hash_delete(&federated_open_tables, (byte*) share);
@@ -1569,6 +1578,7 @@
values_string.length(0);
insert_string.length(0);
insert_field_value_string.length(0);
+
DBUG_ENTER("ha_federated::write_row");
DBUG_PRINT("info",
("table charset name %s csname %s",
@@ -1673,6 +1683,7 @@
{
char query_buffer[STRING_BUFFER_USUAL_SIZE];
String query(query_buffer, sizeof(query_buffer), &my_charset_bin);
+
DBUG_ENTER("ha_federated::optimize");
query.length(0);
@@ -1696,6 +1707,7 @@
{
char query_buffer[STRING_BUFFER_USUAL_SIZE];
String query(query_buffer, sizeof(query_buffer), &my_charset_bin);
+
DBUG_ENTER("ha_federated::repair");
query.length(0);
@@ -1741,16 +1753,14 @@
int ha_federated::update_row(const byte *old_data, byte *new_data)
{
/*
- This used to control how the query was built. If there was a
- primary key, the query would be built such that there was a where
- clause with only that column as the condition. This is flawed,
- because if we have a multi-part primary key, it would only use the
- first part! We don't need to do this anyway, because
- read_range_first will retrieve the correct record, which is what
- is used to build the WHERE clause. We can however use this to
- append a LIMIT to the end if there is NOT a primary key. Why do
- this? Because we only are updating one record, and LIMIT enforces
- this.
+ This used to control how the query was built. If there was a primary key,
+ the query would be built such that there was a where clause with only
+ that column as the condition. This is flawed, because if we have a multi-part
+ primary key, it would only use the first part! We don't need to do this anyway,
+ because read_range_first will retrieve the correct record, which is what is used
+ to build the WHERE clause. We can however use this to append a LIMIT to the end
+ if there is NOT a primary key. Why do this? Because we only are updating one
+ record, and LIMIT enforces this.
*/
bool has_a_primary_key= (table->s->primary_key == 0 ? TRUE : FALSE);
/*
@@ -1777,6 +1787,7 @@
String where_string(where_buffer,
sizeof(where_buffer),
&my_charset_bin);
+
DBUG_ENTER("ha_federated::update_row");
/*
set string lengths to 0 to avoid misc chars in string
@@ -1971,10 +1982,12 @@
sizeof(sql_query_buffer),
&my_charset_bin);
key_range range;
- DBUG_ENTER("ha_federated::index_read_idx");
index_string.length(0);
sql_query.length(0);
+
+ DBUG_ENTER("ha_federated::index_read_idx");
+
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
@@ -2063,8 +2076,8 @@
String sql_query(sql_query_buffer,
sizeof(sql_query_buffer),
&my_charset_bin);
- DBUG_ENTER("ha_federated::read_range_first");
+ DBUG_ENTER("ha_federated::read_range_first");
if (start_key == NULL && end_key == NULL)
DBUG_RETURN(0);
@@ -2379,6 +2392,7 @@
MYSQL_RES *result= 0;
MYSQL_ROW row;
String status_query_string(status_buf, sizeof(status_buf), &my_charset_bin);
+
DBUG_ENTER("ha_federated::info");
error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
@@ -2469,10 +2483,10 @@
int ha_federated::delete_all_rows()
{
- char query_buffer[FEDERATED_QUERY_BUFFER_SIZE];
- String query(query_buffer, sizeof(query_buffer), &my_charset_bin);
DBUG_ENTER("ha_federated::delete_all_rows");
+ char query_buffer[FEDERATED_QUERY_BUFFER_SIZE];
+ String query(query_buffer, sizeof(query_buffer), &my_charset_bin);
query.length(0);
query.set_charset(system_charset_info);
@@ -2567,14 +2581,32 @@
int ha_federated::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info)
{
- int retval;
- FEDERATED_SHARE tmp_share; // Only a temporary share, to test the url
+ int retval= 0;
+ /*
+ only a temporary share, to test the url
+ */
+ FEDERATED_SHARE tmp_share;
DBUG_ENTER("ha_federated::create");
- if (!(retval= parse_url(&tmp_share, table_arg, 1)))
- retval= check_foreign_data_source(&tmp_share, 1);
+ if ((retval= parse_url(&tmp_share, table_arg, 1)))
+ goto error;
+
+ if ((retval= check_foreign_data_source(&tmp_share, 1)))
+ goto error;
+
+ if (tmp_share.scheme)
+ {
+ my_free((gptr) tmp_share.scheme, MYF(0));
+ tmp_share.scheme= 0;
+ }
+ DBUG_RETURN(retval);
- my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
+error:
+ if (tmp_share.scheme)
+ {
+ my_free((gptr) tmp_share.scheme, MYF(0));
+ tmp_share.scheme= 0;
+ }
DBUG_RETURN(retval);
}
--- 1.93/sql/sp.cc 2005-10-12 15:36:14 +02:00
+++ 1.94/sql/sp.cc 2005-10-12 17:17:54 +02:00
@@ -208,7 +208,7 @@
{
byte key[MAX_KEY_LENGTH]; // db, name, optional key length type
DBUG_ENTER("db_find_routine_aux");
- DBUG_PRINT("enter", ("type: %d name: %.*s",
+ DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str));
/*
@@ -275,7 +275,7 @@
ulong sql_mode;
Open_tables_state open_tables_state_backup;
DBUG_ENTER("db_find_routine");
- DBUG_PRINT("enter", ("type: %d name: %.*s",
+ DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str));
*sphp= 0; // In case of errors
@@ -479,8 +479,7 @@
char olddb[128];
bool dbchanged;
DBUG_ENTER("db_create_routine");
- DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length,
- sp->m_name.str));
+ DBUG_PRINT("enter", ("type: %d name: %*s",type,sp->m_name.length,sp->m_name.str));
dbchanged= FALSE;
if ((ret= sp_use_new_db(thd, sp->m_db.str, olddb, sizeof(olddb),
@@ -607,7 +606,7 @@
TABLE *table;
int ret;
DBUG_ENTER("db_drop_routine");
- DBUG_PRINT("enter", ("type: %d name: %.*s",
+ DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str));
if (!(table= open_proc_table_for_update(thd)))
@@ -629,7 +628,7 @@
int ret;
bool opened;
DBUG_ENTER("db_update_routine");
- DBUG_PRINT("enter", ("type: %d name: %.*s",
+ DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str));
if (!(table= open_proc_table_for_update(thd)))
@@ -923,7 +922,7 @@
{
sp_head *sp;
DBUG_ENTER("sp_find_procedure");
- DBUG_PRINT("enter", ("name: %.*s.%.*s",
+ DBUG_PRINT("enter", ("name: %*s.%*s",
name->m_db.length, name->m_db.str,
name->m_name.length, name->m_name.str));
@@ -981,7 +980,7 @@
{
int ret;
DBUG_ENTER("sp_create_procedure");
- DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", sp->m_name.length, sp->m_name.str));
ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, sp);
DBUG_RETURN(ret);
@@ -993,7 +992,7 @@
{
int ret;
DBUG_ENTER("sp_drop_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name);
if (!ret)
@@ -1007,7 +1006,7 @@
{
int ret;
DBUG_ENTER("sp_update_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, chistics);
if (!ret)
@@ -1021,7 +1020,7 @@
{
sp_head *sp;
DBUG_ENTER("sp_show_create_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
if ((sp= sp_find_procedure(thd, name)))
{
@@ -1073,7 +1072,7 @@
{
sp_head *sp;
DBUG_ENTER("sp_find_function");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
if (!(sp= sp_cache_lookup(&thd->sp_func_cache, name)) &&
!cache_only)
@@ -1090,7 +1089,7 @@
{
int ret;
DBUG_ENTER("sp_create_function");
- DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", sp->m_name.length, sp->m_name.str));
ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, sp);
DBUG_RETURN(ret);
@@ -1102,7 +1101,7 @@
{
int ret;
DBUG_ENTER("sp_drop_function");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name);
if (!ret)
@@ -1116,7 +1115,7 @@
{
int ret;
DBUG_ENTER("sp_update_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, chistics);
if (!ret)
@@ -1130,7 +1129,7 @@
{
sp_head *sp;
DBUG_ENTER("sp_show_create_function");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
if ((sp= sp_find_function(thd, name)))
{
--- 1.15/sql/sp_cache.cc 2005-10-07 02:37:20 +02:00
+++ 1.16/sql/sp_cache.cc 2005-10-12 17:17:54 +02:00
@@ -132,7 +132,7 @@
return; // End of memory error
c->version= Cversion; // No need to lock when reading long variable
}
- DBUG_PRINT("info",("sp_cache: inserting: %.*s", sp->m_qname.length,
+ DBUG_PRINT("info",("sp_cache: inserting: %*s", sp->m_qname.length,
sp->m_qname.str));
c->insert(sp);
*cp= c; // Update *cp if it was NULL
--- 1.190/sql/sp_head.cc 2005-10-11 23:59:47 +02:00
+++ 1.191/sql/sp_head.cc 2005-10-12 17:17:54 +02:00
@@ -280,7 +280,7 @@
DBUG_PRINT("info", ("STRING_RESULT: null"));
goto return_null_item;
}
- DBUG_PRINT("info",("STRING_RESULT: %.*s",
+ DBUG_PRINT("info",("STRING_RESULT: %*s",
s->length(), s->c_ptr_quick()));
/*
Reuse mechanism in sp_eval_func_item() is only employed for assignments
@@ -354,7 +354,7 @@
return;
m_qname.length= m_sroutines_key.length - 1;
m_qname.str= m_sroutines_key.str + 1;
- sprintf(m_qname.str, "%.*s.%.*s",
+ sprintf(m_qname.str, "%*s.%*s",
m_db.length, (m_db.length ? m_db.str : ""),
m_name.length, m_name.str);
}
@@ -794,7 +794,6 @@
splocal < sp_vars_uses.back(); splocal++)
{
Item *val;
- (*splocal)->thd= thd; // fix_fields() is not yet done
/* append the text between sp ref occurences */
res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos);
prev_pos= (*splocal)->pos_in_query + (*splocal)->m_name.length;
--- 1.28/server-tools/instance-manager/instance.cc 2005-10-11 23:59:47 +02:00
+++ 1.29/server-tools/instance-manager/instance.cc 2005-10-12 17:17:54 +02:00
@@ -469,7 +469,7 @@
status= pthread_cond_timedwait(&COND_instance_stopped,
&LOCK_instance,
&timeout);
- if (status == ETIMEDOUT || status == ETIME)
+ if (status == ETIMEDOUT)
break;
}
--- 1.1/server-tools/instance-manager/password.c 2005-10-12 17:19:38 +02:00
+++ 1.2/server-tools/instance-manager/password.c 2005-10-12 17:17:54 +02:00
@@ -1 +1,521 @@
-SYMLINK -> ../../sql/password.c
+/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* password checking routines */
+/*****************************************************************************
+ The main idea is that no password are sent between client & server on
+ connection and that no password are saved in mysql in a decodable form.
+
+ On connection a random string is generated and sent to the client.
+ The client generates a new string with a random generator inited with
+ the hash values from the password and the sent string.
+ This 'check' string is sent to the server where it is compared with
+ a string generated from the stored hash_value of the password and the
+ random string.
+
+ The password is saved (in user.password) by using the PASSWORD() function in
+ mysql.
+
+ This is .c file because it's used in libmysqlclient, which is entirely in C.
+ (we need it to be portable to a variety of systems).
+ Example:
+ update user set password=PASSWORD("hello") where user="test"
+ This saves a hashed number as a string in the password field.
+
+ The new authentication is performed in following manner:
+
+ SERVER: public_seed=create_random_string()
+ send(public_seed)
+
+ CLIENT: recv(public_seed)
+ hash_stage1=sha1("password")
+ hash_stage2=sha1(hash_stage1)
+ reply=xor(hash_stage1, sha1(public_seed,hash_stage2)
+
+ // this three steps are done in scramble()
+
+ send(reply)
+
+
+ SERVER: recv(reply)
+ hash_stage1=xor(reply, sha1(public_seed,hash_stage2))
+ candidate_hash2=sha1(hash_stage1)
+ check(candidate_hash2==hash_stage2)
+
+ // this three steps are done in check_scramble()
+
+*****************************************************************************/
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <m_string.h>
+#include <sha1.h>
+#include "mysql.h"
+
+/************ MySQL 3.23-4.0 authentication routines: untouched ***********/
+
+/*
+ New (MySQL 3.21+) random generation structure initialization
+ SYNOPSIS
+ randominit()
+ rand_st OUT Structure to initialize
+ seed1 IN First initialization parameter
+ seed2 IN Second initialization parameter
+*/
+
+void randominit(struct rand_struct *rand_st, ulong seed1, ulong seed2)
+{ /* For mysql 3.21.# */
+#ifdef HAVE_purify
+ bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */
+#endif
+ rand_st->max_value= 0x3FFFFFFFL;
+ rand_st->max_value_dbl=(double) rand_st->max_value;
+ rand_st->seed1=seed1%rand_st->max_value ;
+ rand_st->seed2=seed2%rand_st->max_value;
+}
+
+
+/*
+ Generate random number.
+ SYNOPSIS
+ my_rnd()
+ rand_st INOUT Structure used for number generation
+ RETURN VALUE
+ generated pseudo random number
+*/
+
+double my_rnd(struct rand_struct *rand_st)
+{
+ rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
+ rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
+ return (((double) rand_st->seed1)/rand_st->max_value_dbl);
+}
+
+
+/*
+ Generate binary hash from raw text string
+ Used for Pre-4.1 password handling
+ SYNOPSIS
+ hash_password()
+ result OUT store hash in this location
+ password IN plain text password to build hash
+ password_len IN password length (password may be not null-terminated)
+*/
+
+void hash_password(ulong *result, const char *password, uint password_len)
+{
+ register ulong nr=1345345333L, add=7, nr2=0x12345671L;
+ ulong tmp;
+ const char *password_end= password + password_len;
+ for (; password < password_end; password++)
+ {
+ if (*password == ' ' || *password == '\t')
+ continue; /* skip space in password */
+ tmp= (ulong) (uchar) *password;
+ nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
+ nr2+=(nr2 << 8) ^ nr;
+ add+=tmp;
+ }
+ result[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */;
+ result[1]=nr2 & (((ulong) 1L << 31) -1L);
+}
+
+
+/*
+ Create password to be stored in user database from raw string
+ Used for pre-4.1 password handling
+ SYNOPSIS
+ make_scrambled_password_323()
+ to OUT store scrambled password here
+ password IN user-supplied password
+*/
+
+void make_scrambled_password_323(char *to, const char *password)
+{
+ ulong hash_res[2];
+ hash_password(hash_res, password, (uint) strlen(password));
+ sprintf(to, "%08lx%08lx", hash_res[0], hash_res[1]);
+}
+
+
+/*
+ Scramble string with password.
+ Used in pre 4.1 authentication phase.
+ SYNOPSIS
+ scramble_323()
+ to OUT Store scrambled message here. Buffer must be at least
+ SCRAMBLE_LENGTH_323+1 bytes long
+ message IN Message to scramble. Message must be at least
+ SRAMBLE_LENGTH_323 bytes long.
+ password IN Password to use while scrambling
+*/
+
+void scramble_323(char *to, const char *message, const char *password)
+{
+ struct rand_struct rand_st;
+ ulong hash_pass[2], hash_message[2];
+
+ if (password && password[0])
+ {
+ char extra, *to_start=to;
+ const char *message_end= message + SCRAMBLE_LENGTH_323;
+ hash_password(hash_pass,password, (uint) strlen(password));
+ hash_password(hash_message, message, SCRAMBLE_LENGTH_323);
+ randominit(&rand_st,hash_pass[0] ^ hash_message[0],
+ hash_pass[1] ^ hash_message[1]);
+ for (; message < message_end; message++)
+ *to++= (char) (floor(my_rnd(&rand_st)*31)+64);
+ extra=(char) (floor(my_rnd(&rand_st)*31));
+ while (to_start != to)
+ *(to_start++)^=extra;
+ }
+ *to= 0;
+}
+
+
+/*
+ Check scrambled message
+ Used in pre 4.1 password handling
+ SYNOPSIS
+ check_scramble_323()
+ scrambled scrambled message to check.
+ message original random message which was used for scrambling; must
+ be exactly SCRAMBLED_LENGTH_323 bytes long and
+ NULL-terminated.
+ hash_pass password which should be used for scrambling
+ All params are IN.
+
+ RETURN VALUE
+ 0 - password correct
+ !0 - password invalid
+*/
+
+my_bool
+check_scramble_323(const char *scrambled, const char *message,
+ ulong *hash_pass)
+{
+ struct rand_struct rand_st;
+ ulong hash_message[2];
+ char buff[16],*to,extra; /* Big enough for check */
+ const char *pos;
+
+ hash_password(hash_message, message, SCRAMBLE_LENGTH_323);
+ randominit(&rand_st,hash_pass[0] ^ hash_message[0],
+ hash_pass[1] ^ hash_message[1]);
+ to=buff;
+ DBUG_ASSERT(sizeof(buff) > SCRAMBLE_LENGTH_323);
+ for (pos=scrambled ; *pos && to < buff+sizeof(buff) ; pos++)
+ *to++=(char) (floor(my_rnd(&rand_st)*31)+64);
+ if (pos-scrambled != SCRAMBLE_LENGTH_323)
+ return 1;
+ extra=(char) (floor(my_rnd(&rand_st)*31));
+ to=buff;
+ while (*scrambled)
+ {
+ if (*scrambled++ != (char) (*to++ ^ extra))
+ return 1; /* Wrong password */
+ }
+ return 0;
+}
+
+static inline uint8 char_val(uint8 X)
+{
+ return (uint) (X >= '0' && X <= '9' ? X-'0' :
+ X >= 'A' && X <= 'Z' ? X-'A'+10 : X-'a'+10);
+}
+
+
+/*
+ Convert password from hex string (as stored in mysql.user) to binary form.
+ SYNOPSIS
+ get_salt_from_password_323()
+ res OUT store salt here
+ password IN password string as stored in mysql.user
+ NOTE
+ This function does not have length check for passwords. It will just crash
+ Password hashes in old format must have length divisible by 8
+*/
+
+void get_salt_from_password_323(ulong *res, const char *password)
+{
+ res[0]= res[1]= 0;
+ if (password)
+ {
+ while (*password)
+ {
+ ulong val=0;
+ uint i;
+ for (i=0 ; i < 8 ; i++)
+ val=(val << 4)+char_val(*password++);
+ *res++=val;
+ }
+ }
+}
+
+
+/*
+ Convert scrambled password from binary form to asciiz hex string.
+ SYNOPSIS
+ make_password_from_salt_323()
+ to OUT store resulting string password here, at least 17 bytes
+ salt IN password in salt format, 2 ulongs
+*/
+
+void make_password_from_salt_323(char *to, const ulong *salt)
+{
+ sprintf(to,"%08lx%08lx", salt[0], salt[1]);
+}
+
+
+/*
+ **************** MySQL 4.1.1 authentication routines *************
+*/
+
+/*
+ Generate string of printable random characters of requested length
+ SYNOPSIS
+ create_random_string()
+ to OUT buffer for generation; must be at least length+1 bytes
+ long; result string is always null-terminated
+ length IN how many random characters to put in buffer
+ rand_st INOUT structure used for number generation
+*/
+
+void create_random_string(char *to, uint length, struct rand_struct *rand_st)
+{
+ char *end= to + length;
+ /* Use pointer arithmetics as it is faster way to do so. */
+ for (; to < end; to++)
+ *to= (char) (my_rnd(rand_st)*94+33);
+ *to= '\0';
+}
+
+
+/* Character to use as version identifier for version 4.1 */
+
+#define PVERSION41_CHAR '*'
+
+
+/*
+ Convert given octet sequence to asciiz string of hex characters;
+ str..str+len and 'to' may not overlap.
+ SYNOPSIS
+ octet2hex()
+ buf OUT output buffer. Must be at least 2*len+1 bytes
+ str, len IN the beginning and the length of the input string
+*/
+
+void
+octet2hex(char *to, const unsigned char *str, uint len)
+{
+ const uint8 *str_end= str + len;
+ for (; str != str_end; ++str)
+ {
+ *to++= _dig_vec_upper[(*str & 0xF0) >> 4];
+ *to++= _dig_vec_upper[*str & 0x0F];
+ }
+ *to= '\0';
+}
+
+
+/*
+ Convert given asciiz string of hex (0..9 a..f) characters to octet
+ sequence.
+ SYNOPSIS
+ hex2octet()
+ to OUT buffer to place result; must be at least len/2 bytes
+ str, len IN begin, length for character string; str and to may not
+ overlap; len % 2 == 0
+*/
+
+static void
+hex2octet(uint8 *to, const char *str, uint len)
+{
+ const char *str_end= str + len;
+ while (str < str_end)
+ {
+ register char tmp= char_val(*str++);
+ *to++= (tmp << 4) | char_val(*str++);
+ }
+}
+
+
+/*
+ Encrypt/Decrypt function used for password encryption in authentication.
+ Simple XOR is used here but it is OK as we crypt random strings. Note,
+ that XOR(s1, XOR(s1, s2)) == s2, XOR(s1, s2) == XOR(s2, s1)
+ SYNOPSIS
+ my_crypt()
+ to OUT buffer to hold crypted string; must be at least len bytes
+ long; to and s1 (or s2) may be the same.
+ s1, s2 IN input strings (of equal length)
+ len IN length of s1 and s2
+*/
+
+static void
+my_crypt(char *to, const uchar *s1, const uchar *s2, uint len)
+{
+ const uint8 *s1_end= s1 + len;
+ while (s1 < s1_end)
+ *to++= *s1++ ^ *s2++;
+}
+
+
+/*
+ MySQL 4.1.1 password hashing: SHA conversion (see RFC 2289, 3174) twice
+ applied to the password string, and then produced octet sequence is
+ converted to hex string.
+ The result of this function is used as return value from PASSWORD() and
+ is stored in the database.
+ SYNOPSIS
+ make_scrambled_password()
+ buf OUT buffer of size 2*SHA1_HASH_SIZE + 2 to store hex string
+ password IN NULL-terminated password string
+*/
+
+void
+make_scrambled_password(char *to, const char *password)
+{
+ SHA1_CONTEXT sha1_context;
+ uint8 hash_stage2[SHA1_HASH_SIZE];
+
+ sha1_reset(&sha1_context);
+ /* stage 1: hash password */
+ sha1_input(&sha1_context, (uint8 *) password, (uint) strlen(password));
+ sha1_result(&sha1_context, (uint8 *) to);
+ /* stage 2: hash stage1 output */
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, (uint8 *) to, SHA1_HASH_SIZE);
+ /* separate buffer is used to pass 'to' in octet2hex */
+ sha1_result(&sha1_context, hash_stage2);
+ /* convert hash_stage2 to hex string */
+ *to++= PVERSION41_CHAR;
+ octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
+}
+
+
+/*
+ Produce an obscure octet sequence from password and random
+ string, recieved from the server. This sequence corresponds to the
+ password, but password can not be easily restored from it. The sequence
+ is then sent to the server for validation. Trailing zero is not stored
+ in the buf as it is not needed.
+ This function is used by client to create authenticated reply to the
+ server's greeting.
+ SYNOPSIS
+ scramble()
+ buf OUT store scrambled string here. The buf must be at least
+ SHA1_HASH_SIZE bytes long.
+ message IN random message, must be exactly SCRAMBLE_LENGTH long and
+ NULL-terminated.
+ password IN users' password
+*/
+
+void
+scramble(char *to, const char *message, const char *password)
+{
+ SHA1_CONTEXT sha1_context;
+ uint8 hash_stage1[SHA1_HASH_SIZE];
+ uint8 hash_stage2[SHA1_HASH_SIZE];
+
+ sha1_reset(&sha1_context);
+ /* stage 1: hash password */
+ sha1_input(&sha1_context, (uint8 *) password, (uint) strlen(password));
+ sha1_result(&sha1_context, hash_stage1);
+ /* stage 2: hash stage 1; note that hash_stage2 is stored in the database */
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE);
+ sha1_result(&sha1_context, hash_stage2);
+ /* create crypt string as sha1(message, hash_stage2) */;
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
+ sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
+ /* xor allows 'from' and 'to' overlap: lets take advantage of it */
+ sha1_result(&sha1_context, (uint8 *) to);
+ my_crypt(to, (const uchar *) to, hash_stage1, SCRAMBLE_LENGTH);
+}
+
+
+/*
+ Check that scrambled message corresponds to the password; the function
+ is used by server to check that recieved reply is authentic.
+ This function does not check lengths of given strings: message must be
+ null-terminated, reply and hash_stage2 must be at least SHA1_HASH_SIZE
+ long (if not, something fishy is going on).
+ SYNOPSIS
+ check_scramble()
+ scramble clients' reply, presumably produced by scramble()
+ message original random string, previously sent to client
+ (presumably second argument of scramble()), must be
+ exactly SCRAMBLE_LENGTH long and NULL-terminated.
+ hash_stage2 hex2octet-decoded database entry
+ All params are IN.
+
+ RETURN VALUE
+ 0 password is correct
+ !0 password is invalid
+*/
+
+my_bool
+check_scramble(const char *scramble, const char *message,
+ const uint8 *hash_stage2)
+{
+ SHA1_CONTEXT sha1_context;
+ uint8 buf[SHA1_HASH_SIZE];
+ uint8 hash_stage2_reassured[SHA1_HASH_SIZE];
+
+ sha1_reset(&sha1_context);
+ /* create key to encrypt scramble */
+ sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
+ sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
+ sha1_result(&sha1_context, buf);
+ /* encrypt scramble */
+ my_crypt((char *) buf, buf, (const uchar *) scramble, SCRAMBLE_LENGTH);
+ /* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, buf, SHA1_HASH_SIZE);
+ sha1_result(&sha1_context, hash_stage2_reassured);
+ return memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE);
+}
+
+
+/*
+ Convert scrambled password from asciiz hex string to binary form.
+ SYNOPSIS
+ get_salt_from_password()
+ res OUT buf to hold password. Must be at least SHA1_HASH_SIZE
+ bytes long.
+ password IN 4.1.1 version value of user.password
+*/
+
+void get_salt_from_password(uint8 *hash_stage2, const char *password)
+{
+ hex2octet(hash_stage2, password+1 /* skip '*' */, SHA1_HASH_SIZE * 2);
+}
+
+/*
+ Convert scrambled password from binary form to asciiz hex string.
+ SYNOPSIS
+ make_password_from_salt()
+ to OUT store resulting string here, 2*SHA1_HASH_SIZE+2 bytes
+ salt IN password in salt format
+*/
+
+void make_password_from_salt(char *to, const uint8 *hash_stage2)
+{
+ *to++= PVERSION41_CHAR;
+ octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
+}
--- 1.8/server-tools/instance-manager/thread_registry.cc 2005-10-11 23:58:17 +02:00
+++ 1.9/server-tools/instance-manager/thread_registry.cc 2005-10-12 17:17:54 +02:00
@@ -145,7 +145,6 @@
pthread_mutex_t *mutex,
struct timespec *wait_time)
{
- int rc;
pthread_mutex_lock(&LOCK_thread_registry);
if (shutdown_in_progress)
{
@@ -155,8 +154,7 @@
info->current_cond= cond;
pthread_mutex_unlock(&LOCK_thread_registry);
/* sic: race condition here, cond can be signaled in deliver_shutdown */
- if ((rc= pthread_cond_timedwait(cond, mutex, wait_time)) == ETIME)
- rc= ETIMEDOUT; // For easier usage
+ int rc= pthread_cond_timedwait(cond, mutex, wait_time);
pthread_mutex_lock(&LOCK_thread_registry);
info->current_cond= 0;
pthread_mutex_unlock(&LOCK_thread_registry);
@@ -174,7 +172,6 @@
{
Thread_info *info;
struct timespec shutdown_time;
- int error;
set_timespec(shutdown_time, 1);
pthread_mutex_lock(&LOCK_thread_registry);
@@ -207,13 +204,11 @@
released - the only case when the predicate is false is when no other
threads exist.
*/
- while (((error= pthread_cond_timedwait(&COND_thread_registry_is_empty,
- &LOCK_thread_registry,
- &shutdown_time)) != ETIMEDOUT &&
- error != ETIME) &&
+ while (pthread_cond_timedwait(&COND_thread_registry_is_empty,
+ &LOCK_thread_registry,
+ &shutdown_time) != ETIMEDOUT &&
head.next != &head)
;
-
/*
If previous signals did not reach some threads, they must be sleeping
in pthread_cond_wait or in a blocking syscall. Wake them up:
--- 1.74/mysql-test/r/mysqldump.result 2005-10-08 01:48:55 +02:00
+++ 1.75/mysql-test/r/mysqldump.result 2005-10-12 17:17:52 +02:00
@@ -1869,32 +1869,31 @@
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
-DELIMITER ;;
-/*!50003 SET SESSION SQL_MODE="" */;;
+DELIMITER //;
+/*!50003 SET SESSION SQL_MODE="" */ //
/*!50003 CREATE TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW
begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
-end */;;
+end */ //
-/*!50003 SET SESSION SQL_MODE="" */;;
+/*!50003 SET SESSION SQL_MODE="" */ //
/*!50003 CREATE TRIGGER `trg2` BEFORE UPDATE ON `t1` FOR EACH ROW begin
if old.a % 2 = 0 then set new.b := 12; end if;
-end */;;
+end */ //
-/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
+/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */ //
/*!50003 CREATE TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW
begin
if new.a = -1 then
set @fired:= "Yes";
end if;
-end */;;
+end */ //
-DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
-DROP TABLE IF EXISTS `t2`;
+DELIMITER ;//
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -1906,18 +1905,17 @@
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
-DELIMITER ;;
-/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
+DELIMITER //;
+/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */ //
/*!50003 CREATE TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW
begin
if new.a > 10 then
set @fired:= "No";
end if;
-end */;;
+end */ //
-DELIMITER ;
+DELIMITER ;//
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
-
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
@@ -2079,37 +2077,37 @@
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
-DELIMITER ;;
-/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */;;
-/*!50003 SET SESSION SQL_MODE=""*/;;
+DELIMITER //
+/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */ //
+/*!50003 SET SESSION SQL_MODE=""*/ //
/*!50003 CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
-RETURN a+b */;;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
-/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */;;
-/*!50003 SET SESSION SQL_MODE=""*/;;
+RETURN a+b */ //
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/ //
+/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */ //
+/*!50003 SET SESSION SQL_MODE=""*/ //
/*!50003 CREATE FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1)
begin
set f1= concat( 'hello', f1 );
return f1;
-end */;;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
-/*!50003 DROP PROCEDURE IF EXISTS `a'b` */;;
-/*!50003 SET SESSION SQL_MODE="REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI"*/;;
+end */ //
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/ //
+/*!50003 DROP PROCEDURE IF EXISTS `a'b` */ //
+/*!50003 SET SESSION SQL_MODE="REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI"*/ //
/*!50003 CREATE PROCEDURE "a'b"()
-select 1 */;;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
-/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */;;
-/*!50003 SET SESSION SQL_MODE=""*/;;
+select 1 */ //
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/ //
+/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */ //
+/*!50003 SET SESSION SQL_MODE=""*/ //
/*!50003 CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
-BEGIN SELECT a+b INTO c; end */;;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
-/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */;;
-/*!50003 SET SESSION SQL_MODE=""*/;;
+BEGIN SELECT a+b INTO c; end */ //
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/ //
+/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */ //
+/*!50003 SET SESSION SQL_MODE=""*/ //
/*!50003 CREATE PROCEDURE `bug9056_proc2`(OUT a INT)
BEGIN
select sum(id) from t1 into a;
-END */;;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
+END */ //
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/ //
DELIMITER ;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
--- 1.63/strings/decimal.c 2005-10-08 01:48:58 +02:00
+++ 1.64/strings/decimal.c 2005-10-12 17:18:10 +02:00
@@ -2018,7 +2018,7 @@
if (to->buf < buf1)
{
dec1 *cur_d= to->buf;
- for (; d_to_move--; cur_d++, buf1++)
+ for (; d_to_move; d_to_move--, cur_d++, buf1++)
*cur_d= *buf1;
}
return error;
--- 1.7/config/ac-macros/yassl.m4 2005-10-12 10:17:29 +02:00
+++ 1.8/config/ac-macros/yassl.m4 2005-10-12 17:17:52 +02:00
@@ -20,7 +20,7 @@
-L\$(top_builddir)/extra/yassl/taocrypt/src -ltaocrypt"
openssl_includes="-I\$(top_srcdir)/extra/yassl/include"
AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
- AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
+
# System specific checks
yassl_integer_extra_cxxflags=""
case $host_cpu--$CXX_VERSION in
--- 1.31/BUILD/FINISH.sh 2005-10-12 15:36:09 +02:00
+++ 1.32/BUILD/FINISH.sh 2005-10-12 17:17:51 +02:00
@@ -13,7 +13,7 @@
if [ -z "$just_clean" ]
then
commands="$commands
-CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" \
+CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" \
$configure"
fi
--- 1.48/BUILD/SETUP.sh 2005-10-12 15:36:09 +02:00
+++ 1.49/BUILD/SETUP.sh 2005-10-12 17:17:51 +02:00
@@ -104,10 +104,6 @@
make=make
fi
-if test -z "$CC" ; then
- CC=gcc
-fi
-
if test -z "$CXX" ; then
CXX=gcc
fi
--- 1.6/sql/sql_manager.cc 2005-10-11 23:59:47 +02:00
+++ 1.7/sql/sql_manager.cc 2005-10-12 17:17:54 +02:00
@@ -58,14 +58,12 @@
set_timespec(abstime, flush_time);
reset_flush_time = FALSE;
}
- while (!manager_status && (!error || error == EINTR) && !abort_loop)
- error= pthread_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);
+ while (!manager_status && !error && !abort_loop)
+ error = pthread_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);
}
else
- {
- while (!manager_status && (!error || error == EINTR) && !abort_loop)
- error= pthread_cond_wait(&COND_manager, &LOCK_manager);
- }
+ while (!manager_status && !error && !abort_loop)
+ error = pthread_cond_wait(&COND_manager, &LOCK_manager);
status = manager_status;
manager_status = 0;
pthread_mutex_unlock(&LOCK_manager);
@@ -73,7 +71,7 @@
if (abort_loop)
break;
- if (error == ETIMEDOUT || error == ETIME)
+ if (error) /* == ETIMEDOUT */
{
flush_tables();
error = 0;
--- 1.24/storage/ndb/tools/Makefile.am 2005-10-12 16:21:02 +02:00
+++ 1.25/storage/ndb/tools/Makefile.am 2005-10-12 17:18:09 +02:00
@@ -33,7 +33,7 @@
restore/Restore.cpp \
../test/src/NDBT_ResultRow.cpp $(tools_common_sources)
-ndb_config_SOURCES = ndb_config.cpp \
+ndb_config_SOURCES = ndb_condig.cpp \
../src/mgmsrv/Config.cpp \
../src/mgmsrv/ConfigInfo.cpp \
../src/mgmsrv/InitConfigFileParser.cpp
--- 1.152/sql/sql_prepare.cc 2005-10-12 15:36:15 +02:00
+++ 1.153/sql/sql_prepare.cc 2005-10-12 17:17:55 +02:00
@@ -101,11 +101,6 @@
class Prepared_statement: public Statement
{
public:
- enum flag_values
- {
- IS_IN_USE= 1
- };
-
THD *thd;
Select_fetch_protocol_prep result;
Protocol *protocol;
@@ -136,8 +131,19 @@
bool execute(String *expanded_query, bool open_cursor);
/* Destroy this statement */
bool deallocate();
+
+ /* Possible values of flags */
+#if defined(_MSC_VER) && _MSC_VER < 1300
+ static const int IS_IN_USE;
+#else
+ static const int IS_IN_USE= 1;
+#endif
};
+/* VC6 can't handle initializing in declaration */
+#if defined(_MSC_VER) && _MSC_VER < 1300
+const int Prepared_statement::IS_IN_USE= 1;
+#endif
/******************************************************************************
Implementation
@@ -1824,7 +1830,7 @@
void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
{
Prepared_statement *stmt= new Prepared_statement(thd, &thd->protocol_prep);
- bool error;
+ bool rc;
DBUG_ENTER("mysql_stmt_prepare");
DBUG_PRINT("prep_query", ("%s", packet));
@@ -1847,12 +1853,12 @@
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
- error= stmt->prepare(packet, packet_length);
+ rc= stmt->prepare(packet, packet_length);
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),WAIT_PRIOR);
- if (error)
+ if (rc)
{
/* Statement map deletes statement on erase */
thd->stmt_map.erase(stmt);
@@ -1894,7 +1900,7 @@
CHARSET_INFO *to_cs= thd->variables.collation_connection;
bool needs_conversion;
user_var_entry *entry;
- String *var_value= &str;
+ String *pstr= &str;
uint32 unused, len;
/*
Convert @var contents to string in connection character set. Although
@@ -1908,13 +1914,13 @@
&& entry->value)
{
my_bool is_var_null;
- var_value= entry->val_str(&is_var_null, &str, NOT_FIXED_DEC);
+ pstr= entry->val_str(&is_var_null, &str, NOT_FIXED_DEC);
/*
NULL value of variable checked early as entry->value so here
we can't get NULL in normal conditions
*/
DBUG_ASSERT(!is_var_null);
- if (!var_value)
+ if (!pstr)
goto end;
}
else
@@ -1926,25 +1932,22 @@
str.set("NULL", 4, &my_charset_latin1);
}
- needs_conversion= String::needs_conversion(var_value->length(),
- var_value->charset(), to_cs,
- &unused);
+ needs_conversion= String::needs_conversion(pstr->length(),
+ pstr->charset(), to_cs, &unused);
- len= (needs_conversion ? var_value->length() * to_cs->mbmaxlen :
- var_value->length());
+ len= needs_conversion ? pstr->length() * to_cs->mbmaxlen : pstr->length();
if (!(query_str= alloc_root(thd->mem_root, len+1)))
goto end;
if (needs_conversion)
{
uint dummy_errors;
- len= copy_and_convert(query_str, len, to_cs, var_value->ptr(),
- var_value->length(), var_value->charset(),
- &dummy_errors);
+ len= copy_and_convert(query_str, len, to_cs, pstr->ptr(), pstr->length(),
+ pstr->charset(), &dummy_errors);
}
else
- memcpy(query_str, var_value->ptr(), var_value->length());
- query_str[len]= '\0'; // Safety (mostly for debug)
+ memcpy(query_str, pstr->ptr(), pstr->length());
+ query_str[len]= '\0';
*query_len= len;
}
else
@@ -1994,9 +1997,10 @@
Prepared_statement *stmt;
const char *query;
uint query_len;
+
DBUG_ENTER("mysql_sql_stmt_prepare");
- DBUG_ASSERT(thd->protocol == &thd->protocol_simple);
+ DBUG_ASSERT(thd->protocol == &thd->protocol_simple);
if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
{
/*
@@ -2178,7 +2182,7 @@
uchar *packet_end= (uchar *) packet + packet_length - 1;
#endif
Prepared_statement *stmt;
- bool error;
+ bool rc;
DBUG_ENTER("mysql_stmt_execute");
packet+= 9; /* stmt_id + 5 bytes of flags */
@@ -2213,11 +2217,12 @@
#endif
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
- error= stmt->execute(&expanded_query,
- test(flags & (ulong) CURSOR_TYPE_READ_ONLY));
+ rc= stmt->execute(&expanded_query,
+ test(flags & (ulong) CURSOR_TYPE_READ_ONLY));
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
- if (error == 0)
+
+ if (rc == 0)
mysql_log.write(thd, COM_STMT_EXECUTE, "[%lu] %s", stmt->id, thd->query);
DBUG_VOID_RETURN;
@@ -2256,7 +2261,9 @@
LEX_STRING *name= &lex->prepared_stmt_name;
/* Query text for binary, general or slow log, if any of them is open */
String expanded_query;
+
DBUG_ENTER("mysql_sql_stmt_execute");
+
DBUG_PRINT("info", ("EXECUTE: %.*s\n", name->length, name->str));
if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
@@ -2401,6 +2408,7 @@
/* There is always space for 4 bytes in packet buffer */
ulong stmt_id= uint4korr(packet);
Prepared_statement *stmt;
+
DBUG_ENTER("mysql_stmt_close");
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close")))
@@ -2410,7 +2418,7 @@
The only way currently a statement can be deallocated when it's
in use is from within Dynamic SQL.
*/
- DBUG_ASSERT(! (stmt->flags & (uint) Prepared_statement::IS_IN_USE));
+ DBUG_ASSERT(! (stmt->flags & Prepared_statement::IS_IN_USE));
(void) stmt->deallocate();
DBUG_VOID_RETURN;
@@ -2454,7 +2462,7 @@
mysql_stmt_get_longdata()
thd Thread handle
packet String to append
- packet_length Length of string (including end \0)
+ packet_length Length of string
DESCRIPTION
Get a part of a long data. To make the protocol efficient, we are
@@ -2471,12 +2479,13 @@
Prepared_statement *stmt;
Item_param *param;
char *packet_end= packet + packet_length - 1;
+
DBUG_ENTER("mysql_stmt_get_longdata");
statistic_increment(thd->status_var.com_stmt_send_long_data, &LOCK_status);
#ifndef EMBEDDED_LIBRARY
/* Minimal size of long data packet is 6 bytes */
- if (packet_length <= MYSQL_LONG_DATA_HEADER)
+ if ((ulong) (packet_end - packet) < MYSQL_LONG_DATA_HEADER)
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_send_long_data");
DBUG_VOID_RETURN;
@@ -2583,7 +2592,7 @@
param_array(0),
param_count(0),
last_errno(0),
- flags((uint) IS_IN_USE)
+ flags(IS_IN_USE)
{
*last_error= '\0';
}
@@ -2700,7 +2709,7 @@
bool Prepared_statement::prepare(const char *packet, uint packet_len)
{
- bool error;
+ bool rc;
Statement stmt_backup;
Query_arena *old_stmt_arena;
DBUG_ENTER("Prepared_statement::prepare");
@@ -2730,7 +2739,7 @@
lex_start(thd, (uchar*) thd->query, thd->query_length);
lex->stmt_prepare_mode= TRUE;
- error= yyparse((void *)thd) || thd->is_fatal_error ||
+ rc= yyparse((void *)thd) || thd->is_fatal_error ||
thd->net.report_error || init_param_array(this);
lex->safe_to_cache_query= FALSE;
/*
@@ -2755,10 +2764,10 @@
*/
DBUG_ASSERT(thd->free_list == NULL);
- if (error == 0)
- error= check_prepared_statement(this, name.str != 0);
+ if (rc == 0)
+ rc= check_prepared_statement(this, name.str != 0);
- if (error && lex->sphead)
+ if (rc && lex->sphead)
{
delete lex->sphead;
lex->sphead= NULL;
@@ -2768,14 +2777,14 @@
thd->restore_backup_statement(this, &stmt_backup);
thd->stmt_arena= old_stmt_arena;
- if (error == 0)
+ if (rc == 0)
{
setup_set_params();
init_stmt_after_parse(lex);
state= Query_arena::PREPARED;
- flags&= ~ (uint) IS_IN_USE;
+ flags&= ~IS_IN_USE;
}
- DBUG_RETURN(error);
+ DBUG_RETURN(rc);
}
/*
@@ -2797,10 +2806,6 @@
Preconditions, postconditions.
------------------------------
See the comment for Prepared_statement::prepare().
-
- RETURN
- FALSE ok
- TRUE Error
*/
bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
@@ -2808,7 +2813,7 @@
Statement stmt_backup;
Query_arena *old_stmt_arena;
Item *old_free_list;
- bool error= TRUE;
+ bool rc= TRUE;
statistic_increment(thd->status_var.com_stmt_execute, &LOCK_status);
@@ -2818,7 +2823,7 @@
my_message(last_errno, last_error, MYF(0));
return TRUE;
}
- if (flags & (uint) IS_IN_USE)
+ if (flags & IS_IN_USE)
{
my_error(ER_PS_NO_RECURSION, MYF(0));
return TRUE;
@@ -2880,14 +2885,13 @@
reinit_stmt_before_use(thd, lex);
thd->protocol= protocol; /* activate stmt protocol */
- error= (open_cursor ?
- mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR,
- &result, &cursor) :
- mysql_execute_command(thd));
+ rc= open_cursor ? mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR,
+ &result, &cursor) :
+ mysql_execute_command(thd);
thd->protocol= &thd->protocol_simple; /* use normal protocol */
/* Assert that if an error, no cursor is open */
- DBUG_ASSERT(! (error && cursor));
+ DBUG_ASSERT(! (rc && cursor));
if (! cursor)
{
@@ -2902,8 +2906,8 @@
state= Query_arena::EXECUTED;
error:
- flags&= ~ (uint) IS_IN_USE;
- return error;
+ flags&= ~IS_IN_USE;
+ return rc;
}
@@ -2913,7 +2917,7 @@
{
/* We account deallocate in the same manner as mysql_stmt_close */
statistic_increment(thd->status_var.com_stmt_close, &LOCK_status);
- if (flags & (uint) IS_IN_USE)
+ if (flags & IS_IN_USE)
{
my_error(ER_PS_NO_RECURSION, MYF(0));
return TRUE;
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.1929) | tomas | 12 Oct |