Commit df16b318 authored by unknown's avatar unknown

Merge sinisa@work.mysql.com:/home/bk/mysql-4.1

into sinisa.nasamreza.org:/mnt/work/mysql-4.1


sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
parents 3de4f875 e72ea354
......@@ -4334,7 +4334,7 @@ INSERT INTO Country VALUES ('SWZ','Swaziland','Africa','Southern Africa',17364.0
INSERT INTO Country VALUES ('CHE','Switzerland','Europe','Western Europe',41284.00,1499,7160400,79.6,264478.00,256092.00,'Schweiz/Suisse/Svizzera/Svizra','Federation','Adolf Ogi',3248,'CH');
INSERT INTO Country VALUES ('SYR','Syria','Asia','Middle East',185180.00,1941,16125000,68.5,65984.00,64926.00,'Suriya','Republic','Bashar al-Assad',3250,'SY');
INSERT INTO Country VALUES ('TJK','Tajikistan','Asia','Southern and Central Asia',143100.00,1991,6188000,64.1,1990.00,1056.00,'Toikiston','Republic','Emomali Rahmonov',3261,'TJ');
INSERT INTO Country VALUES ('TWN','Taiwan, Province of China','Asia','Eastern Asia',36188.00,1945,22256000,76.4,256254.00,263451.00,'Tai-wan','Republic','Chen Shui-bian',3263,'TW');
INSERT INTO Country VALUES ('TWN','Taiwan','Asia','Eastern Asia',36188.00,1945,22256000,76.4,256254.00,263451.00,'Tai-wan','Republic','Chen Shui-bian',3263,'TW');
INSERT INTO Country VALUES ('TZA','Tanzania','Africa','Eastern Africa',883749.00,1961,33517000,52.3,8005.00,7388.00,'Tanzania','Republic','Benjamin William Mkapa',3306,'TZ');
INSERT INTO Country VALUES ('DNK','Denmark','Europe','Nordic Countries',43094.00,800,5330000,76.5,174099.00,169264.00,'Danmark','Constitutional Monarchy','Margrethe II',3315,'DK');
INSERT INTO Country VALUES ('THA','Thailand','Asia','Southeast Asia',513115.00,1350,61399000,68.6,116416.00,153907.00,'Prathet Thai','Constitutional Monarchy','Bhumibol Adulyadej',3320,'TH');
......
......@@ -136,6 +136,10 @@ SOURCE="..\strings\ctype-latin1_de.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-simple.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-sjis.c"
# End Source File
# Begin Source File
......
#!/bin/sh
#
# Change linefeed -> return+linefeed for all VC++ project files
#
find . \( -name "*.dsp" -o -name "*.dsw" \) -print | grep -v "SCCS" | xargs replace '\r\$' ' ' '\$' ' ' --
......@@ -147,6 +147,10 @@ SOURCE="..\strings\ctype-latin1_de.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-simple.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-sjis.c"
# End Source File
# Begin Source File
......@@ -256,6 +260,7 @@ SOURCE=..\mysys\my_alloc.c
# Begin Source File
SOURCE=..\mysys\my_compress.c
# ADD CPP /I "../zlib"
# End Source File
# Begin Source File
......
......@@ -43,8 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FR /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FR /FD /mktyplib203 /win32 # ADD BASE MTL /c
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
......@@ -53,8 +52,7 @@ BSC32=bscmake.exe
# 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 /nologo /dll /machine:I386
# 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 Wsock32.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /dll /machine:I386 /out:"../lib_release/libmysqld.dll" /implib:"../lib_release/libmysqld.lib"
# SUBTRACT LINK32 /pdb:none
# 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 Wsock32.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib # SUBTRACT LINK32 /nologo /dll /pdb:none /machine:I386 /out:"../lib_release/libmysqld.dll" /implib:"../lib_release/libmysqld.lib"
!ELSEIF "$(CFG)" == "libmysqld - Win32 Debug"
......@@ -70,8 +68,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /mktyplib203 /win32 # ADD BASE MTL /c
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
......@@ -80,8 +77,7 @@ BSC32=bscmake.exe
# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
# 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 Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\innodb.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib:"LIBCMTD" /out:"../lib_debug/libmysqld.dll" /implib:"../lib_debug/libmysqld.lib" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# 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 Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\innodb.lib # SUBTRACT LINK32 /nologo /dll /pdb:none /debug /machine:I386 /nodefaultlib:"LIBCMTD" /out:"../lib_debug/libmysqld.dll" /implib:"../lib_debug/libmysqld.lib"
!ENDIF
......@@ -119,6 +115,10 @@ SOURCE=..\libmysql\get_password.c
# End Source File
# Begin Source File
SOURCE=..\sql\gstream.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\ha_berkeley.cpp
# End Source File
# Begin Source File
......@@ -176,6 +176,7 @@ SOURCE=..\sql\item_create.cpp
# Begin Source File
SOURCE=..\sql\item_func.cpp
# ADD CPP /I "../zlib"
# End Source File
# Begin Source File
......@@ -183,6 +184,10 @@ SOURCE=..\sql\item_strfunc.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\item_subselect.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\item_sum.cpp
# End Source File
# Begin Source File
......@@ -271,7 +276,7 @@ SOURCE=..\sql\set_var.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\slave.cpp
SOURCE=..\sql\spatial.cpp
# End Source File
# Begin Source File
......@@ -307,10 +312,18 @@ SOURCE=..\sql\sql_delete.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_derived.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_do.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_error.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_handler.cpp
# End Source File
# Begin Source File
......@@ -327,10 +340,6 @@ SOURCE=..\sql\sql_list.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_load.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_manager.cpp
# End Source File
# Begin Source File
......@@ -340,6 +349,10 @@ SOURCE=..\sql\sql_map.cpp
# Begin Source File
SOURCE=..\sql\sql_parse.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_prepare.cpp
# End Source File
# Begin Source File
......
......@@ -265,8 +265,28 @@ SOURCE=.\mi_write.c
# End Source File
# Begin Source File
SOURCE=.\rt_index.c
# End Source File
# Begin Source File
SOURCE=.\rt_key.c
# End Source File
# Begin Source File
SOURCE=.\rt_mbr.c
# End Source File
# Begin Source File
SOURCE=.\rt_split.c
# End Source File
# Begin Source File
SOURCE=.\sort.c
# End Source File
# Begin Source File
SOURCE=.\sp_key.c
# End Source File
# End Group
# Begin Group "Header Files"
......@@ -279,6 +299,10 @@ SOURCE=.\ft_eval.h
SOURCE=.\myisamdef.h
# End Source File
# Begin Source File
SOURCE=.\rt_index.h
# End Source File
# End Group
# End Target
# End Project
......@@ -326,6 +326,10 @@ SOURCE=.\my_getwd.c
# End Source File
# Begin Source File
SOURCE=.\my_handler.c
# End Source File
# Begin Source File
SOURCE=.\my_init.c
# End Source File
# Begin Source File
......
......@@ -282,6 +282,10 @@ SOURCE=.\filesort.cpp
# End Source File
# Begin Source File
SOURCE=.\gstream.cpp
# End Source File
# Begin Source File
SOURCE=.\ha_berkeley.cpp
# End Source File
# Begin Source File
......@@ -460,17 +464,25 @@ SOURCE=.\item_func.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"
# ADD CPP /I "../zlib"
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
# ADD CPP /G5
# ADD CPP /G5 /I "../zlib"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
# ADD CPP /I "../zlib"
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
# ADD CPP /I "../zlib"
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
# ADD CPP /I "../zlib"
!ENDIF
# End Source File
......@@ -496,6 +508,10 @@ SOURCE=.\item_strfunc.cpp
# End Source File
# Begin Source File
SOURCE=.\item_subselect.cpp
# End Source File
# Begin Source File
SOURCE=.\item_sum.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"
......@@ -811,6 +827,10 @@ SOURCE=.\slave.cpp
# End Source File
# Begin Source File
SOURCE=.\spatial.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_acl.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"
......@@ -927,10 +947,18 @@ SOURCE=.\sql_delete.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_derived.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_do.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_error.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_handler.cpp
# End Source File
# Begin Source File
......@@ -1059,6 +1087,10 @@ SOURCE=.\sql_parse.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_prepare.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_rename.cpp
# End Source File
# Begin Source File
......
......@@ -128,6 +128,10 @@ SOURCE=".\ctype-latin1_de.c"
# End Source File
# Begin Source File
SOURCE=".\ctype-simple.c"
# End Source File
# Begin Source File
SOURCE=".\ctype-sjis.c"
# End Source File
# Begin Source File
......
......@@ -91,8 +91,8 @@ extern "C" {
#define vidattr(A) {} // Can't get this to work
#endif
#ifdef __WIN__
#define cmp_database(A,B) my_strcasecmp((A),(B))
#ifdef FN_NO_CASE_SENCE
#define cmp_database(A,B) my_strcasecmp(system_charset_info, (A), (B))
#else
#define cmp_database(A,B) strcmp((A),(B))
#endif
......
......@@ -116,13 +116,11 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
SEARCH_FIND | SEARCH_SAME, &not_used))
{
error= 1;
DBUG_PRINT("error",("Record in wrong link: Link %d Record: %lx\n",
key, recpos));
DBUG_PRINT("error",("Record in wrong link: key: %d Record: %lx\n",
keynr, recpos));
}
else
{
found++;
}
key= tree_search_next(&keydef->rb_tree, &info->last_pos,
offsetof(TREE_ELEMENT, left),
offsetof(TREE_ELEMENT, right));
......@@ -130,7 +128,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
}
if (found != records)
{
DBUG_PRINT("error",("Found %ld of %ld records", found, records));
DBUG_PRINT("error",("Found %lu of %lu records", found, records));
error= 1;
}
if (print_status)
......
......@@ -275,7 +275,7 @@ my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
unsigned int STDCALL mysql_errno(MYSQL *mysql);
const char * STDCALL mysql_error(MYSQL *mysql);
uint STDCALL mysql_warning_count(MYSQL *mysql);
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char * STDCALL mysql_info(MYSQL *mysql);
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
const char * STDCALL mysql_character_set_name(MYSQL *mysql);
......@@ -427,7 +427,7 @@ typedef struct st_mysql_bind
/* The following are for internal use. Set by mysql_bind_param */
long bind_length; /* Default length of data */
my_bool long_ended; /* All data supplied for long */
uint param_number; /* For null count and error messages */
unsigned int param_number; /* For null count and error messages */
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
char *(*fetch_result)(struct st_mysql_bind *, const char *row);
} MYSQL_BIND;
......@@ -448,7 +448,7 @@ typedef struct st_mysql_stmt
unsigned long field_count; /* fields count */
unsigned long long_length; /* long buffer alloced length */
unsigned long stmt_id; /* Id for prepared statement */
uint last_errno; /* error code */
unsigned int last_errno; /* error code */
enum MY_STMT_STATE state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
my_bool long_alloced; /* flag to indicate long alloced */
......@@ -463,14 +463,14 @@ unsigned long STDCALL mysql_param_count(MYSQL_STMT * stmt);
my_bool STDCALL mysql_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bind);
my_bool STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bind);
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
uint STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
my_bool STDCALL mysql_commit(MYSQL * mysql);
my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
int STDCALL mysql_fetch(MYSQL_STMT *stmt);
my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt,
uint param_number,
unsigned int param_number,
const char *data,
unsigned long length,
my_bool last_data);
......
LIBRARY LIBMYSQL
DESCRIPTION 'MySQL 4.0 Client Library'
VERSION 5.0
DESCRIPTION 'MySQL 4.1 Client Library'
VERSION 6.0
EXPORTS
mysql_affected_rows
mysql_close
......@@ -59,7 +59,6 @@ EXPORTS
list_add
list_delete
max_allowed_packet
my_casecmp
my_init
my_end
my_strdup
......
select (select 2);
(select 2)
2
SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
2
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);
......@@ -50,9 +54,9 @@ explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 where used
2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using filesort
3 UNION t4 ALL NULL NULL NULL NULL 3 where used; Using filesort
4 SUBSELECT t2 ALL NULL NULL NULL NULL 2
2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using filesort
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
......@@ -159,9 +163,7 @@ UNIQUE KEY `email` (`email`)
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT
pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT
pseudo FROM inscrit WHERE pseudo='joce');
EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY inscrit const PRIMARY PRIMARY 35 const 1
4 SUBSELECT inscrit const PRIMARY PRIMARY 35 const 1
......@@ -179,3 +181,21 @@ joce
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
Subselect returns more than 1 record
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
drop table if exists searchconthardwarefr3;
CREATE TABLE `searchconthardwarefr3` (
`topic` mediumint(8) unsigned NOT NULL default '0',
`date` date NOT NULL default '0000-00-00',
`pseudo` varchar(35) character set latin1 NOT NULL default '',
PRIMARY KEY (`pseudo`,`date`,`topic`),
KEY `topic` (`topic`)
) TYPE=MyISAM ROW_FORMAT=DYNAMIC;
INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES
('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index
EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY No tables used
2 SUBSELECT searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index
drop table searchconthardwarefr3;
select (select 2);
SELECT (SELECT 1) UNION SELECT (SELECT 2);
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);
......@@ -82,9 +83,7 @@ CREATE TABLE `inscrit` (
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT
pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT
pseudo FROM inscrit WHERE pseudo='joce');
EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
-- error 1239
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo,email FROM
inscrit WHERE pseudo='joce');
......@@ -95,4 +94,18 @@ SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo
-- error 1240
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
\ No newline at end of file
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
drop table if exists searchconthardwarefr3;
CREATE TABLE `searchconthardwarefr3` (
`topic` mediumint(8) unsigned NOT NULL default '0',
`date` date NOT NULL default '0000-00-00',
`pseudo` varchar(35) character set latin1 NOT NULL default '',
PRIMARY KEY (`pseudo`,`date`,`topic`),
KEY `topic` (`topic`)
) TYPE=MyISAM ROW_FORMAT=DYNAMIC;
INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES
('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
drop table searchconthardwarefr3;
\ No newline at end of file
......@@ -3155,8 +3155,8 @@ innobase_drop_database(
memcpy(namebuf, ptr, len);
namebuf[len] = '/';
namebuf[len + 1] = '\0';
#ifdef __WIN__
casedn_str(namebuf);
#ifdef FN_NO_CASE_SENCE
my_casedn_str(system_charset_info, namebuf);
#endif
trx = trx_allocate_for_mysql();
......
......@@ -24,7 +24,6 @@ void unireg_init(ulong options)
{
uint i;
double nr;
CHARSET_INFO *cs;
DBUG_ENTER("unireg_init");
MYSYS_PROGRAM_DONT_USE_CURSES();
......
......@@ -152,9 +152,7 @@ String *Item_singleval_subselect::val_str (String *str)
assign_null();
return 0;
}
// Assign temporary buffer with stored value
str_value.set(string_value, 0, string_value.length());
return &str_value;
return &string_value;
}
Item_exists_subselect::Item_exists_subselect(THD *thd,
......
......@@ -973,7 +973,6 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
last_time=skr;
struct tm tm_tmp;
struct tm *start;
ulong length;
localtime_r(&skr,&tm_tmp);
start=&tm_tmp;
/* Note that my_b_write() assumes it knows the length for this */
......
......@@ -392,6 +392,8 @@ int mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &list,COND *conds,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex,
bool fake_select_lex);
void fix_tables_pointers(SELECT_LEX *select_lex);
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
select_result *result);
int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
select_result *result);
int mysql_union(THD *thd, LEX *lex,select_result *result);
......
......@@ -273,12 +273,12 @@ send_eof(THD *thd, bool no_flush)
{
if (!no_flush && (thd->client_capabilities & CLIENT_PROTOCOL_41))
{
char buff[5];
uchar buff[5];
uint tmp= min(thd->total_warn_count, 65535);
buff[0]=254;
int2store(buff+1, tmp);
int2store(buff+3, 0); // No flags yet
VOID(my_net_write(net,buff,5));
VOID(my_net_write(net,(char*) buff,5));
VOID(net_flush(net));
}
else
......
......@@ -69,7 +69,6 @@ static bool write_db_opt(const char *path, HA_CREATE_INFO *create)
error=0;
my_close(file,MYF(0));
}
exit:
return error;
}
......@@ -104,7 +103,7 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
IO_CACHE cache;
init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0));
while ((int) (nbytes= my_b_gets(&cache, (byte*) buf, sizeof(buf))) > 0)
while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
{
char *pos= buf+nbytes-1;
/* Remove end space and control characters */
......@@ -251,10 +250,8 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
{
char path[FN_REFLEN+16];
MY_DIR *dirp;
long result=1;
int error = 0;
register File file;
uint create_options = create_info ? create_info->options : 0;
DBUG_ENTER("mysql_alter_db");
......@@ -602,7 +599,7 @@ bool mysql_change_db(THD *thd, const char *name)
int mysqld_show_create_db(THD *thd, const char *dbname)
{
int length, db_length;
int length;
char path[FN_REFLEN], *to;
uint db_access;
bool found_libchar;
......
......@@ -955,6 +955,7 @@ void st_select_lex::init_query()
table_list.first= 0;
table_list.next= (byte**) &table_list.first;
item_list.empty();
join= 0;
}
void st_select_lex::init_select()
......@@ -973,7 +974,6 @@ void st_select_lex::init_select()
ftfunc_list= &ftfunc_list_alloc;
linkage= UNSPECIFIED_TYPE;
depended= having_fix_field= 0;
}
/*
......
......@@ -210,7 +210,7 @@ class st_select_lex_node {
SELECT_LEX_UNIT - unit of selects (UNION, INTERSECT, ...) group
SELECT_LEXs
*/
class st_lex;
struct st_lex;
class st_select_lex;
class THD;
class select_result;
......
......@@ -1287,6 +1287,7 @@ mysql_execute_command(THD *thd)
int res= 0;
LEX *lex= &thd->lex;
TABLE_LIST *tables= (TABLE_LIST*) lex->select_lex.table_list.first;
TABLE_LIST *cursor;
SELECT_LEX *select_lex= &lex->select_lex;
SELECT_LEX_UNIT *unit= &lex->unit;
DBUG_ENTER("mysql_execute_command");
......@@ -1343,7 +1344,7 @@ mysql_execute_command(THD *thd)
DBUG_VOID_RETURN;
}
//check rights
for (TABLE_LIST *cursor= tables;
for (cursor= tables;
cursor;
cursor= cursor->next)
if (cursor->derived)
......@@ -1361,7 +1362,7 @@ mysql_execute_command(THD *thd)
}
thd->send_explain_fields(explain_result);
// EXPLAIN derived tables
for (TABLE_LIST *cursor= tables;
for (cursor= tables;
cursor;
cursor= cursor->next)
if (cursor->derived)
......@@ -1468,24 +1469,7 @@ mysql_execute_command(THD *thd)
else
thd->send_explain_fields(explain_result);
fix_tables_pointers(select_lex);
for ( SELECT_LEX *sl= select_lex;
sl && res == 0;
sl= sl->next_select_in_list())
{
SELECT_LEX *first= sl->master_unit()->first_select();
res= mysql_explain_select(thd, sl,
((select_lex==sl)?
((sl->next_select_in_list())?"PRIMARY":
"SIMPLE"):
((sl == first)?
((sl->depended)?"DEPENDENT SUBSELECT":
"SUBSELECT"):
((sl->depended)?"DEPENDENT UNION":
"UNION"))),
explain_result);
}
if (res > 0)
res= -res; // mysql_explain_select do not report error
res= mysql_explain_union(thd, &thd->lex.unit, explain_result);
MYSQL_LOCK *save_lock= thd->lock;
thd->lock= (MYSQL_LOCK *)0;
explain_result->send_eof();
......
......@@ -634,7 +634,6 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
{
MEM_ROOT thd_root = thd->mem_root;
PREP_STMT stmt;
bool error;
DBUG_ENTER("mysql_stmt_prepare");
bzero((char*) &stmt, sizeof(stmt));
......
......@@ -171,7 +171,7 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
result->abort();
if (res || thd->net.report_error)
{
send_error(thd, 0, MYF(0));
send_error(thd, 0, NullS);
res= 1;
}
delete result;
......@@ -213,7 +213,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
SELECT_LEX_UNIT *unit, bool fake_select_lex)
{
DBUG_ENTER("JOIN::prepare");
conds= conds_init;
order= order_init;
group_list= group_init;
......@@ -348,7 +348,7 @@ int
JOIN::optimize()
{
DBUG_ENTER("JOIN::optimize");
#ifdef HAVE_REF_TO_FIELDS // Not done yet
/* Add HAVING to WHERE if possible */
if (having && !group_list && ! sum_func_count)
......@@ -1018,36 +1018,60 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex,
bool fake_select_lex)
{
JOIN *join = new JOIN(thd, fields, select_options, result);
DBUG_ENTER("mysql_select");
thd->proc_info="init";
thd->used_tables=0; // Updated by setup_fields
if (join->prepare(tables, conds, order, group, having, proc_param,
select_lex, unit, fake_select_lex))
bool free_join= 1;
JOIN *join;
if (!fake_select_lex && select_lex->join != 0)
{
DBUG_RETURN(-1);
//here is EXPLAIN of subselect or derived table
join= select_lex->join;
join->result= result;
if (!join->procedure && result->prepare(join->fields_list, unit))
{
DBUG_RETURN(-1);
}
join->select_options= select_options;
free_join= 0;
}
switch (join->optimize()) {
else
{
join= new JOIN(thd, fields, select_options, result);
thd->proc_info="init";
thd->used_tables=0; // Updated by setup_fields
if (join->prepare(tables, conds, order, group, having, proc_param,
select_lex, unit, fake_select_lex))
{
DBUG_RETURN(-1);
}
}
switch (join->optimize())
{
case 1:
DBUG_RETURN(join->error);
case -1:
goto err;
}
}
if (join->global_optimize())
if (free_join && join->global_optimize())
goto err;
join->exec();
err:
thd->limit_found_rows = join->send_records;
thd->examined_row_count = join->examined_rows;
thd->proc_info="end";
int error= (fake_select_lex?0:join->cleanup(thd)) || thd->net.report_error;
delete join;
DBUG_RETURN(error);
if (free_join)
{
thd->limit_found_rows = join->send_records;
thd->examined_row_count = join->examined_rows;
thd->proc_info="end";
int error= (fake_select_lex?0:join->cleanup(thd)) || thd->net.report_error;
delete join;
DBUG_RETURN(error);
}
else
DBUG_RETURN(0);
}
/*****************************************************************************
......@@ -3605,6 +3629,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case Item::COND_ITEM:
case Item::FIELD_AVG_ITEM:
case Item::FIELD_STD_ITEM:
case Item::SUBSELECT_ITEM:
/* The following can only happen with 'CREATE TABLE ... SELECT' */
case Item::INT_ITEM:
case Item::REAL_ITEM:
......@@ -7176,7 +7201,6 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
bool distinct,const char *message)
{
List<Item> field_list;
Item *item;
List<Item> item_list;
THD *thd=join->thd;
SELECT_LEX *select_lex = &(join->thd->lex.select_lex);
......@@ -7190,7 +7214,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if (message)
{
item_list.push_back(new Item_int((int)thd->lex.select->select_number));
item_list.push_back(new Item_int((int32) thd->lex.select->select_number));
item_list.push_back(new Item_string(thd->lex.select->type,
strlen(thd->lex.select->type),
default_charset_info));
......@@ -7217,7 +7241,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
tmp2.length(0);
item_list.empty();
item_list.push_back(new Item_int((int)thd->lex.select->select_number));
item_list.push_back(new Item_int((int32) thd->lex.select->select_number));
item_list.push_back(new Item_string(thd->lex.select->type,
strlen(thd->lex.select->type),
default_charset_info));
......@@ -7365,9 +7389,43 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
result->send_error(0,NullS);
}
}
for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit();
unit;
unit= unit->next_unit())
{
if (mysql_explain_union(thd, unit, result))
DBUG_VOID_RETURN;
}
DBUG_VOID_RETURN;
}
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
{
int res= 0;
SELECT_LEX *first= unit->first_select();
for (SELECT_LEX *sl= first;
sl;
sl= sl->next_select())
{
res= mysql_explain_select(thd, sl,
(((&thd->lex.select_lex)==sl)?
((sl->next_select_in_list())?"PRIMARY":
"SIMPLE"):
((sl == first)?
((sl->depended)?"DEPENDENT SUBSELECT":
"SUBSELECT"):
((sl->depended)?"DEPENDENT UNION":
"UNION"))),
result);
if (res)
break;
}
if (res > 0)
res= -res; // mysql_explain_select do not report error
return res;
}
int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
select_result *result)
{
......
......@@ -230,7 +230,7 @@ int mysqld_show_table_types(THD *thd)
const char *option_name= show_comp_option_name[(int) *types->value];
if (*types->value == SHOW_OPTION_YES &&
!strcasecmp(default_type_name, types->type))
!my_strcasecmp(system_charset_info, default_type_name, types->type))
option_name= "DEFAULT";
net_store_data(packet, option_name);
net_store_data(packet, types->comment);
......@@ -1398,7 +1398,6 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
int mysqld_show_charsets(THD *thd, const char *wild)
{
uint i;
char buff[8192];
String packet2(buff,sizeof(buff),default_charset_info);
List<Item> field_list;
......@@ -1425,7 +1424,7 @@ int mysqld_show_charsets(THD *thd, const char *wild)
net_store_data(&packet2,convert,cs[0]->name);
net_store_data(&packet2,(uint32) cs[0]->number);
net_store_data(&packet2,(uint32) cs[0]->strxfrm_multiply);
net_store_data(&packet2,(uint32) cs[0]->mbmaxlen ? cs[0]->mbmaxlen : 1);
net_store_data(&packet2,(uint32) (cs[0]->mbmaxlen ? cs[0]->mbmaxlen : 1));
if (my_net_write(&thd->net, (char*) packet2.ptr(),packet2.length()))
goto err;
......
......@@ -116,7 +116,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
TMP_TABLE_PARAM tmp_table_param;
this->thd= thd;
this->result= result;
SELECT_LEX *lex_select_save= thd->lex.select;
SELECT_LEX *lex_select_save= thd->lex.select, *sl;
/* Global option */
if (((void*)(global_parameters)) == ((void*)this))
......@@ -184,7 +184,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
// prepare selects
joins.empty();
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
for (sl= first_select(); sl; sl= sl->next_select())
{
JOIN *join= new JOIN(thd, sl->item_list,
sl->options | thd->options | SELECT_NO_UNLOCK |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment