Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.1
This commit is contained in:
tomas@poseidon.ndb.mysql.com 2005-07-13 13:11:51 +02:00
commit 1affa6182a
22 changed files with 160 additions and 32 deletions

View file

@ -76,8 +76,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib ..\extra\yassl\Release\yassl.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib ..\extra\yassl\Release\yassl.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib ..\extra\yassl\Release\yassl.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib ..\extra\yassl\Release\yassl.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
!ENDIF

View file

@ -830,7 +830,7 @@ typedef off_t os_off_t;
#define socket_errno WSAGetLastError()
#define SOCKET_EINTR WSAEINTR
#define SOCKET_EAGAIN WSAEINPROGRESS
#define SOCKET_EWOULDBLOCK WSAEINPROGRESS
#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#elif defined(OS2)

View file

@ -287,6 +287,7 @@ sub executable_setup ();
sub environment_setup ();
sub kill_running_server ();
sub kill_and_cleanup ();
sub ndbcluster_support ();
sub ndbcluster_install ();
sub ndbcluster_start ();
sub ndbcluster_stop ();
@ -319,6 +320,12 @@ sub main () {
initial_setup();
command_line_setup();
executable_setup();
if (! $opt_skip_ndbcluster and ! $opt_with_ndbcluster)
{
$opt_with_ndbcluster= ndbcluster_support();
}
environment_setup();
signal_setup();
@ -1026,6 +1033,23 @@ sub kill_and_cleanup () {
#
##############################################################################
sub ndbcluster_support () {
# check ndbcluster support by testing using a switch
# that is only available in that case
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--ndb-use-exact-count",
"--help"],
"", "/dev/null", "/dev/null", "") != 0 )
{
mtr_report("No ndbcluster support");
return 0;
}
mtr_report("Has ndbcluster support");
return 1;
}
# FIXME why is there a different start below?!
sub ndbcluster_install () {

View file

@ -0,0 +1,3 @@
select des_encrypt('hello');
des_encrypt('hello')
€Ö2nV“Ø}

View file

@ -674,7 +674,7 @@ Database Table In_use Name_locked
mysql user 0 0
show status where variable_name like "%database%";
Variable_name Value
Com_show_databases 0
Com_show_databases 3
show variables where variable_name like "skip_show_databas";
Variable_name Value
show global status like "Threads_running";

View file

@ -149,13 +149,13 @@ v5 VIEW
v6 VIEW
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 5 9 45 2533274790395903 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
v2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
v3 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
v4 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
v5 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
v6 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
t1 MyISAM 10 Fixed 5 9 45 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
v2 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
v3 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
v4 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
v5 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
v6 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
drop view v1,v2,v3,v4,v5,v6;
create view v1 (c,d,e,f) as select a,b,
a in (select a+2 from t1), a = all (select a from t1) from t1;
@ -1945,9 +1945,24 @@ ALTER VIEW v1 AS SELECT s1 AS s1, s2 AS s2 FROM t1;
CALL p1();
s1 s2
1 2
DROP VIEW v1;
CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1;
CALL p1();
s1 s2
2 1
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
create table t1 (f1 int, f2 int);
create view v1 as select f1 as f3, f2 as f1 from t1;
insert into t1 values (1,3),(2,1),(3,2);
select * from v1 order by f1;
f3 f1
2 1
3 2
1 3
drop view v1;
drop table t1;
CREATE TABLE t1 (f1 char) ENGINE = innodb;
INSERT INTO t1 VALUES ('A');
CREATE VIEW v1 AS SELECT * FROM t1;

View file

@ -0,0 +1,9 @@
-- source include/have_openssl.inc
# This test can't be in func_encrypt.test, because it requires
# --des-key-file to not be set.
#
# Bug #11643: des_encrypt() causes server to die
#
select des_encrypt('hello');

View file

@ -83,8 +83,7 @@ explain extended select c from v6;
# show table/table status test
show tables;
show full tables;
--replace_column 12 # 13 #
--replace_result 2147483647 38654705663
--replace_column 8 # 12 # 13 #
show table status;
drop view v1,v2,v3,v4,v5,v6;
@ -1784,11 +1783,24 @@ CREATE PROCEDURE p1 () SELECT * FROM v1;
CALL p1();
ALTER VIEW v1 AS SELECT s1 AS s1, s2 AS s2 FROM t1;
CALL p1();
DROP VIEW v1;
CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1;
CALL p1();
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
#
# Test for bug #11709 View was ordered by wrong column
#
create table t1 (f1 int, f2 int);
create view v1 as select f1 as f3, f2 as f1 from t1;
insert into t1 values (1,3),(2,1),(3,2);
select * from v1 order by f1;
drop view v1;
drop table t1;
#
# Test for bug #11771: wrong query_id in SELECT * FROM <view>
#

View file

@ -22,7 +22,17 @@
struct st_des_keyschedule des_keyschedule[10];
uint des_default_key;
pthread_mutex_t LOCK_des_key_file;
static int initialized;
static int initialized= 0;
void
init_des_key_file()
{
if (!initialized)
{
initialized=1;
pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
}
}
/*
Function which loads DES keys from plaintext file into memory on MySQL
@ -45,11 +55,7 @@ load_des_key_file(const char *file_name)
DBUG_ENTER("load_des_key_file");
DBUG_PRINT("enter",("name: %s",file_name));
if (!initialized)
{
initialized=1;
pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
}
init_des_key_file();
VOID(pthread_mutex_lock(&LOCK_des_key_file));
if ((file=my_open(file_name,O_RDONLY | O_BINARY ,MYF(MY_WME))) < 0 ||

View file

@ -4504,6 +4504,35 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
return Item_direct_ref::fix_fields(thd, reference);
}
/*
Compare view field's name with item's name before call to referenced
item's eq()
SYNOPSIS
Item_direct_view_ref::eq()
item item to compare with
binary_cmp make binary comparison
DESCRIPTION
Consider queries:
create view v1 as select t1.f1 as f2, t1.f2 as f1 from t1;
select * from v1 order by f1;
In order to choose right field for sorting we need to compare
given item's name (f1) to view field's name prior to calling
referenced item's eq().
RETURN
TRUE Referenced item is equal to given item
FALSE otherwise
*/
bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
{
Item *it= ((Item *) item)->real_item();
return (!it->name || !my_strcasecmp(system_charset_info, it->name,
field_name)) && ref && (*ref)->real_item()->eq(it, binary_cmp);
}
void Item_null_helper::print(String *str)
{

View file

@ -1524,6 +1524,7 @@ public:
:Item_direct_ref(thd, item) {}
bool fix_fields(THD *, Item **);
bool eq(const Item *item, bool binary_cmp) const;
};

View file

@ -378,6 +378,9 @@ String *Item_func_des_encrypt::val_str(String *str)
if (arg_count == 1)
{
/* Make sure LOCK_des_key_file was initialized. */
init_des_key_file();
/* Protect against someone doing FLUSH DES_KEY_FILE */
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number=des_default_key];
@ -388,6 +391,10 @@ String *Item_func_des_encrypt::val_str(String *str)
key_number= (uint) args[1]->val_int();
if (key_number > 9)
goto error;
/* Make sure LOCK_des_key_file was initialized. */
init_des_key_file();
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number];
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
@ -474,6 +481,10 @@ String *Item_func_des_decrypt::val_str(String *str)
// Check if automatic key and that we have privilege to uncompress using it
if (!(current_thd->master_access & SUPER_ACL) || key_number > 9)
goto error;
/* Make sure LOCK_des_key_file was initialized. */
init_des_key_file();
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number];
VOID(pthread_mutex_unlock(&LOCK_des_key_file));

View file

@ -1155,6 +1155,9 @@ int MYSQL_LOG::purge_logs(const char *to_log,
*/
if (my_stat(log_info.log_file_name,&s,MYF(0)))
file_size= s.st_size;
else
sql_print_information("Failed to execute my_stat on file '%s'",
log_info.log_file_name);
}
/*
It's not fatal if we can't delete a log file ;

View file

@ -786,6 +786,7 @@ extern char *des_key_file;
extern struct st_des_keyschedule des_keyschedule[10];
extern uint des_default_key;
extern pthread_mutex_t LOCK_des_key_file;
void init_des_key_file();
bool load_des_key_file(const char *file_name);
void free_des_key_file();
#endif /* HAVE_OPENSSL */

View file

@ -135,7 +135,7 @@ my_bool my_net_init(NET *net, Vio* vio)
if (vio != 0) /* If real connection */
{
net->fd = vio_fd(vio); /* For perl DBI/DBD */
#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
if (!(test_flags & TEST_BLOCKING))
{
my_bool old_mode;

View file

@ -1131,7 +1131,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
table_list= (table_list->belong_to_view ?
table_list->belong_to_view :
table_list);
view= (bool)(table_list->view);
view= test(table_list->view);
}
if (view)
{

View file

@ -2197,6 +2197,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
TABLE_LIST *table_list= (TABLE_LIST*) select_lex->table_list.first;
table_list->schema_select_lex= sel;
table_list->schema_table_reformed= 1;
statistic_increment(thd->status_var.com_stat[lex->orig_sql_command],
&LOCK_status);
DBUG_RETURN(0);
}
@ -2369,9 +2371,10 @@ mysql_execute_command(THD *thd)
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
DBUG_RETURN(-1);
}
if(lex->orig_sql_command == SQLCOM_END)
statistic_increment(thd->status_var.com_stat[lex->sql_command],
&LOCK_status);
statistic_increment(thd->status_var.com_stat[lex->sql_command],
&LOCK_status);
switch (lex->sql_command) {
case SQLCOM_SELECT:
{

View file

@ -1004,6 +1004,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
if (my_delete(path, MYF(MY_WME)))
goto err;
query_cache_invalidate3(thd, view, 0);
sp_cache_invalidate();
VOID(pthread_mutex_unlock(&LOCK_open));
}
send_ok(thd);

View file

@ -173,6 +173,14 @@ DIE_UNLESS(stmt == 0);\
#define mytest_r(x) if (x) {myerror(NULL);DIE_UNLESS(FALSE);}
/* A workaround for Sun Forte 5.6 on Solaris x86 */
static int cmp_double(double *a, double *b)
{
return *a == *b;
}
/* Print the error message */
static void print_error(const char *msg)
@ -1645,7 +1653,7 @@ static void test_prepare()
DIE_UNLESS(real_data == o_real_data);
DIE_UNLESS(length[5] == 4);
DIE_UNLESS(double_data == o_double_data);
DIE_UNLESS(cmp_double(&double_data, &o_double_data));
DIE_UNLESS(length[6] == 8);
DIE_UNLESS(strcmp(data, str_data) == 0);
@ -9858,7 +9866,7 @@ static void test_bug3035()
uint32 uint32_val;
longlong int64_val;
ulonglong uint64_val;
double double_val, udouble_val;
double double_val, udouble_val, double_tmp;
char longlong_as_string[22], ulonglong_as_string[22];
/* mins and maxes */
@ -10005,7 +10013,8 @@ static void test_bug3035()
DIE_UNLESS(int64_val == int64_min);
DIE_UNLESS(uint64_val == uint64_min);
DIE_UNLESS(double_val == (longlong) uint64_min);
DIE_UNLESS(udouble_val == ulonglong2double(uint64_val));
double_tmp= ulonglong2double(uint64_val);
DIE_UNLESS(cmp_double(&udouble_val, &double_tmp));
DIE_UNLESS(!strcmp(longlong_as_string, "0"));
DIE_UNLESS(!strcmp(ulonglong_as_string, "0"));
@ -10029,7 +10038,8 @@ static void test_bug3035()
DIE_UNLESS(int64_val == int64_max);
DIE_UNLESS(uint64_val == uint64_max);
DIE_UNLESS(double_val == (longlong) uint64_val);
DIE_UNLESS(udouble_val == ulonglong2double(uint64_val));
double_tmp= ulonglong2double(uint64_val);
DIE_UNLESS(cmp_double(&udouble_val, &double_tmp));
DIE_UNLESS(!strcmp(longlong_as_string, "-1"));
DIE_UNLESS(!strcmp(ulonglong_as_string, "18446744073709551615"));

View file

@ -143,7 +143,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags)
sprintf(vio->desc,
(vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
vio->sd);
#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
#if !defined(NO_FCNTL_NONBLOCK)
#if defined(__FreeBSD__)
fcntl(sd, F_SETFL, vio->fcntl_mode); /* Yahoo! FreeBSD patch */
@ -158,7 +158,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags)
{
/* set to blocking mode by default */
ulong arg=0, r;
r = ioctlsocket(sd,FIONBIO,(void*) &arg, sizeof(arg));
r = ioctlsocket(sd,FIONBIO,(void*) &arg);
vio->fcntl_mode &= ~O_NONBLOCK;
}
#endif

View file

@ -128,7 +128,7 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode,
DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d",
(int) set_blocking_mode, (int) *old_mode));
#if !defined(___WIN__) && !defined(__EMX__)
#if !defined(__WIN__) && !defined(__EMX__)
#if !defined(NO_FCNTL_NONBLOCK)
if (vio->sd >= 0)
{
@ -161,7 +161,7 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode,
vio->fcntl_mode |= O_NONBLOCK; /* set bit */
}
if (old_fcntl != vio->fcntl_mode)
r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg);
}
#ifndef __EMX__
else

View file

@ -134,7 +134,7 @@ unsigned short FAR *work;
left -= count[len];
if (left < 0) return -1; /* over-subscribed */
}
if (left > 0 && (type == CODES || (codes - count[0] != 1)))
if (left > 0 && (type == CODES || max != 1))
return -1; /* incomplete set */
/* generate offsets into symbol table for each length for sorting */