Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into mc05.(none):/space2/tomas/mysql-4.1-ndb-test
This commit is contained in:
commit
22e39a53a9
@ -19,6 +19,7 @@ CFG=mysqlclient - Win32 Debug
|
|||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "mysqlclient - Win32 Release" (based on "Win32 (x86) Static Library")
|
!MESSAGE "mysqlclient - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE "mysqlclient - Win32 Debug" (based on "Win32 (x86) Static Library")
|
!MESSAGE "mysqlclient - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE "mysqlclient - Win32 authent" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
@ -76,12 +77,38 @@ LIB32=xilink6.exe -lib
|
|||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo /out:"..\lib_debug\mysqlclient.lib"
|
# ADD LIB32 /nologo /out:"..\lib_debug\mysqlclient.lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqlclient - Win32 authent"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "mysqlclient___Win32_authent"
|
||||||
|
# PROP BASE Intermediate_Dir "mysqlclient___Win32_authent"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "authent"
|
||||||
|
# PROP Intermediate_Dir "authent"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /D "NDEBUG" /FD /c
|
||||||
|
# SUBTRACT BASE CPP /YX
|
||||||
|
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /D "NDEBUG" /D "CHECK_LICENSE" /D LICENSE=Commercial /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x409
|
||||||
|
# ADD RSC /l 0x409
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=xilink6.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo /out:"..\lib_release\mysqlclient.lib"
|
||||||
|
# ADD LIB32 /nologo /out:"..\lib_authent\mysqlclient.lib"
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
|
||||||
# Name "mysqlclient - Win32 Release"
|
# Name "mysqlclient - Win32 Release"
|
||||||
# Name "mysqlclient - Win32 Debug"
|
# Name "mysqlclient - Win32 Debug"
|
||||||
|
# Name "mysqlclient - Win32 authent"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\mysys\array.c
|
SOURCE=..\mysys\array.c
|
||||||
@ -256,6 +283,8 @@ SOURCE=..\mysys\mf_iocache2.c
|
|||||||
|
|
||||||
# ADD CPP /Od
|
# ADD CPP /Od
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqlclient - Win32 authent"
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
|
9
VC++Files/examples/udf_example/udf_example.def
Normal file
9
VC++Files/examples/udf_example/udf_example.def
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
LIBRARY MYUDF
|
||||||
|
DESCRIPTION 'MySQL Sample for UDF'
|
||||||
|
VERSION 1.0
|
||||||
|
EXPORTS
|
||||||
|
metaphon
|
||||||
|
myfunc_double
|
||||||
|
myfunc_int
|
||||||
|
sequence
|
||||||
|
avgcost
|
111
VC++Files/examples/udf_example/udf_example.dsp
Normal file
111
VC++Files/examples/udf_example/udf_example.dsp
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="udf_example" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||||
|
|
||||||
|
CFG=udf_example - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "udf_example.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "udf_example.mak" CFG="udf_example - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "udf_example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
|
!MESSAGE "udf_example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "udf_example - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# 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 "UDF_EXAMPLE_EXPORTS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UDF_EXAMPLE_EXPORTS" /D "HAVE_DLOPEN" /YX /FD /c
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# ADD BASE RSC /l 0x416 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x416 /d "NDEBUG"
|
||||||
|
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 /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 ..\..\lib\opt\strings.lib /nologo /dll /machine:I386 /out:"Release/myudf.dll"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "udf_example - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# 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 "UDF_EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UDF_EXAMPLE_EXPORTS" /D "HAVE_DLOPEN" /YX /FD /GZ /c
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
# ADD BASE RSC /l 0x416 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x416 /d "_DEBUG"
|
||||||
|
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 /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 ..\..\lib\debug\strings.lib /nologo /dll /debug /machine:I386 /out:"Debug/myudf.dll" /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "udf_example - Win32 Release"
|
||||||
|
# Name "udf_example - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\udf_example.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\udf_example.def
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
29
VC++Files/examples/udf_example/udf_example.dsw
Normal file
29
VC++Files/examples/udf_example/udf_example.dsw
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "udf_example"=.\udf_example.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
@ -19,6 +19,7 @@ CFG=zlib - Win32 Debug
|
|||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "zlib - Win32 Release" (based on "Win32 (x86) Static Library")
|
!MESSAGE "zlib - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE "zlib - Win32 Debug" (based on "Win32 (x86) Static Library")
|
!MESSAGE "zlib - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE "zlib - Win32 authent" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
@ -75,12 +76,38 @@ LIB32=xilink6.exe -lib
|
|||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo /out:"..\lib_debug\zlib.lib"
|
# ADD LIB32 /nologo /out:"..\lib_debug\zlib.lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "zlib - Win32 authent"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "zlib___Win32_authent"
|
||||||
|
# PROP BASE Intermediate_Dir "zlib___Win32_authent"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "zlib___Win32_authent"
|
||||||
|
# PROP Intermediate_Dir "zlib___Win32_authent"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /D "DBUG_OFF" /D "_WINDOWS" /D "NDEBUG" /FD /c
|
||||||
|
# SUBTRACT BASE CPP /YX
|
||||||
|
# ADD CPP /nologo /G6 /MT /W3 /O2 /D "DBUG_OFF" /D "_WINDOWS" /D "NDEBUG" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x409
|
||||||
|
# ADD RSC /l 0x409
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=xilink6.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo /out:"..\lib_release\zlib.lib"
|
||||||
|
# ADD LIB32 /nologo /out:"..\lib_release\zlib.lib"
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
|
||||||
# Name "zlib - Win32 Release"
|
# Name "zlib - Win32 Release"
|
||||||
# Name "zlib - Win32 Debug"
|
# Name "zlib - Win32 Debug"
|
||||||
|
# Name "zlib - Win32 authent"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\adler32.c
|
SOURCE=.\adler32.c
|
||||||
|
@ -187,7 +187,7 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static char *subst_env_var(const char *cmd);
|
static char *subst_env_var(const char *cmd);
|
||||||
static int my_popen(const char *cmd, const char *mode);
|
static FILE *my_popen(const char *cmd, const char *mode);
|
||||||
#define popen(A,B) my_popen((A),(B))
|
#define popen(A,B) my_popen((A),(B))
|
||||||
#endif /* __NETWARE__ */
|
#endif /* __NETWARE__ */
|
||||||
|
|
||||||
@ -3710,6 +3710,7 @@ static void get_replace_column(struct st_query *q)
|
|||||||
static char *subst_env_var(const char *str)
|
static char *subst_env_var(const char *str)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
|
char *pos;
|
||||||
|
|
||||||
result= pos= my_malloc(MAX_QUERY, MYF(MY_FAE));
|
result= pos= my_malloc(MAX_QUERY, MYF(MY_FAE));
|
||||||
while (*str)
|
while (*str)
|
||||||
@ -3729,7 +3730,7 @@ static char *subst_env_var(const char *str)
|
|||||||
*str && !isspace(*str) && *str != '\\' && *str != '/' &&
|
*str && !isspace(*str) && *str != '\\' && *str != '/' &&
|
||||||
*str != '$';
|
*str != '$';
|
||||||
str++)
|
str++)
|
||||||
*env_pos++ *str;
|
*env_pos++= *str;
|
||||||
*env_pos= 0;
|
*env_pos= 0;
|
||||||
|
|
||||||
if (!(subst= getenv(env_var)))
|
if (!(subst= getenv(env_var)))
|
||||||
@ -3772,11 +3773,11 @@ static char *subst_env_var(const char *str)
|
|||||||
|
|
||||||
#undef popen /* Remove wrapper */
|
#undef popen /* Remove wrapper */
|
||||||
|
|
||||||
int my_popen(const char *cmd, const char *mode __attribute__((unused)) t)
|
FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
|
||||||
{
|
{
|
||||||
char *subst_cmd;
|
char *subst_cmd;
|
||||||
int res_file;
|
FILE *res_file;
|
||||||
|
|
||||||
subst_cmd= subst_env_var(cmd);
|
subst_cmd= subst_env_var(cmd);
|
||||||
res_file= popen(subst_cmd, "r0");
|
res_file= popen(subst_cmd, "r0");
|
||||||
my_free(subst_cmd, MYF(0));
|
my_free(subst_cmd, MYF(0));
|
||||||
|
@ -767,7 +767,14 @@ AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
|
|||||||
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
|
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
|
||||||
|
|
||||||
# For compress in zlib
|
# For compress in zlib
|
||||||
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
|
case $SYSTEM_TYPE in
|
||||||
|
*netware*)
|
||||||
|
AC_DEFINE(HAVE_COMPRESS)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Check for TCP wrapper support
|
# Check for TCP wrapper support
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
better compression
|
better compression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* these two are for uniformity */
|
||||||
|
#define mi_sint1korr(A) (int8)(*A)
|
||||||
|
#define mi_uint1korr(A) (uint8)(*A)
|
||||||
|
|
||||||
#define mi_sint2korr(A) (int16) (((int16) ((uchar) (A)[1])) +\
|
#define mi_sint2korr(A) (int16) (((int16) ((uchar) (A)[1])) +\
|
||||||
((int16) ((int16) (A)[0]) << 8))
|
((int16) ((int16) (A)[0]) << 8))
|
||||||
#define mi_sint3korr(A) ((int32) ((((uchar) (A)[0]) & 128) ? \
|
#define mi_sint3korr(A) ((int32) ((((uchar) (A)[0]) & 128) ? \
|
||||||
@ -75,6 +79,9 @@
|
|||||||
(((uint32) ((uchar) (A)[0])) << 24))) <<\
|
(((uint32) ((uchar) (A)[0])) << 24))) <<\
|
||||||
32))
|
32))
|
||||||
|
|
||||||
|
/* This one is for uniformity */
|
||||||
|
#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A)
|
||||||
|
|
||||||
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
|
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
|
||||||
*((uchar*) ((T)+1))= (uchar)(def_temp); \
|
*((uchar*) ((T)+1))= (uchar)(def_temp); \
|
||||||
*((uchar*) ((T)+0))= (uchar)(def_temp >> 8); }
|
*((uchar*) ((T)+0))= (uchar)(def_temp >> 8); }
|
||||||
|
@ -336,7 +336,7 @@ typedef struct st_mysql_parameters
|
|||||||
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
|
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
|
||||||
void STDCALL mysql_server_end(void);
|
void STDCALL mysql_server_end(void);
|
||||||
|
|
||||||
MYSQL_PARAMETERS *STDCALL mysql_get_parameters();
|
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set up and bring down a thread; these function should be called
|
Set up and bring down a thread; these function should be called
|
||||||
|
@ -681,7 +681,7 @@ dict_init(void)
|
|||||||
rw_lock_create(&dict_operation_lock);
|
rw_lock_create(&dict_operation_lock);
|
||||||
rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION);
|
rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION);
|
||||||
|
|
||||||
dict_foreign_err_file = tmpfile();
|
dict_foreign_err_file = os_file_create_tmpfile();
|
||||||
mutex_create(&dict_foreign_err_mutex);
|
mutex_create(&dict_foreign_err_mutex);
|
||||||
mutex_set_level(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
|
mutex_set_level(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
|
||||||
}
|
}
|
||||||
|
@ -2573,7 +2573,7 @@ fil_load_single_table_tablespace(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: could not open single-table tablespace file\n"
|
"InnoDB: Error: could not open single-table tablespace file\n"
|
||||||
"InnoDB: %s!\n"
|
"InnoDB: %s!\n"
|
||||||
"InnoDB: We do no continue crash recovery, because the table will become\n"
|
"InnoDB: We do not continue crash recovery, because the table will become\n"
|
||||||
"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
|
"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
|
||||||
"InnoDB: To fix the problem and start mysqld:\n"
|
"InnoDB: To fix the problem and start mysqld:\n"
|
||||||
"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
|
"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
|
||||||
@ -2607,7 +2607,7 @@ fil_load_single_table_tablespace(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: could not measure the size of single-table tablespace file\n"
|
"InnoDB: Error: could not measure the size of single-table tablespace file\n"
|
||||||
"InnoDB: %s!\n"
|
"InnoDB: %s!\n"
|
||||||
"InnoDB: We do no continue crash recovery, because the table will become\n"
|
"InnoDB: We do not continue crash recovery, because the table will become\n"
|
||||||
"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
|
"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
|
||||||
"InnoDB: To fix the problem and start mysqld:\n"
|
"InnoDB: To fix the problem and start mysqld:\n"
|
||||||
"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
|
"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
|
||||||
|
@ -169,6 +169,13 @@ void
|
|||||||
os_io_init_simple(void);
|
os_io_init_simple(void);
|
||||||
/*===================*/
|
/*===================*/
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
Creates a temporary file. In case of error, causes abnormal termination. */
|
||||||
|
|
||||||
|
FILE*
|
||||||
|
os_file_create_tmpfile(void);
|
||||||
|
/*========================*/
|
||||||
|
/* out: temporary file handle (never NULL) */
|
||||||
|
/***************************************************************************
|
||||||
The os_file_opendir() function opens a directory stream corresponding to the
|
The os_file_opendir() function opens a directory stream corresponding to the
|
||||||
directory named by the dirname argument. The directory stream is positioned
|
directory named by the dirname argument. The directory stream is positioned
|
||||||
at the first entry. In both Unix and Windows we automatically skip the '.'
|
at the first entry. In both Unix and Windows we automatically skip the '.'
|
||||||
|
@ -558,6 +558,9 @@ struct row_prebuilt_struct {
|
|||||||
dtuple_t* clust_ref; /* prebuilt dtuple used in
|
dtuple_t* clust_ref; /* prebuilt dtuple used in
|
||||||
sel/upd/del */
|
sel/upd/del */
|
||||||
ulint select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */
|
ulint select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */
|
||||||
|
ulint stored_select_lock_type;/* inside LOCK TABLES, either
|
||||||
|
LOCK_S or LOCK_X depending on the lock
|
||||||
|
type */
|
||||||
ulint mysql_row_len; /* length in bytes of a row in the
|
ulint mysql_row_len; /* length in bytes of a row in the
|
||||||
MySQL format */
|
MySQL format */
|
||||||
ulint n_rows_fetched; /* number of rows fetched after
|
ulint n_rows_fetched; /* number of rows fetched after
|
||||||
|
@ -510,7 +510,7 @@ lock_sys_create(
|
|||||||
|
|
||||||
/* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */
|
/* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */
|
||||||
|
|
||||||
lock_latest_err_file = tmpfile();
|
lock_latest_err_file = os_file_create_tmpfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -311,14 +311,11 @@ os_file_handle_error(
|
|||||||
/*=================*/
|
/*=================*/
|
||||||
/* out: TRUE if we should retry the
|
/* out: TRUE if we should retry the
|
||||||
operation */
|
operation */
|
||||||
os_file_t file, /* in: file pointer */
|
|
||||||
const char* name, /* in: name of a file or NULL */
|
const char* name, /* in: name of a file or NULL */
|
||||||
const char* operation)/* in: operation */
|
const char* operation)/* in: operation */
|
||||||
{
|
{
|
||||||
ulint err;
|
ulint err;
|
||||||
|
|
||||||
UT_NOT_USED(file);
|
|
||||||
|
|
||||||
err = os_file_get_last_error(FALSE);
|
err = os_file_get_last_error(FALSE);
|
||||||
|
|
||||||
if (err == OS_FILE_DISK_FULL) {
|
if (err == OS_FILE_DISK_FULL) {
|
||||||
@ -481,6 +478,25 @@ os_io_init_simple(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
Creates a temporary file. In case of error, causes abnormal termination. */
|
||||||
|
|
||||||
|
FILE*
|
||||||
|
os_file_create_tmpfile(void)
|
||||||
|
/*========================*/
|
||||||
|
/* out: temporary file handle (never NULL) */
|
||||||
|
{
|
||||||
|
FILE* file = tmpfile();
|
||||||
|
if (file == NULL) {
|
||||||
|
ut_print_timestamp(stderr);
|
||||||
|
fputs(" InnoDB: Error: unable to create temporary file\n",
|
||||||
|
stderr);
|
||||||
|
os_file_handle_error(NULL, "tmpfile");
|
||||||
|
ut_error;
|
||||||
|
}
|
||||||
|
return(file);
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
The os_file_opendir() function opens a directory stream corresponding to the
|
The os_file_opendir() function opens a directory stream corresponding to the
|
||||||
directory named by the dirname argument. The directory stream is positioned
|
directory named by the dirname argument. The directory stream is positioned
|
||||||
@ -523,7 +539,7 @@ os_file_opendir(
|
|||||||
if (dir == INVALID_HANDLE_VALUE) {
|
if (dir == INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
if (error_is_fatal) {
|
if (error_is_fatal) {
|
||||||
os_file_handle_error(NULL, dirname, "opendir");
|
os_file_handle_error(dirname, "opendir");
|
||||||
}
|
}
|
||||||
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -534,7 +550,7 @@ os_file_opendir(
|
|||||||
dir = opendir(dirname);
|
dir = opendir(dirname);
|
||||||
|
|
||||||
if (dir == NULL && error_is_fatal) {
|
if (dir == NULL && error_is_fatal) {
|
||||||
os_file_handle_error(0, dirname, "opendir");
|
os_file_handle_error(dirname, "opendir");
|
||||||
}
|
}
|
||||||
|
|
||||||
return(dir);
|
return(dir);
|
||||||
@ -717,7 +733,7 @@ os_file_create_directory(
|
|||||||
if (!(rcode != 0 ||
|
if (!(rcode != 0 ||
|
||||||
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
|
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
|
||||||
/* failure */
|
/* failure */
|
||||||
os_file_handle_error(NULL, pathname, "CreateDirectory");
|
os_file_handle_error(Npathname, "CreateDirectory");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -730,7 +746,7 @@ os_file_create_directory(
|
|||||||
|
|
||||||
if (!(rcode == 0 || (errno == EEXIST && !fail_if_exists))) {
|
if (!(rcode == 0 || (errno == EEXIST && !fail_if_exists))) {
|
||||||
/* failure */
|
/* failure */
|
||||||
os_file_handle_error(0, pathname, "mkdir");
|
os_file_handle_error(pathname, "mkdir");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -809,7 +825,7 @@ try_again:
|
|||||||
if (file == INVALID_HANDLE_VALUE) {
|
if (file == INVALID_HANDLE_VALUE) {
|
||||||
*success = FALSE;
|
*success = FALSE;
|
||||||
|
|
||||||
retry = os_file_handle_error(file, name,
|
retry = os_file_handle_error(name,
|
||||||
create_mode == OS_FILE_OPEN ?
|
create_mode == OS_FILE_OPEN ?
|
||||||
"open" : "create");
|
"open" : "create");
|
||||||
if (retry) {
|
if (retry) {
|
||||||
@ -859,7 +875,7 @@ try_again:
|
|||||||
if (file == -1) {
|
if (file == -1) {
|
||||||
*success = FALSE;
|
*success = FALSE;
|
||||||
|
|
||||||
retry = os_file_handle_error(file, name,
|
retry = os_file_handle_error(name,
|
||||||
create_mode == OS_FILE_OPEN ?
|
create_mode == OS_FILE_OPEN ?
|
||||||
"open" : "create");
|
"open" : "create");
|
||||||
if (retry) {
|
if (retry) {
|
||||||
@ -1101,7 +1117,7 @@ try_again:
|
|||||||
if (file == INVALID_HANDLE_VALUE) {
|
if (file == INVALID_HANDLE_VALUE) {
|
||||||
*success = FALSE;
|
*success = FALSE;
|
||||||
|
|
||||||
retry = os_file_handle_error(file, name,
|
retry = os_file_handle_error(name,
|
||||||
create_mode == OS_FILE_CREATE ?
|
create_mode == OS_FILE_CREATE ?
|
||||||
"create" : "open");
|
"create" : "open");
|
||||||
if (retry) {
|
if (retry) {
|
||||||
@ -1186,7 +1202,7 @@ try_again:
|
|||||||
if (file == -1) {
|
if (file == -1) {
|
||||||
*success = FALSE;
|
*success = FALSE;
|
||||||
|
|
||||||
retry = os_file_handle_error(file, name,
|
retry = os_file_handle_error(name,
|
||||||
create_mode == OS_FILE_CREATE ?
|
create_mode == OS_FILE_CREATE ?
|
||||||
"create" : "open");
|
"create" : "open");
|
||||||
if (retry) {
|
if (retry) {
|
||||||
@ -1258,7 +1274,7 @@ loop:
|
|||||||
ret = unlink((const char*)name);
|
ret = unlink((const char*)name);
|
||||||
|
|
||||||
if (ret != 0 && errno != ENOENT) {
|
if (ret != 0 && errno != ENOENT) {
|
||||||
os_file_handle_error(0, name, "delete");
|
os_file_handle_error(name, "delete");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -1320,7 +1336,7 @@ loop:
|
|||||||
ret = unlink((const char*)name);
|
ret = unlink((const char*)name);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
os_file_handle_error(0, name, "delete");
|
os_file_handle_error(name, "delete");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -1350,7 +1366,7 @@ os_file_rename(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_file_handle_error(NULL, oldpath, "rename");
|
os_file_handle_error(oldpath, "rename");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
#else
|
#else
|
||||||
@ -1359,7 +1375,7 @@ os_file_rename(
|
|||||||
ret = rename((const char*)oldpath, (const char*)newpath);
|
ret = rename((const char*)oldpath, (const char*)newpath);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
os_file_handle_error(0, oldpath, "rename");
|
os_file_handle_error(oldpath, "rename");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -1389,7 +1405,7 @@ os_file_close(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_file_handle_error(file, NULL, "close");
|
os_file_handle_error(NULL, "close");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
#else
|
#else
|
||||||
@ -1398,7 +1414,7 @@ os_file_close(
|
|||||||
ret = close(file);
|
ret = close(file);
|
||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
os_file_handle_error(file, NULL, "close");
|
os_file_handle_error(NULL, "close");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -1651,7 +1667,7 @@ os_file_flush(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_file_handle_error(file, NULL, "flush");
|
os_file_handle_error(NULL, "flush");
|
||||||
|
|
||||||
/* It is a fatal error if a file flush does not succeed, because then
|
/* It is a fatal error if a file flush does not succeed, because then
|
||||||
the database can get corrupt on disk */
|
the database can get corrupt on disk */
|
||||||
@ -1686,7 +1702,7 @@ os_file_flush(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" InnoDB: Error: the OS said file flush did not succeed\n");
|
" InnoDB: Error: the OS said file flush did not succeed\n");
|
||||||
|
|
||||||
os_file_handle_error(file, NULL, "flush");
|
os_file_handle_error(NULL, "flush");
|
||||||
|
|
||||||
/* It is a fatal error if a file flush does not succeed, because then
|
/* It is a fatal error if a file flush does not succeed, because then
|
||||||
the database can get corrupt on disk */
|
the database can get corrupt on disk */
|
||||||
@ -1946,7 +1962,7 @@ try_again:
|
|||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
error_handling:
|
error_handling:
|
||||||
#endif
|
#endif
|
||||||
retry = os_file_handle_error(file, NULL, "read");
|
retry = os_file_handle_error(NULL, "read");
|
||||||
|
|
||||||
if (retry) {
|
if (retry) {
|
||||||
goto try_again;
|
goto try_again;
|
||||||
@ -3157,7 +3173,7 @@ try_again:
|
|||||||
|
|
||||||
os_aio_array_free_slot(array, slot);
|
os_aio_array_free_slot(array, slot);
|
||||||
|
|
||||||
retry = os_file_handle_error(file, name,
|
retry = os_file_handle_error(name,
|
||||||
type == OS_FILE_READ ? "aio read" : "aio write");
|
type == OS_FILE_READ ? "aio read" : "aio write");
|
||||||
if (retry) {
|
if (retry) {
|
||||||
|
|
||||||
@ -3257,7 +3273,7 @@ os_aio_windows_handle(
|
|||||||
ut_a(TRUE == os_file_flush(slot->file));
|
ut_a(TRUE == os_file_flush(slot->file));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
os_file_handle_error(slot->file, slot->name, "Windows aio");
|
os_file_handle_error(slot->name, "Windows aio");
|
||||||
|
|
||||||
ret_val = FALSE;
|
ret_val = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -397,6 +397,7 @@ row_create_prebuilt(
|
|||||||
prebuilt->clust_pcur = btr_pcur_create_for_mysql();
|
prebuilt->clust_pcur = btr_pcur_create_for_mysql();
|
||||||
|
|
||||||
prebuilt->select_lock_type = LOCK_NONE;
|
prebuilt->select_lock_type = LOCK_NONE;
|
||||||
|
prebuilt->stored_select_lock_type = 99999999;
|
||||||
|
|
||||||
prebuilt->sel_graph = NULL;
|
prebuilt->sel_graph = NULL;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ void STDCALL mysql_server_end()
|
|||||||
static MYSQL_PARAMETERS mysql_internal_parameters=
|
static MYSQL_PARAMETERS mysql_internal_parameters=
|
||||||
{&max_allowed_packet, &net_buffer_length};
|
{&max_allowed_packet, &net_buffer_length};
|
||||||
|
|
||||||
MYSQL_PARAMETERS *STDCALL mysql_get_parameters()
|
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void)
|
||||||
{
|
{
|
||||||
return &mysql_internal_parameters;
|
return &mysql_internal_parameters;
|
||||||
}
|
}
|
||||||
@ -616,60 +616,10 @@ mysql_connect(MYSQL *mysql,const char *host,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef CHECK_LICENSE
|
|
||||||
/*
|
|
||||||
Check server side variable 'license'.
|
|
||||||
If the variable does not exist or does not contain 'Commercial',
|
|
||||||
we're talking to non-commercial server from commercial client.
|
|
||||||
SYNOPSIS
|
|
||||||
check_license()
|
|
||||||
RETURN VALUE
|
|
||||||
0 success
|
|
||||||
!0 network error or the server is not commercial.
|
|
||||||
Error code is saved in mysql->net.last_errno.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int check_license(MYSQL *mysql)
|
|
||||||
{
|
|
||||||
MYSQL_ROW row;
|
|
||||||
MYSQL_RES *res;
|
|
||||||
NET *net= &mysql->net;
|
|
||||||
static const char query[]= "SELECT @@license";
|
|
||||||
static const char required_license[]= STRINGIFY_ARG(LICENSE);
|
|
||||||
|
|
||||||
if (mysql_real_query(mysql, query, sizeof(query)-1))
|
|
||||||
{
|
|
||||||
if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE)
|
|
||||||
{
|
|
||||||
net->last_errno= CR_WRONG_LICENSE;
|
|
||||||
sprintf(net->last_error, ER(net->last_errno), required_license);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!(res= mysql_use_result(mysql)))
|
|
||||||
return 1;
|
|
||||||
row= mysql_fetch_row(res);
|
|
||||||
/*
|
|
||||||
If no rows in result set, or column value is NULL (none of these
|
|
||||||
two is ever true for server variables now), or column value
|
|
||||||
mismatch, set wrong license error.
|
|
||||||
*/
|
|
||||||
if (!net->last_errno &&
|
|
||||||
(!row || !row[0] ||
|
|
||||||
strncmp(row[0], required_license, sizeof(required_license))))
|
|
||||||
{
|
|
||||||
net->last_errno= CR_WRONG_LICENSE;
|
|
||||||
sprintf(net->last_error, ER(net->last_errno), required_license);
|
|
||||||
}
|
|
||||||
mysql_free_result(res);
|
|
||||||
return net->last_errno;
|
|
||||||
}
|
|
||||||
#endif /* CHECK_LICENSE */
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Change user and database
|
Change user and database
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
|
int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
|
||||||
{
|
{
|
||||||
NET *net= &mysql->net;
|
NET *net= &mysql->net;
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "rt_mbr.h"
|
#include "rt_mbr.h"
|
||||||
|
|
||||||
#define REINSERT_BUFFER_INC 10
|
#define REINSERT_BUFFER_INC 10
|
||||||
|
#define PICK_BY_AREA
|
||||||
|
/*#define PICK_BY_PERIMETER*/
|
||||||
|
|
||||||
typedef struct st_page_level
|
typedef struct st_page_level
|
||||||
{
|
{
|
||||||
@ -438,6 +440,84 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Choose non-leaf better key for insertion
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef PICK_BY_PERIMETER
|
||||||
|
static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
||||||
|
uint key_length, uchar *page_buf, uint nod_flag)
|
||||||
|
{
|
||||||
|
double increase;
|
||||||
|
double best_incr = DBL_MAX;
|
||||||
|
double perimeter;
|
||||||
|
double best_perimeter;
|
||||||
|
uchar *best_key;
|
||||||
|
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
|
||||||
|
uchar *last = rt_PAGE_END(page_buf);
|
||||||
|
|
||||||
|
LINT_INIT(best_perimeter);
|
||||||
|
LINT_INIT(best_key);
|
||||||
|
|
||||||
|
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
|
||||||
|
{
|
||||||
|
if ((increase = rtree_perimeter_increase(keyinfo->seg, k, key, key_length,
|
||||||
|
&perimeter)) == -1)
|
||||||
|
return NULL;
|
||||||
|
if ((increase < best_incr)||
|
||||||
|
(increase == best_incr && perimeter < best_perimeter))
|
||||||
|
{
|
||||||
|
best_key = k;
|
||||||
|
best_perimeter= perimeter;
|
||||||
|
best_incr = increase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return best_key;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*PICK_BY_PERIMETER*/
|
||||||
|
|
||||||
|
#ifdef PICK_BY_AREA
|
||||||
|
static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
||||||
|
uint key_length, uchar *page_buf, uint nod_flag)
|
||||||
|
{
|
||||||
|
double increase;
|
||||||
|
double best_incr = DBL_MAX;
|
||||||
|
double area;
|
||||||
|
double best_area;
|
||||||
|
uchar *best_key;
|
||||||
|
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
|
||||||
|
uchar *last = rt_PAGE_END(page_buf);
|
||||||
|
|
||||||
|
LINT_INIT(best_area);
|
||||||
|
LINT_INIT(best_key);
|
||||||
|
|
||||||
|
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
|
||||||
|
{
|
||||||
|
if ((increase = rtree_area_increase(keyinfo->seg, k, key, key_length,
|
||||||
|
&area)) == -1)
|
||||||
|
return NULL;
|
||||||
|
if (increase < best_incr)
|
||||||
|
{
|
||||||
|
best_key = k;
|
||||||
|
best_area = area;
|
||||||
|
best_incr = increase;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((increase == best_incr) && (area < best_area))
|
||||||
|
{
|
||||||
|
best_key = k;
|
||||||
|
best_area = area;
|
||||||
|
best_incr = increase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return best_key;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*PICK_BY_AREA*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Go down and insert key into tree
|
Go down and insert key into tree
|
||||||
|
|
||||||
@ -469,7 +549,7 @@ static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
|||||||
if ((ins_level == -1 && nod_flag) || /* key: go down to leaf */
|
if ((ins_level == -1 && nod_flag) || /* key: go down to leaf */
|
||||||
(ins_level > -1 && ins_level > level)) /* branch: go down to ins_level */
|
(ins_level > -1 && ins_level > level)) /* branch: go down to ins_level */
|
||||||
{
|
{
|
||||||
if ((k = rtree_choose_key(info, keyinfo, key, key_length, page_buf,
|
if ((k = rtree_pick_key(info, keyinfo, key, key_length, page_buf,
|
||||||
nod_flag)) == NULL)
|
nod_flag)) == NULL)
|
||||||
goto err1;
|
goto err1;
|
||||||
switch ((res = rtree_insert_req(info, keyinfo, key, key_length,
|
switch ((res = rtree_insert_req(info, keyinfo, key, key_length,
|
||||||
@ -579,7 +659,7 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
|
|||||||
|
|
||||||
mi_putint(new_root_buf, 2, nod_flag);
|
mi_putint(new_root_buf, 2, nod_flag);
|
||||||
if ((new_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) ==
|
if ((new_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) ==
|
||||||
HA_OFFSET_ERROR)
|
HA_OFFSET_ERROR)
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
||||||
new_key = new_root_buf + keyinfo->block_length + nod_flag;
|
new_key = new_root_buf + keyinfo->block_length + nod_flag;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
(nod_flag ? nod_flag : info->s->base.rec_reflength))
|
(nod_flag ? nod_flag : info->s->base.rec_reflength))
|
||||||
#define rt_PAGE_END(page) (page + mi_getint(page))
|
#define rt_PAGE_END(page) (page + mi_getint(page))
|
||||||
|
|
||||||
#define rt_PAGE_MIN_SIZE(block_length) ((uint)(block_length) / 2)
|
#define rt_PAGE_MIN_SIZE(block_length) ((uint)(block_length) / 3)
|
||||||
|
|
||||||
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length);
|
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length);
|
||||||
int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length);
|
int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length);
|
||||||
|
@ -36,7 +36,8 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
|||||||
uint page_size = mi_getint(page_buf);
|
uint page_size = mi_getint(page_buf);
|
||||||
uint nod_flag = mi_test_if_nod(page_buf);
|
uint nod_flag = mi_test_if_nod(page_buf);
|
||||||
|
|
||||||
if (page_size + key_length + nod_flag <= keyinfo->block_length)
|
if (page_size + key_length + info->s->base.rec_reflength <=
|
||||||
|
keyinfo->block_length)
|
||||||
{
|
{
|
||||||
/* split won't be necessary */
|
/* split won't be necessary */
|
||||||
if (nod_flag)
|
if (nod_flag)
|
||||||
@ -96,47 +97,4 @@ int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
|||||||
return rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length);
|
return rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Choose non-leaf better key for insertion
|
|
||||||
*/
|
|
||||||
|
|
||||||
uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
|
||||||
uint key_length, uchar *page_buf, uint nod_flag)
|
|
||||||
{
|
|
||||||
double increase;
|
|
||||||
double best_incr = DBL_MAX;
|
|
||||||
double area;
|
|
||||||
double best_area;
|
|
||||||
uchar *best_key;
|
|
||||||
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
|
|
||||||
uchar *last = rt_PAGE_END(page_buf);
|
|
||||||
|
|
||||||
LINT_INIT(best_area);
|
|
||||||
LINT_INIT(best_key);
|
|
||||||
|
|
||||||
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
|
|
||||||
{
|
|
||||||
if ((increase = rtree_area_increase(keyinfo->seg, key, k, key_length,
|
|
||||||
&area)) == -1)
|
|
||||||
return NULL;
|
|
||||||
if (increase < best_incr)
|
|
||||||
{
|
|
||||||
best_key = k;
|
|
||||||
best_area = area;
|
|
||||||
best_incr = increase;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((increase == best_incr) && (area < best_area))
|
|
||||||
{
|
|
||||||
best_key = k;
|
|
||||||
best_area = area;
|
|
||||||
best_incr = increase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return best_key;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /*HAVE_RTREE_KEYS*/
|
#endif /*HAVE_RTREE_KEYS*/
|
||||||
|
@ -28,7 +28,6 @@ int rtree_delete_key(MI_INFO *info, uchar *page, uchar *key,
|
|||||||
uint key_length, uint nod_flag);
|
uint key_length, uint nod_flag);
|
||||||
int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
||||||
uint key_length, my_off_t child_page);
|
uint key_length, my_off_t child_page);
|
||||||
uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
|
||||||
uint key_length, uchar *page_buf, uint nod_flag);
|
|
||||||
#endif /*HAVE_RTREE_KEYS*/
|
#endif /*HAVE_RTREE_KEYS*/
|
||||||
#endif /* _rt_key_h */
|
#endif /* _rt_key_h */
|
||||||
|
506
myisam/rt_mbr.c
506
myisam/rt_mbr.c
@ -26,7 +26,7 @@
|
|||||||
#define CONTAIN_CMP(amin, amax, bmin, bmax) ((bmin > amin) || (bmax < amax))
|
#define CONTAIN_CMP(amin, amax, bmin, bmax) ((bmin > amin) || (bmax < amax))
|
||||||
#define WITHIN_CMP(amin, amax, bmin, bmax) ((amin > bmin) || (amax < bmax))
|
#define WITHIN_CMP(amin, amax, bmin, bmax) ((amin > bmin) || (amax < bmax))
|
||||||
#define DISJOINT_CMP(amin, amax, bmin, bmax) ((amin <= bmax) && (bmin <= amax))
|
#define DISJOINT_CMP(amin, amax, bmin, bmax) ((amin <= bmax) && (bmin <= amax))
|
||||||
#define EQUAL_CMP(amix, amax, bmin, bmax) ((amix != bmin) || (amax != bmax))
|
#define EQUAL_CMP(amin, amax, bmin, bmax) ((amin != bmin) || (amax != bmax))
|
||||||
|
|
||||||
#define FCMP(A, B) ((int)(A) - (int)(B))
|
#define FCMP(A, B) ((int)(A) - (int)(B))
|
||||||
#define p_inc(A, B, X) {A += X; B += X;}
|
#define p_inc(A, B, X) {A += X; B += X;}
|
||||||
@ -63,12 +63,9 @@
|
|||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
amin = korr_func(a); \
|
amin = korr_func(a); \
|
||||||
bmin = korr_func(b); \
|
bmin = korr_func(b); \
|
||||||
p_inc(a, b, len); \
|
amax = korr_func(a+len); \
|
||||||
amax = korr_func(a); \
|
bmax = korr_func(b+len); \
|
||||||
bmax = korr_func(b); \
|
|
||||||
RT_CMP(nextflag); \
|
RT_CMP(nextflag); \
|
||||||
p_inc(a, b, len); \
|
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RT_CMP_GET(type, get_func, len, nextflag) \
|
#define RT_CMP_GET(type, get_func, len, nextflag) \
|
||||||
@ -76,12 +73,9 @@
|
|||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
get_func(amin, a); \
|
get_func(amin, a); \
|
||||||
get_func(bmin, b); \
|
get_func(bmin, b); \
|
||||||
p_inc(a, b, len); \
|
get_func(amax, a+len); \
|
||||||
get_func(amax, a); \
|
get_func(bmax, b+len); \
|
||||||
get_func(bmax, b); \
|
|
||||||
RT_CMP(nextflag); \
|
RT_CMP(nextflag); \
|
||||||
p_inc(a, b, len); \
|
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -100,54 +94,55 @@ int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length,
|
|||||||
{
|
{
|
||||||
for (; (int) key_length > 0; keyseg += 2 )
|
for (; (int) key_length > 0; keyseg += 2 )
|
||||||
{
|
{
|
||||||
key_length -= keyseg->length * 2;
|
uint32 keyseg_length;
|
||||||
|
|
||||||
switch ((enum ha_base_keytype) keyseg->type) {
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
case HA_KEYTYPE_TEXT:
|
|
||||||
case HA_KEYTYPE_BINARY:
|
|
||||||
case HA_KEYTYPE_VARTEXT:
|
|
||||||
case HA_KEYTYPE_VARBINARY:
|
|
||||||
case HA_KEYTYPE_NUM:
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
case HA_KEYTYPE_INT8:
|
case HA_KEYTYPE_INT8:
|
||||||
{
|
RT_CMP_KORR(int8, mi_sint1korr, 1, nextflag);
|
||||||
int amin,amax,bmin,bmax;
|
break;
|
||||||
amin = (int)*((signed char *)a);
|
case HA_KEYTYPE_BINARY:
|
||||||
bmin = (int)*((signed char *)b);
|
RT_CMP_KORR(uint8, mi_uint1korr, 1, nextflag);
|
||||||
p_inc(a, b, 1);
|
break;
|
||||||
amax = (int)*((signed char *)a);
|
|
||||||
bmax = (int)*((signed char *)b);
|
|
||||||
RT_CMP(nextflag);
|
|
||||||
p_inc(a, b, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HA_KEYTYPE_SHORT_INT:
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
RT_CMP_KORR(int16, mi_sint2korr, 2, nextflag);
|
RT_CMP_KORR(int16, mi_sint2korr, 2, nextflag);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_USHORT_INT:
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
RT_CMP_KORR(uint16, mi_uint2korr, 2, nextflag);
|
RT_CMP_KORR(uint16, mi_uint2korr, 2, nextflag);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_INT24:
|
case HA_KEYTYPE_INT24:
|
||||||
RT_CMP_KORR(int32, mi_sint3korr, 3, nextflag);
|
RT_CMP_KORR(int32, mi_sint3korr, 3, nextflag);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_UINT24:
|
case HA_KEYTYPE_UINT24:
|
||||||
RT_CMP_KORR(uint32, mi_uint3korr, 3, nextflag);
|
RT_CMP_KORR(uint32, mi_uint3korr, 3, nextflag);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_LONG_INT:
|
case HA_KEYTYPE_LONG_INT:
|
||||||
RT_CMP_KORR(int32, mi_sint4korr, 4, nextflag);
|
RT_CMP_KORR(int32, mi_sint4korr, 4, nextflag);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONG_INT:
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
RT_CMP_KORR(uint32, mi_uint4korr, 4, nextflag);
|
RT_CMP_KORR(uint32, mi_uint4korr, 4, nextflag);
|
||||||
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
RT_CMP_KORR(longlong, mi_sint8korr, 8, nextflag)
|
RT_CMP_KORR(longlong, mi_sint8korr, 8, nextflag)
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONGLONG:
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
RT_CMP_KORR(ulonglong, mi_uint8korr, 8, nextflag)
|
RT_CMP_KORR(ulonglong, mi_uint8korr, 8, nextflag)
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case HA_KEYTYPE_FLOAT:
|
case HA_KEYTYPE_FLOAT:
|
||||||
RT_CMP_GET(float, mi_float4get, 4, nextflag);
|
RT_CMP_GET(float, mi_float4get, 4, nextflag);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
RT_CMP_GET(double, mi_float8get, 8, nextflag);
|
RT_CMP_GET(double, mi_float8get, 8, nextflag);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_END:
|
case HA_KEYTYPE_END:
|
||||||
goto end;
|
goto end;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
keyseg_length= keyseg->length * 2;
|
||||||
|
key_length-= keyseg_length;
|
||||||
|
a+= keyseg_length;
|
||||||
|
b+= keyseg_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
@ -167,22 +162,16 @@ end:
|
|||||||
{ \
|
{ \
|
||||||
type amin, amax; \
|
type amin, amax; \
|
||||||
amin = korr_func(a); \
|
amin = korr_func(a); \
|
||||||
a += len; \
|
amax = korr_func(a+len); \
|
||||||
amax = korr_func(a); \
|
|
||||||
a += len; \
|
|
||||||
res *= (cast(amax) - cast(amin)); \
|
res *= (cast(amax) - cast(amin)); \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RT_VOL_GET(type, get_func, len, cast) \
|
#define RT_VOL_GET(type, get_func, len, cast) \
|
||||||
{ \
|
{ \
|
||||||
type amin, amax; \
|
type amin, amax; \
|
||||||
get_func(amin, a); \
|
get_func(amin, a); \
|
||||||
a += len; \
|
get_func(amax, a+len); \
|
||||||
get_func(amax, a); \
|
|
||||||
a += len; \
|
|
||||||
res *= (cast(amax) - cast(amin)); \
|
res *= (cast(amax) - cast(amin)); \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -193,53 +182,55 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
|
|||||||
double res = 1;
|
double res = 1;
|
||||||
for (; (int)key_length > 0; keyseg += 2)
|
for (; (int)key_length > 0; keyseg += 2)
|
||||||
{
|
{
|
||||||
key_length -= keyseg->length * 2;
|
uint32 keyseg_length;
|
||||||
|
|
||||||
switch ((enum ha_base_keytype) keyseg->type) {
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
case HA_KEYTYPE_TEXT:
|
|
||||||
case HA_KEYTYPE_BINARY:
|
|
||||||
case HA_KEYTYPE_VARTEXT:
|
|
||||||
case HA_KEYTYPE_VARBINARY:
|
|
||||||
case HA_KEYTYPE_NUM:
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
case HA_KEYTYPE_INT8:
|
case HA_KEYTYPE_INT8:
|
||||||
{
|
RT_VOL_KORR(int8, mi_sint1korr, 1, (double));
|
||||||
int amin, amax;
|
break;
|
||||||
amin = (int)*((signed char *)a);
|
case HA_KEYTYPE_BINARY:
|
||||||
a += 1;
|
RT_VOL_KORR(uint8, mi_uint1korr, 1, (double));
|
||||||
amax = (int)*((signed char *)a);
|
break;
|
||||||
a += 1;
|
|
||||||
res *= ((double)amax - (double)amin);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HA_KEYTYPE_SHORT_INT:
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
RT_VOL_KORR(int16, mi_sint2korr, 2, (double));
|
RT_VOL_KORR(int16, mi_sint2korr, 2, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_USHORT_INT:
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
RT_VOL_KORR(uint16, mi_uint2korr, 2, (double));
|
RT_VOL_KORR(uint16, mi_uint2korr, 2, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_INT24:
|
case HA_KEYTYPE_INT24:
|
||||||
RT_VOL_KORR(int32, mi_sint3korr, 3, (double));
|
RT_VOL_KORR(int32, mi_sint3korr, 3, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_UINT24:
|
case HA_KEYTYPE_UINT24:
|
||||||
RT_VOL_KORR(uint32, mi_uint3korr, 3, (double));
|
RT_VOL_KORR(uint32, mi_uint3korr, 3, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_LONG_INT:
|
case HA_KEYTYPE_LONG_INT:
|
||||||
RT_VOL_KORR(int32, mi_sint4korr, 4, (double));
|
RT_VOL_KORR(int32, mi_sint4korr, 4, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONG_INT:
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
RT_VOL_KORR(uint32, mi_uint4korr, 4, (double));
|
RT_VOL_KORR(uint32, mi_uint4korr, 4, (double));
|
||||||
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
RT_VOL_KORR(longlong, mi_sint8korr, 8, (double));
|
RT_VOL_KORR(longlong, mi_sint8korr, 8, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONGLONG:
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
RT_VOL_KORR(longlong, mi_sint8korr, 8, ulonglong2double);
|
RT_VOL_KORR(longlong, mi_sint8korr, 8, ulonglong2double);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case HA_KEYTYPE_FLOAT:
|
case HA_KEYTYPE_FLOAT:
|
||||||
RT_VOL_GET(float, mi_float4get, 4, (double));
|
RT_VOL_GET(float, mi_float4get, 4, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
RT_VOL_GET(double, mi_float8get, 8, (double));
|
RT_VOL_GET(double, mi_float8get, 8, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_END:
|
case HA_KEYTYPE_END:
|
||||||
key_length = 0;
|
key_length = 0;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
keyseg_length= keyseg->length * 2;
|
||||||
|
key_length-= keyseg_length;
|
||||||
|
a+= keyseg_length;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -248,81 +239,78 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
|
|||||||
{ \
|
{ \
|
||||||
type amin, amax; \
|
type amin, amax; \
|
||||||
amin = korr_func(a); \
|
amin = korr_func(a); \
|
||||||
a += len; \
|
amax = korr_func(a+len); \
|
||||||
amax = korr_func(a); \
|
|
||||||
a += len; \
|
|
||||||
*res++ = cast(amin); \
|
*res++ = cast(amin); \
|
||||||
*res++ = cast(amax); \
|
*res++ = cast(amax); \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RT_D_MBR_GET(type, get_func, len, cast) \
|
#define RT_D_MBR_GET(type, get_func, len, cast) \
|
||||||
{ \
|
{ \
|
||||||
type amin, amax; \
|
type amin, amax; \
|
||||||
get_func(amin, a); \
|
get_func(amin, a); \
|
||||||
a += len; \
|
get_func(amax, a+len); \
|
||||||
get_func(amax, a); \
|
|
||||||
a += len; \
|
|
||||||
*res++ = cast(amin); \
|
*res++ = cast(amin); \
|
||||||
*res++ = cast(amax); \
|
*res++ = cast(amax); \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Creates an MBR as an array of doubles.
|
Creates an MBR as an array of doubles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
|
int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
|
||||||
{
|
{
|
||||||
for (; (int)key_length > 0; keyseg += 2)
|
for (; (int)key_length > 0; keyseg += 2)
|
||||||
{
|
{
|
||||||
key_length -= keyseg->length * 2;
|
uint32 keyseg_length;
|
||||||
|
|
||||||
switch ((enum ha_base_keytype) keyseg->type) {
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
case HA_KEYTYPE_TEXT:
|
|
||||||
case HA_KEYTYPE_BINARY:
|
|
||||||
case HA_KEYTYPE_VARTEXT:
|
|
||||||
case HA_KEYTYPE_VARBINARY:
|
|
||||||
case HA_KEYTYPE_NUM:
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
case HA_KEYTYPE_INT8:
|
case HA_KEYTYPE_INT8:
|
||||||
{
|
RT_D_MBR_KORR(int8, mi_sint1korr, 1, (double));
|
||||||
int amin, amax;
|
break;
|
||||||
amin = (int)*((signed char *)a);
|
case HA_KEYTYPE_BINARY:
|
||||||
a += 1;
|
RT_D_MBR_KORR(uint8, mi_uint1korr, 1, (double));
|
||||||
amax = (int)*((signed char *)a);
|
break;
|
||||||
a += 1;
|
|
||||||
*res++ = (double)amin;
|
|
||||||
*res++ = (double)amax;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HA_KEYTYPE_SHORT_INT:
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
RT_D_MBR_KORR(int16, mi_sint2korr, 2, (double));
|
RT_D_MBR_KORR(int16, mi_sint2korr, 2, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_USHORT_INT:
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
RT_D_MBR_KORR(uint16, mi_uint2korr, 2, (double));
|
RT_D_MBR_KORR(uint16, mi_uint2korr, 2, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_INT24:
|
case HA_KEYTYPE_INT24:
|
||||||
RT_D_MBR_KORR(int32, mi_sint3korr, 3, (double));
|
RT_D_MBR_KORR(int32, mi_sint3korr, 3, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_UINT24:
|
case HA_KEYTYPE_UINT24:
|
||||||
RT_D_MBR_KORR(uint32, mi_uint3korr, 3, (double));
|
RT_D_MBR_KORR(uint32, mi_uint3korr, 3, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_LONG_INT:
|
case HA_KEYTYPE_LONG_INT:
|
||||||
RT_D_MBR_KORR(int32, mi_sint4korr, 4, (double));
|
RT_D_MBR_KORR(int32, mi_sint4korr, 4, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONG_INT:
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
RT_D_MBR_KORR(uint32, mi_uint4korr, 4, (double));
|
RT_D_MBR_KORR(uint32, mi_uint4korr, 4, (double));
|
||||||
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
RT_D_MBR_KORR(longlong, mi_sint8korr, 8, (double));
|
RT_D_MBR_KORR(longlong, mi_sint8korr, 8, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONGLONG:
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
RT_D_MBR_KORR(longlong, mi_sint8korr, 8, ulonglong2double);
|
RT_D_MBR_KORR(longlong, mi_sint8korr, 8, ulonglong2double);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case HA_KEYTYPE_FLOAT:
|
case HA_KEYTYPE_FLOAT:
|
||||||
RT_D_MBR_GET(float, mi_float4get, 4, (double));
|
RT_D_MBR_GET(float, mi_float4get, 4, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
RT_D_MBR_GET(double, mi_float8get, 8, (double));
|
RT_D_MBR_GET(double, mi_float8get, 8, (double));
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_END:
|
case HA_KEYTYPE_END:
|
||||||
key_length = 0;
|
key_length = 0;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
keyseg_length= keyseg->length * 2;
|
||||||
|
key_length-= keyseg_length;
|
||||||
|
a+= keyseg_length;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -332,17 +320,12 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
|
|||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
amin = korr_func(a); \
|
amin = korr_func(a); \
|
||||||
bmin = korr_func(b); \
|
bmin = korr_func(b); \
|
||||||
p_inc(a, b, len); \
|
amax = korr_func(a+len); \
|
||||||
amax = korr_func(a); \
|
bmax = korr_func(b+len); \
|
||||||
bmax = korr_func(b); \
|
|
||||||
p_inc(a, b, len); \
|
|
||||||
amin = min(amin, bmin); \
|
amin = min(amin, bmin); \
|
||||||
amax = max(amax, bmax); \
|
amax = max(amax, bmax); \
|
||||||
store_func(c, amin); \
|
store_func(c, amin); \
|
||||||
c += len; \
|
store_func(c+len, amax); \
|
||||||
store_func(c, amax); \
|
|
||||||
c += len; \
|
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RT_COMB_GET(type, get_func, store_func, len) \
|
#define RT_COMB_GET(type, get_func, store_func, len) \
|
||||||
@ -350,17 +333,12 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
|
|||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
get_func(amin, a); \
|
get_func(amin, a); \
|
||||||
get_func(bmin, b); \
|
get_func(bmin, b); \
|
||||||
p_inc(a, b, len); \
|
get_func(amax, a+len); \
|
||||||
get_func(amax, a); \
|
get_func(bmax, b+len); \
|
||||||
get_func(bmax, b); \
|
|
||||||
p_inc(a, b, len); \
|
|
||||||
amin = min(amin, bmin); \
|
amin = min(amin, bmin); \
|
||||||
amax = max(amax, bmax); \
|
amax = max(amax, bmax); \
|
||||||
store_func(c, amin); \
|
store_func(c, amin); \
|
||||||
c += len; \
|
store_func(c+len, amax); \
|
||||||
store_func(c, amax); \
|
|
||||||
c += len; \
|
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -372,81 +350,75 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
|
|||||||
int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
|
int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
|
||||||
uint key_length)
|
uint key_length)
|
||||||
{
|
{
|
||||||
|
|
||||||
for ( ; (int) key_length > 0 ; keyseg += 2)
|
for ( ; (int) key_length > 0 ; keyseg += 2)
|
||||||
{
|
{
|
||||||
key_length -= keyseg->length * 2;
|
uint32 keyseg_length;
|
||||||
|
|
||||||
switch ((enum ha_base_keytype) keyseg->type) {
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
case HA_KEYTYPE_TEXT:
|
|
||||||
case HA_KEYTYPE_BINARY:
|
|
||||||
case HA_KEYTYPE_VARTEXT:
|
|
||||||
case HA_KEYTYPE_VARBINARY:
|
|
||||||
case HA_KEYTYPE_NUM:
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
case HA_KEYTYPE_INT8:
|
case HA_KEYTYPE_INT8:
|
||||||
{
|
RT_COMB_KORR(int8, mi_sint1korr, mi_int1store, 1);
|
||||||
int amin, amax, bmin, bmax;
|
break;
|
||||||
amin = (int)*((signed char *)a);
|
case HA_KEYTYPE_BINARY:
|
||||||
bmin = (int)*((signed char *)b);
|
RT_COMB_KORR(uint8, mi_uint1korr, mi_int1store, 1);
|
||||||
p_inc(a, b, 1);
|
break;
|
||||||
amax = (int)*((signed char *)a);
|
|
||||||
bmax = (int)*((signed char *)b);
|
|
||||||
p_inc(a, b, 1);
|
|
||||||
amin = min(amin, bmin);
|
|
||||||
amax = max(amax, bmax);
|
|
||||||
*((signed char*)c) = amin;
|
|
||||||
c += 1;
|
|
||||||
*((signed char*)c) = amax;
|
|
||||||
c += 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HA_KEYTYPE_SHORT_INT:
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
RT_COMB_KORR(int16, mi_sint2korr, mi_int2store, 2);
|
RT_COMB_KORR(int16, mi_sint2korr, mi_int2store, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_USHORT_INT:
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
RT_COMB_KORR(uint16, mi_uint2korr, mi_int2store, 2);
|
RT_COMB_KORR(uint16, mi_uint2korr, mi_int2store, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_INT24:
|
case HA_KEYTYPE_INT24:
|
||||||
RT_COMB_KORR(int32, mi_sint3korr, mi_int3store, 3);
|
RT_COMB_KORR(int32, mi_sint3korr, mi_int3store, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_UINT24:
|
case HA_KEYTYPE_UINT24:
|
||||||
RT_COMB_KORR(uint32, mi_uint3korr, mi_int3store, 3);
|
RT_COMB_KORR(uint32, mi_uint3korr, mi_int3store, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_LONG_INT:
|
case HA_KEYTYPE_LONG_INT:
|
||||||
RT_COMB_KORR(int32, mi_sint4korr, mi_int4store, 4);
|
RT_COMB_KORR(int32, mi_sint4korr, mi_int4store, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONG_INT:
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
RT_COMB_KORR(uint32, mi_uint4korr, mi_int4store, 4);
|
RT_COMB_KORR(uint32, mi_uint4korr, mi_int4store, 4);
|
||||||
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
RT_COMB_KORR(longlong, mi_sint8korr, mi_int8store, 8);
|
RT_COMB_KORR(longlong, mi_sint8korr, mi_int8store, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONGLONG:
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
RT_COMB_KORR(ulonglong, mi_uint8korr, mi_int8store, 8);
|
RT_COMB_KORR(ulonglong, mi_uint8korr, mi_int8store, 8);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case HA_KEYTYPE_FLOAT:
|
case HA_KEYTYPE_FLOAT:
|
||||||
RT_COMB_GET(float, mi_float4get, mi_float4store, 4);
|
RT_COMB_GET(float, mi_float4get, mi_float4store, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
RT_COMB_GET(double, mi_float8get, mi_float8store, 8);
|
RT_COMB_GET(double, mi_float8get, mi_float8store, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_END:
|
case HA_KEYTYPE_END:
|
||||||
return 0;
|
return 0;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
keyseg_length= keyseg->length * 2;
|
||||||
|
key_length-= keyseg_length;
|
||||||
|
a+= keyseg_length;
|
||||||
|
b+= keyseg_length;
|
||||||
|
c+= keyseg_length;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define RT_OVL_AREA_KORR(type, korr_func, len) \
|
#define RT_OVL_AREA_KORR(type, korr_func, len) \
|
||||||
{ \
|
{ \
|
||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
amin = korr_func(a); \
|
amin = korr_func(a); \
|
||||||
bmin = korr_func(b); \
|
bmin = korr_func(b); \
|
||||||
p_inc(a, b, len); \
|
amax = korr_func(a+len); \
|
||||||
amax = korr_func(a); \
|
bmax = korr_func(b+len); \
|
||||||
bmax = korr_func(b); \
|
|
||||||
p_inc(a, b, len); \
|
|
||||||
amin = max(amin, bmin); \
|
amin = max(amin, bmin); \
|
||||||
amax = min(amax, bmax); \
|
amax = min(amax, bmax); \
|
||||||
if (amin >= amax) \
|
if (amin >= amax) \
|
||||||
return 0; \
|
return 0; \
|
||||||
res *= amax - amin; \
|
res *= amax - amin; \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RT_OVL_AREA_GET(type, get_func, len) \
|
#define RT_OVL_AREA_GET(type, get_func, len) \
|
||||||
@ -454,16 +426,13 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
|
|||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
get_func(amin, a); \
|
get_func(amin, a); \
|
||||||
get_func(bmin, b); \
|
get_func(bmin, b); \
|
||||||
p_inc(a, b, len); \
|
get_func(amax, a+len); \
|
||||||
get_func(amax, a); \
|
get_func(bmax, b+len); \
|
||||||
get_func(bmax, b); \
|
|
||||||
p_inc(a, b, len); \
|
|
||||||
amin = max(amin, bmin); \
|
amin = max(amin, bmin); \
|
||||||
amax = min(amax, bmax); \
|
amax = min(amax, bmax); \
|
||||||
if (amin >= amax) \
|
if (amin >= amax) \
|
||||||
return 0; \
|
return 0; \
|
||||||
res *= amax - amin; \
|
res *= amax - amin; \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -475,58 +444,55 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
|||||||
double res = 1;
|
double res = 1;
|
||||||
for (; (int) key_length > 0 ; keyseg += 2)
|
for (; (int) key_length > 0 ; keyseg += 2)
|
||||||
{
|
{
|
||||||
key_length -= keyseg->length * 2;
|
uint32 keyseg_length;
|
||||||
|
|
||||||
switch ((enum ha_base_keytype) keyseg->type) {
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
case HA_KEYTYPE_TEXT:
|
|
||||||
case HA_KEYTYPE_BINARY:
|
|
||||||
case HA_KEYTYPE_VARTEXT:
|
|
||||||
case HA_KEYTYPE_VARBINARY:
|
|
||||||
case HA_KEYTYPE_NUM:
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
break;
|
|
||||||
case HA_KEYTYPE_INT8:
|
case HA_KEYTYPE_INT8:
|
||||||
{
|
RT_OVL_AREA_KORR(int8, mi_sint1korr, 1);
|
||||||
int amin, amax, bmin, bmax;
|
break;
|
||||||
amin = (int)*((signed char *)a);
|
case HA_KEYTYPE_BINARY:
|
||||||
bmin = (int)*((signed char *)b);
|
RT_OVL_AREA_KORR(uint8, mi_uint1korr, 1);
|
||||||
p_inc(a, b, 1);
|
break;
|
||||||
amax = (int)*((signed char *)a);
|
|
||||||
bmax = (int)*((signed char *)b);
|
|
||||||
p_inc(a, b, 1);
|
|
||||||
amin = max(amin, bmin);
|
|
||||||
amax = min(amax, bmax);
|
|
||||||
if (amin >= amax)
|
|
||||||
return 0;
|
|
||||||
res *= amax - amin;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HA_KEYTYPE_SHORT_INT:
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
RT_OVL_AREA_KORR(int16, mi_sint2korr, 2);
|
RT_OVL_AREA_KORR(int16, mi_sint2korr, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_USHORT_INT:
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
RT_OVL_AREA_KORR(uint16, mi_uint2korr, 2);
|
RT_OVL_AREA_KORR(uint16, mi_uint2korr, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_INT24:
|
case HA_KEYTYPE_INT24:
|
||||||
RT_OVL_AREA_KORR(int32, mi_sint3korr, 3);
|
RT_OVL_AREA_KORR(int32, mi_sint3korr, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_UINT24:
|
case HA_KEYTYPE_UINT24:
|
||||||
RT_OVL_AREA_KORR(uint32, mi_uint3korr, 3);
|
RT_OVL_AREA_KORR(uint32, mi_uint3korr, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_LONG_INT:
|
case HA_KEYTYPE_LONG_INT:
|
||||||
RT_OVL_AREA_KORR(int32, mi_sint4korr, 4);
|
RT_OVL_AREA_KORR(int32, mi_sint4korr, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONG_INT:
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
RT_OVL_AREA_KORR(uint32, mi_uint4korr, 4);
|
RT_OVL_AREA_KORR(uint32, mi_uint4korr, 4);
|
||||||
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
RT_OVL_AREA_KORR(longlong, mi_sint8korr, 8);
|
RT_OVL_AREA_KORR(longlong, mi_sint8korr, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONGLONG:
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
RT_OVL_AREA_KORR(longlong, mi_sint8korr, 8);
|
RT_OVL_AREA_KORR(longlong, mi_sint8korr, 8);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case HA_KEYTYPE_FLOAT:
|
case HA_KEYTYPE_FLOAT:
|
||||||
RT_OVL_AREA_GET(float, mi_float4get, 4);
|
RT_OVL_AREA_GET(float, mi_float4get, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
RT_OVL_AREA_GET(double, mi_float8get, 8);
|
RT_OVL_AREA_GET(double, mi_float8get, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_END:
|
case HA_KEYTYPE_END:
|
||||||
return res;
|
return res;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
keyseg_length= keyseg->length * 2;
|
||||||
|
key_length-= keyseg_length;
|
||||||
|
a+= keyseg_length;
|
||||||
|
b+= keyseg_length;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -536,13 +502,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
|||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
amin = korr_func(a); \
|
amin = korr_func(a); \
|
||||||
bmin = korr_func(b); \
|
bmin = korr_func(b); \
|
||||||
p_inc(a, b, len); \
|
amax = korr_func(a+len); \
|
||||||
amax = korr_func(a); \
|
bmax = korr_func(b+len); \
|
||||||
bmax = korr_func(b); \
|
|
||||||
p_inc(a, b, len); \
|
|
||||||
a_area *= (((double)amax) - ((double)amin)); \
|
a_area *= (((double)amax) - ((double)amin)); \
|
||||||
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
|
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RT_AREA_INC_GET(type, get_func, len)\
|
#define RT_AREA_INC_GET(type, get_func, len)\
|
||||||
@ -550,13 +513,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
|||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
get_func(amin, a); \
|
get_func(amin, a); \
|
||||||
get_func(bmin, b); \
|
get_func(bmin, b); \
|
||||||
p_inc(a, b, len); \
|
get_func(amax, a+len); \
|
||||||
get_func(amax, a); \
|
get_func(bmax, b+len); \
|
||||||
get_func(bmax, b); \
|
|
||||||
p_inc(a, b, len); \
|
|
||||||
a_area *= (((double)amax) - ((double)amin)); \
|
a_area *= (((double)amax) - ((double)amin)); \
|
||||||
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
|
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -565,70 +525,159 @@ Calculates MBR_AREA(a+b) - MBR_AREA(a)
|
|||||||
double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
||||||
uint key_length, double *ab_area)
|
uint key_length, double *ab_area)
|
||||||
{
|
{
|
||||||
double a_area = 1;
|
double a_area= 1.0;
|
||||||
|
|
||||||
*ab_area = 1;
|
*ab_area= 1.0;
|
||||||
for (; (int)key_length > 0; keyseg += 2)
|
for (; (int)key_length > 0; keyseg += 2)
|
||||||
{
|
{
|
||||||
key_length -= keyseg->length * 2;
|
uint32 keyseg_length;
|
||||||
|
|
||||||
/* Handle NULL part */
|
if (keyseg->null_bit) /* Handle NULL part */
|
||||||
if (keyseg->null_bit)
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
switch ((enum ha_base_keytype) keyseg->type) {
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
case HA_KEYTYPE_TEXT:
|
|
||||||
case HA_KEYTYPE_BINARY:
|
|
||||||
case HA_KEYTYPE_VARTEXT:
|
|
||||||
case HA_KEYTYPE_VARBINARY:
|
|
||||||
case HA_KEYTYPE_NUM:
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
case HA_KEYTYPE_INT8:
|
case HA_KEYTYPE_INT8:
|
||||||
{
|
RT_AREA_INC_KORR(int8, mi_sint1korr, 1);
|
||||||
int amin, amax, bmin, bmax;
|
break;
|
||||||
amin = (int)*((signed char *)a);
|
case HA_KEYTYPE_BINARY:
|
||||||
bmin = (int)*((signed char *)b);
|
RT_AREA_INC_KORR(uint8, mi_uint1korr, 1);
|
||||||
p_inc(a, b, 1);
|
break;
|
||||||
amax = (int)*((signed char *)a);
|
|
||||||
bmax = (int)*((signed char *)b);
|
|
||||||
p_inc(a, b, 1);
|
|
||||||
a_area *= (((double)amax) - ((double)amin));
|
|
||||||
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HA_KEYTYPE_SHORT_INT:
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
RT_AREA_INC_KORR(int16, mi_sint2korr, 2);
|
RT_AREA_INC_KORR(int16, mi_sint2korr, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_USHORT_INT:
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
RT_AREA_INC_KORR(uint16, mi_uint2korr, 2);
|
RT_AREA_INC_KORR(uint16, mi_uint2korr, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_INT24:
|
case HA_KEYTYPE_INT24:
|
||||||
RT_AREA_INC_KORR(int32, mi_sint3korr, 3);
|
RT_AREA_INC_KORR(int32, mi_sint3korr, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_UINT24:
|
case HA_KEYTYPE_UINT24:
|
||||||
RT_AREA_INC_KORR(int32, mi_uint3korr, 3);
|
RT_AREA_INC_KORR(int32, mi_uint3korr, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_LONG_INT:
|
case HA_KEYTYPE_LONG_INT:
|
||||||
RT_AREA_INC_KORR(int32, mi_sint4korr, 4);
|
RT_AREA_INC_KORR(int32, mi_sint4korr, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONG_INT:
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
RT_AREA_INC_KORR(uint32, mi_uint4korr, 4);
|
RT_AREA_INC_KORR(uint32, mi_uint4korr, 4);
|
||||||
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
RT_AREA_INC_KORR(longlong, mi_sint8korr, 8);
|
RT_AREA_INC_KORR(longlong, mi_sint8korr, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONGLONG:
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
RT_AREA_INC_KORR(longlong, mi_sint8korr, 8);
|
RT_AREA_INC_KORR(longlong, mi_sint8korr, 8);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case HA_KEYTYPE_FLOAT:
|
case HA_KEYTYPE_FLOAT:
|
||||||
RT_AREA_INC_GET(float, mi_float4get, 4);
|
RT_AREA_INC_GET(float, mi_float4get, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
RT_AREA_INC_GET(double, mi_float8get, 8);
|
RT_AREA_INC_GET(double, mi_float8get, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_END:
|
case HA_KEYTYPE_END:
|
||||||
return *ab_area - a_area;
|
return *ab_area - a_area;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
keyseg_length= keyseg->length * 2;
|
||||||
|
key_length-= keyseg_length;
|
||||||
|
a+= keyseg_length;
|
||||||
|
b+= keyseg_length;
|
||||||
}
|
}
|
||||||
return *ab_area - a_area;
|
return *ab_area - a_area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RT_PERIM_INC_KORR(type, korr_func, len) \
|
||||||
|
{ \
|
||||||
|
type amin, amax, bmin, bmax; \
|
||||||
|
amin = korr_func(a); \
|
||||||
|
bmin = korr_func(b); \
|
||||||
|
amax = korr_func(a+len); \
|
||||||
|
bmax = korr_func(b+len); \
|
||||||
|
a_perim+= (((double)amax) - ((double)amin)); \
|
||||||
|
*ab_perim+= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RT_PERIM_INC_GET(type, get_func, len)\
|
||||||
|
{\
|
||||||
|
type amin, amax, bmin, bmax; \
|
||||||
|
get_func(amin, a); \
|
||||||
|
get_func(bmin, b); \
|
||||||
|
get_func(amax, a+len); \
|
||||||
|
get_func(bmax, b+len); \
|
||||||
|
a_perim+= (((double)amax) - ((double)amin)); \
|
||||||
|
*ab_perim+= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Calculates MBR_PERIMETER(a+b) - MBR_PERIMETER(a)
|
||||||
|
*/
|
||||||
|
double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
||||||
|
uint key_length, double *ab_perim)
|
||||||
|
{
|
||||||
|
double a_perim = 0.0;
|
||||||
|
|
||||||
|
*ab_perim= 0.0;
|
||||||
|
for (; (int)key_length > 0; keyseg += 2)
|
||||||
|
{
|
||||||
|
uint32 keyseg_length;
|
||||||
|
|
||||||
|
if (keyseg->null_bit) /* Handle NULL part */
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
|
case HA_KEYTYPE_INT8:
|
||||||
|
RT_PERIM_INC_KORR(int8, mi_sint1korr, 1);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_BINARY:
|
||||||
|
RT_PERIM_INC_KORR(uint8, mi_uint1korr, 1);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
|
RT_PERIM_INC_KORR(int16, mi_sint2korr, 2);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
|
RT_PERIM_INC_KORR(uint16, mi_uint2korr, 2);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_INT24:
|
||||||
|
RT_PERIM_INC_KORR(int32, mi_sint3korr, 3);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_UINT24:
|
||||||
|
RT_PERIM_INC_KORR(int32, mi_uint3korr, 3);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_LONG_INT:
|
||||||
|
RT_PERIM_INC_KORR(int32, mi_sint4korr, 4);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
|
RT_PERIM_INC_KORR(uint32, mi_uint4korr, 4);
|
||||||
|
break;
|
||||||
|
#ifdef HAVE_LONG_LONG
|
||||||
|
case HA_KEYTYPE_LONGLONG:
|
||||||
|
RT_PERIM_INC_KORR(longlong, mi_sint8korr, 8);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
|
RT_PERIM_INC_KORR(longlong, mi_sint8korr, 8);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case HA_KEYTYPE_FLOAT:
|
||||||
|
RT_PERIM_INC_GET(float, mi_float4get, 4);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_DOUBLE:
|
||||||
|
RT_PERIM_INC_GET(double, mi_float8get, 8);
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_END:
|
||||||
|
return *ab_perim - a_perim;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
keyseg_length= keyseg->length * 2;
|
||||||
|
key_length-= keyseg_length;
|
||||||
|
a+= keyseg_length;
|
||||||
|
b+= keyseg_length;
|
||||||
|
}
|
||||||
|
return *ab_perim - a_perim;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define RT_PAGE_MBR_KORR(type, korr_func, store_func, len) \
|
#define RT_PAGE_MBR_KORR(type, korr_func, store_func, len) \
|
||||||
{ \
|
{ \
|
||||||
type amin, amax, bmin, bmax; \
|
type amin, amax, bmin, bmax; \
|
||||||
@ -649,7 +698,6 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
|||||||
store_func(c, amax); \
|
store_func(c, amax); \
|
||||||
c += len; \
|
c += len; \
|
||||||
inc += 2 * len; \
|
inc += 2 * len; \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RT_PAGE_MBR_GET(type, get_func, store_func, len) \
|
#define RT_PAGE_MBR_GET(type, get_func, store_func, len) \
|
||||||
@ -672,7 +720,6 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
|||||||
store_func(c, amax); \
|
store_func(c, amax); \
|
||||||
c += len; \
|
c += len; \
|
||||||
inc += 2 * len; \
|
inc += 2 * len; \
|
||||||
break; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -700,61 +747,48 @@ int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
|
|||||||
k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
|
k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
|
||||||
|
|
||||||
switch ((enum ha_base_keytype) keyseg->type) {
|
switch ((enum ha_base_keytype) keyseg->type) {
|
||||||
case HA_KEYTYPE_TEXT:
|
|
||||||
case HA_KEYTYPE_BINARY:
|
|
||||||
case HA_KEYTYPE_VARTEXT:
|
|
||||||
case HA_KEYTYPE_VARBINARY:
|
|
||||||
case HA_KEYTYPE_NUM:
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
case HA_KEYTYPE_INT8:
|
case HA_KEYTYPE_INT8:
|
||||||
{
|
RT_PAGE_MBR_KORR(int8, mi_sint1korr, mi_int1store, 1);
|
||||||
int amin, amax, bmin, bmax;
|
break;
|
||||||
amin = (int)*((signed char *)(k + inc));
|
case HA_KEYTYPE_BINARY:
|
||||||
amax = (int)*((signed char *)(k + inc + 1));
|
RT_PAGE_MBR_KORR(uint8, mi_uint1korr, mi_int1store, 1);
|
||||||
k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag);
|
break;
|
||||||
for (; k < last; k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag))
|
|
||||||
{
|
|
||||||
bmin = (int)*((signed char *)(k + inc));
|
|
||||||
bmax = (int)*((signed char *)(k + inc + 1));
|
|
||||||
|
|
||||||
if (amin > bmin)
|
|
||||||
amin = bmin;
|
|
||||||
if (amax < bmax)
|
|
||||||
amax = bmax;
|
|
||||||
}
|
|
||||||
*((signed char*)c) = amin;
|
|
||||||
c += 1;
|
|
||||||
*((signed char*)c) = amax;
|
|
||||||
c += 1;
|
|
||||||
inc += 1 * 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HA_KEYTYPE_SHORT_INT:
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
RT_PAGE_MBR_KORR(int16, mi_sint2korr, mi_int2store, 2);
|
RT_PAGE_MBR_KORR(int16, mi_sint2korr, mi_int2store, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_USHORT_INT:
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
RT_PAGE_MBR_KORR(uint16, mi_uint2korr, mi_int2store, 2);
|
RT_PAGE_MBR_KORR(uint16, mi_uint2korr, mi_int2store, 2);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_INT24:
|
case HA_KEYTYPE_INT24:
|
||||||
RT_PAGE_MBR_KORR(int32, mi_sint3korr, mi_int3store, 3);
|
RT_PAGE_MBR_KORR(int32, mi_sint3korr, mi_int3store, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_UINT24:
|
case HA_KEYTYPE_UINT24:
|
||||||
RT_PAGE_MBR_KORR(uint32, mi_uint3korr, mi_int3store, 3);
|
RT_PAGE_MBR_KORR(uint32, mi_uint3korr, mi_int3store, 3);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_LONG_INT:
|
case HA_KEYTYPE_LONG_INT:
|
||||||
RT_PAGE_MBR_KORR(int32, mi_sint4korr, mi_int4store, 4);
|
RT_PAGE_MBR_KORR(int32, mi_sint4korr, mi_int4store, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONG_INT:
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
RT_PAGE_MBR_KORR(uint32, mi_uint4korr, mi_int4store, 4);
|
RT_PAGE_MBR_KORR(uint32, mi_uint4korr, mi_int4store, 4);
|
||||||
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
RT_PAGE_MBR_KORR(longlong, mi_sint8korr, mi_int8store, 8);
|
RT_PAGE_MBR_KORR(longlong, mi_sint8korr, mi_int8store, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_ULONGLONG:
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
RT_PAGE_MBR_KORR(ulonglong, mi_uint8korr, mi_int8store, 8);
|
RT_PAGE_MBR_KORR(ulonglong, mi_uint8korr, mi_int8store, 8);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case HA_KEYTYPE_FLOAT:
|
case HA_KEYTYPE_FLOAT:
|
||||||
RT_PAGE_MBR_GET(float, mi_float4get, mi_float4store, 4);
|
RT_PAGE_MBR_GET(float, mi_float4get, mi_float4store, 4);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
RT_PAGE_MBR_GET(double, mi_float8get, mi_float8store, 8);
|
RT_PAGE_MBR_GET(double, mi_float8get, mi_float8store, 8);
|
||||||
|
break;
|
||||||
case HA_KEYTYPE_END:
|
case HA_KEYTYPE_END:
|
||||||
return 0;
|
return 0;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -30,6 +30,8 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar *a, uchar *b,
|
|||||||
uint key_length);
|
uint key_length);
|
||||||
double rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
|
double rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
|
||||||
uint key_length, double *ab_area);
|
uint key_length, double *ab_area);
|
||||||
|
double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
||||||
|
uint key_length, double *ab_perim);
|
||||||
int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
|
int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
|
||||||
uchar* c, uint key_length);
|
uchar* c, uint key_length);
|
||||||
#endif /*HAVE_RTREE_KEYS*/
|
#endif /*HAVE_RTREE_KEYS*/
|
||||||
|
@ -267,12 +267,12 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
|
|||||||
|
|
||||||
n_dim = keyinfo->keysegs / 2;
|
n_dim = keyinfo->keysegs / 2;
|
||||||
|
|
||||||
if (!my_multi_malloc(MYF(0),
|
if (!(coord_buf= my_alloca(n_dim * 2 * sizeof(double) * (max_keys + 1 + 4) +
|
||||||
&coord_buf, n_dim * 2 * sizeof(double) * (max_keys + 1 + 4),
|
sizeof(SplitStruct) * (max_keys + 1))))
|
||||||
&task, sizeof(SplitStruct) * (max_keys + 1),
|
|
||||||
NullS))
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
task= (SplitStruct *)(coord_buf + n_dim * 2 * (max_keys + 1 + 4));
|
||||||
|
|
||||||
next_coord = coord_buf;
|
next_coord = coord_buf;
|
||||||
|
|
||||||
stop = task + max_keys;
|
stop = task + max_keys;
|
||||||
@ -345,7 +345,7 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
|
|||||||
my_afree((byte*)new_page);
|
my_afree((byte*)new_page);
|
||||||
|
|
||||||
split_err:
|
split_err:
|
||||||
my_free((gptr) coord_buf, MYF(0));
|
my_afree((byte*) coord_buf);
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,51 @@ static void create_record1(char *record,uint rownr);
|
|||||||
static void print_record(char * record,my_off_t offs,const char * tail);
|
static void print_record(char * record,my_off_t offs,const char * tail);
|
||||||
static int run_test(const char *filename);
|
static int run_test(const char *filename);
|
||||||
|
|
||||||
|
static double rt_data[]=
|
||||||
|
{
|
||||||
|
/*1*/ 0,10,0,10,
|
||||||
|
/*2*/ 5,15,0,10,
|
||||||
|
/*3*/ 0,10,5,15,
|
||||||
|
/*4*/ 10,20,10,20,
|
||||||
|
/*5*/ 0,10,0,10,
|
||||||
|
/*6*/ 5,15,0,10,
|
||||||
|
/*7*/ 0,10,5,15,
|
||||||
|
/*8*/ 10,20,10,20,
|
||||||
|
/*9*/ 0,10,0,10,
|
||||||
|
/*10*/ 5,15,0,10,
|
||||||
|
/*11*/ 0,10,5,15,
|
||||||
|
/*12*/ 10,20,10,20,
|
||||||
|
/*13*/ 0,10,0,10,
|
||||||
|
/*14*/ 5,15,0,10,
|
||||||
|
/*15*/ 0,10,5,15,
|
||||||
|
/*16*/ 10,20,10,20,
|
||||||
|
/*17*/ 5,15,0,10,
|
||||||
|
/*18*/ 0,10,5,15,
|
||||||
|
/*19*/ 10,20,10,20,
|
||||||
|
/*20*/ 0,10,0,10,
|
||||||
|
|
||||||
|
/*1*/ 100,110,0,10,
|
||||||
|
/*2*/ 105,115,0,10,
|
||||||
|
/*3*/ 100,110,5,15,
|
||||||
|
/*4*/ 110,120,10,20,
|
||||||
|
/*5*/ 100,110,0,10,
|
||||||
|
/*6*/ 105,115,0,10,
|
||||||
|
/*7*/ 100,110,5,15,
|
||||||
|
/*8*/ 110,120,10,20,
|
||||||
|
/*9*/ 100,110,0,10,
|
||||||
|
/*10*/ 105,115,0,10,
|
||||||
|
/*11*/ 100,110,5,15,
|
||||||
|
/*12*/ 110,120,10,20,
|
||||||
|
/*13*/ 100,110,0,10,
|
||||||
|
/*14*/ 105,115,0,10,
|
||||||
|
/*15*/ 100,110,5,15,
|
||||||
|
/*16*/ 110,120,10,20,
|
||||||
|
/*17*/ 105,115,0,10,
|
||||||
|
/*18*/ 100,110,5,15,
|
||||||
|
/*19*/ 110,120,10,20,
|
||||||
|
/*20*/ 100,110,0,10,
|
||||||
|
-1
|
||||||
|
};
|
||||||
|
|
||||||
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
|
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -58,7 +103,7 @@ static int run_test(const char *filename)
|
|||||||
int key_type=HA_KEYTYPE_DOUBLE;
|
int key_type=HA_KEYTYPE_DOUBLE;
|
||||||
int key_length=8;
|
int key_length=8;
|
||||||
int null_fields=0;
|
int null_fields=0;
|
||||||
int nrecords=300;
|
int nrecords=sizeof(rt_data)/(sizeof(double)*4);/* 3000;*/
|
||||||
int rec_length=0;
|
int rec_length=0;
|
||||||
int uniques=0;
|
int uniques=0;
|
||||||
int i;
|
int i;
|
||||||
@ -381,7 +426,7 @@ static void create_record1(char *record,uint rownr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void create_record(char *record,uint rownr)
|
static void create_record0(char *record,uint rownr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char * pos;
|
char * pos;
|
||||||
@ -402,6 +447,19 @@ static void create_record(char *record,uint rownr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void create_record(char *record,uint rownr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *pos;
|
||||||
|
double *data= rt_data+rownr*4;
|
||||||
|
record[0]=0x01; /* DEL marker */
|
||||||
|
for ( pos=record+1, i=0; i<ndims*2; i++)
|
||||||
|
{
|
||||||
|
float8store(pos,data[i]);
|
||||||
|
pos+=8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
|
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ conflict with it.
|
|||||||
All tests must pass. If one or more of them fail on your system, please
|
All tests must pass. If one or more of them fail on your system, please
|
||||||
read the following manual section of how to report the problem:
|
read the following manual section of how to report the problem:
|
||||||
|
|
||||||
http://www.mysql.com/doc/M/y/MySQL_test_suite.html
|
http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html
|
||||||
|
|
||||||
|
|
||||||
You can create your own test cases. To create a test case:
|
You can create your own test cases. To create a test case:
|
||||||
|
@ -167,12 +167,10 @@ count(*)
|
|||||||
150
|
150
|
||||||
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range g g 32 NULL 4 Using where
|
1 SIMPLE t1 range g g 32 NULL 7 Using where
|
||||||
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
1 LINESTRING(150 150,150 150)
|
1 LINESTRING(150 150,150 150)
|
||||||
11 LINESTRING(140 140,160 160)
|
|
||||||
2 LINESTRING(149 149,151 151)
|
|
||||||
3 LINESTRING(148 148,152 152)
|
3 LINESTRING(148 148,152 152)
|
||||||
4 LINESTRING(147 147,153 153)
|
4 LINESTRING(147 147,153 153)
|
||||||
5 LINESTRING(146 146,154 154)
|
5 LINESTRING(146 146,154 154)
|
||||||
@ -181,6 +179,8 @@ fid AsText(g)
|
|||||||
8 LINESTRING(143 143,157 157)
|
8 LINESTRING(143 143,157 157)
|
||||||
9 LINESTRING(142 142,158 158)
|
9 LINESTRING(142 142,158 158)
|
||||||
10 LINESTRING(141 141,159 159)
|
10 LINESTRING(141 141,159 159)
|
||||||
|
11 LINESTRING(140 140,160 160)
|
||||||
|
2 LINESTRING(149 149,151 151)
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
@ -305,10 +305,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
|
46 LINESTRING(51 41,60 50)
|
||||||
|
56 LINESTRING(41 41,50 50)
|
||||||
45 LINESTRING(51 51,60 60)
|
45 LINESTRING(51 51,60 60)
|
||||||
55 LINESTRING(41 51,50 60)
|
55 LINESTRING(41 51,50 60)
|
||||||
56 LINESTRING(41 41,50 50)
|
|
||||||
46 LINESTRING(51 41,60 50)
|
|
||||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
||||||
SELECT count(*) FROM t2;
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -226,3 +226,20 @@ WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
|
|||||||
OR ( r = 1 AND a IN ( 3 ) AND ( u = 'w/U' OR u LIKE 'w/U/%' ) )
|
OR ( r = 1 AND a IN ( 3 ) AND ( u = 'w/U' OR u LIKE 'w/U/%' ) )
|
||||||
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
|
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (a VARCHAR(16), UNIQUE(a));
|
||||||
|
INSERT INTO t1 VALUES ('1'), ('2'), ('3');
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = '2' LIMIT 0, 1;
|
||||||
|
a
|
||||||
|
2
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
FOUND_ROWS()
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
INSERT INTO t1 VALUES (0), (0), (1), (2);
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
|
||||||
|
a
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
FOUND_ROWS()
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -137,3 +137,22 @@ WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
|
|||||||
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
|
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #3738: we have a ref key
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a VARCHAR(16), UNIQUE(a));
|
||||||
|
INSERT INTO t1 VALUES ('1'), ('2'), ('3');
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = '2' LIMIT 0, 1;
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #3845: group by, having and empty result
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
INSERT INTO t1 VALUES (0), (0), (1), (2);
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -751,6 +751,58 @@ static my_bool is_NT(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CHECK_LICENSE
|
||||||
|
/*
|
||||||
|
Check server side variable 'license'.
|
||||||
|
If the variable does not exist or does not contain 'Commercial',
|
||||||
|
we're talking to non-commercial server from commercial client.
|
||||||
|
SYNOPSIS
|
||||||
|
check_license()
|
||||||
|
RETURN VALUE
|
||||||
|
0 success
|
||||||
|
!0 network error or the server is not commercial.
|
||||||
|
Error code is saved in mysql->net.last_errno.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int check_license(MYSQL *mysql)
|
||||||
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
MYSQL_RES *res;
|
||||||
|
NET *net= &mysql->net;
|
||||||
|
static const char query[]= "SELECT @@license";
|
||||||
|
static const char required_license[]= STRINGIFY_ARG(LICENSE);
|
||||||
|
|
||||||
|
if (mysql_real_query(mysql, query, sizeof(query)-1))
|
||||||
|
{
|
||||||
|
if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE)
|
||||||
|
{
|
||||||
|
net->last_errno= CR_WRONG_LICENSE;
|
||||||
|
sprintf(net->last_error, ER(net->last_errno), required_license);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!(res= mysql_use_result(mysql)))
|
||||||
|
return 1;
|
||||||
|
row= mysql_fetch_row(res);
|
||||||
|
/*
|
||||||
|
If no rows in result set, or column value is NULL (none of these
|
||||||
|
two is ever true for server variables now), or column value
|
||||||
|
mismatch, set wrong license error.
|
||||||
|
*/
|
||||||
|
if (!net->last_errno &&
|
||||||
|
(!row || !row[0] ||
|
||||||
|
strncmp(row[0], required_license, sizeof(required_license))))
|
||||||
|
{
|
||||||
|
net->last_errno= CR_WRONG_LICENSE;
|
||||||
|
sprintf(net->last_error, ER(net->last_errno), required_license);
|
||||||
|
}
|
||||||
|
mysql_free_result(res);
|
||||||
|
return net->last_errno;
|
||||||
|
}
|
||||||
|
#endif /* CHECK_LICENSE */
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Shut down connection
|
Shut down connection
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@ -1996,10 +2048,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
||||||
net->compress=1;
|
net->compress=1;
|
||||||
|
|
||||||
|
#ifdef CHECK_LICENSE
|
||||||
|
if (check_license(mysql))
|
||||||
|
goto error;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (db && mysql_select_db(mysql,db))
|
if (db && mysql_select_db(mysql,db))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -4657,6 +4657,39 @@ ha_innobase::start_stmt(
|
|||||||
prepared for an update of a row */
|
prepared for an update of a row */
|
||||||
|
|
||||||
prebuilt->select_lock_type = LOCK_X;
|
prebuilt->select_lock_type = LOCK_X;
|
||||||
|
} else {
|
||||||
|
/* When we first come here after LOCK TABLES,
|
||||||
|
select_lock_type is set to LOCK_S or LOCK_X. Store the value
|
||||||
|
in case we run also consistent reads and need to restore the
|
||||||
|
value later. */
|
||||||
|
|
||||||
|
if (prebuilt->select_lock_type != LOCK_NONE) {
|
||||||
|
prebuilt->stored_select_lock_type =
|
||||||
|
prebuilt->select_lock_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prebuilt->stored_select_lock_type != LOCK_S
|
||||||
|
&& prebuilt->stored_select_lock_type != LOCK_X) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"InnoDB: Error: select_lock_type is %lu inside ::start_stmt()!\n",
|
||||||
|
prebuilt->stored_select_lock_type);
|
||||||
|
|
||||||
|
ut_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thd->lex->sql_command == SQLCOM_SELECT
|
||||||
|
&& thd->lex->lock_option == TL_READ) {
|
||||||
|
|
||||||
|
/* For other than temporary tables, we obtain
|
||||||
|
no lock for consistent read (plain SELECT) */
|
||||||
|
|
||||||
|
prebuilt->select_lock_type = LOCK_NONE;
|
||||||
|
} else {
|
||||||
|
/* Not a consistent read: restore the
|
||||||
|
select_lock_type value */
|
||||||
|
prebuilt->select_lock_type =
|
||||||
|
prebuilt->stored_select_lock_type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the MySQL flag to mark that there is an active transaction */
|
/* Set the MySQL flag to mark that there is an active transaction */
|
||||||
|
@ -4449,11 +4449,11 @@ replicating a LOAD DATA INFILE command.",
|
|||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"log-warnings", 'W', "Log some not critical warnings to the log file.",
|
{"log-warnings", 'W', "Log some not critical warnings to the log file.",
|
||||||
(gptr*) &global_system_variables.log_warnings,
|
(gptr*) &global_system_variables.log_warnings,
|
||||||
(gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
(gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
|
||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
{"warnings", 'W', "Deprecated ; Use --log-warnings instead.",
|
{"warnings", 'W', "Deprecated ; Use --log-warnings instead.",
|
||||||
(gptr*) &global_system_variables.log_warnings,
|
(gptr*) &global_system_variables.log_warnings,
|
||||||
(gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
(gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
|
||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
{ "back_log", OPT_BACK_LOG,
|
{ "back_log", OPT_BACK_LOG,
|
||||||
"The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.",
|
"The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.",
|
||||||
@ -5474,6 +5474,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'V':
|
case 'V':
|
||||||
print_version();
|
print_version();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
case 'W':
|
||||||
|
if (!argument)
|
||||||
|
global_system_variables.log_warnings++;
|
||||||
|
else if (argument == disabled_my_option)
|
||||||
|
global_system_variables.log_warnings= 0L;
|
||||||
|
else
|
||||||
|
global_system_variables.log_warnings= atoi(argument);
|
||||||
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
test_flags= argument ? (uint) atoi(argument) : 0;
|
test_flags= argument ? (uint) atoi(argument) : 0;
|
||||||
test_flags&= ~TEST_NO_THREADS;
|
test_flags&= ~TEST_NO_THREADS;
|
||||||
|
@ -182,7 +182,7 @@ sys_var_key_cache_long sys_key_cache_age_threshold("key_cache_age_threshold",
|
|||||||
param_age_threshold));
|
param_age_threshold));
|
||||||
sys_var_bool_ptr sys_local_infile("local_infile",
|
sys_var_bool_ptr sys_local_infile("local_infile",
|
||||||
&opt_local_infile);
|
&opt_local_infile);
|
||||||
sys_var_thd_bool sys_log_warnings("log_warnings", &SV::log_warnings);
|
sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings);
|
||||||
sys_var_thd_ulong sys_long_query_time("long_query_time",
|
sys_var_thd_ulong sys_long_query_time("long_query_time",
|
||||||
&SV::long_query_time);
|
&SV::long_query_time);
|
||||||
sys_var_thd_bool sys_low_priority_updates("low_priority_updates",
|
sys_var_thd_bool sys_low_priority_updates("low_priority_updates",
|
||||||
|
@ -398,7 +398,7 @@ bool Gis_line_string::init_from_wkt(Gis_read_stream *trs, String *wkb)
|
|||||||
if (trs->skip_char(',')) // Didn't find ','
|
if (trs->skip_char(',')) // Didn't find ','
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (n_points < 2)
|
if (n_points < 1)
|
||||||
{
|
{
|
||||||
trs->set_error_msg("Too few points in LINESTRING");
|
trs->set_error_msg("Too few points in LINESTRING");
|
||||||
return 1;
|
return 1;
|
||||||
@ -487,6 +487,11 @@ int Gis_line_string::is_closed(int *closed) const
|
|||||||
if (no_data(data, 4))
|
if (no_data(data, 4))
|
||||||
return 1;
|
return 1;
|
||||||
n_points= uint4korr(data);
|
n_points= uint4korr(data);
|
||||||
|
if (n_points == 1)
|
||||||
|
{
|
||||||
|
*closed=1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
data+= 4;
|
data+= 4;
|
||||||
if (no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points))
|
if (no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -941,7 +941,7 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ulong acl_get(const char *host, const char *ip,
|
ulong acl_get(const char *host, const char *ip,
|
||||||
const char *user, const char *db, my_bool db_is_pattern)
|
const char *user, const char *db, my_bool db_is_pattern)
|
||||||
{
|
{
|
||||||
ulong host_access,db_access;
|
ulong host_access,db_access;
|
||||||
uint i,key_length;
|
uint i,key_length;
|
||||||
|
@ -383,6 +383,7 @@ struct system_variables
|
|||||||
ulong query_prealloc_size;
|
ulong query_prealloc_size;
|
||||||
ulong trans_alloc_block_size;
|
ulong trans_alloc_block_size;
|
||||||
ulong trans_prealloc_size;
|
ulong trans_prealloc_size;
|
||||||
|
ulong log_warnings;
|
||||||
ulong group_concat_max_len;
|
ulong group_concat_max_len;
|
||||||
/*
|
/*
|
||||||
In slave thread we need to know in behalf of which
|
In slave thread we need to know in behalf of which
|
||||||
@ -390,7 +391,6 @@ struct system_variables
|
|||||||
*/
|
*/
|
||||||
ulong pseudo_thread_id;
|
ulong pseudo_thread_id;
|
||||||
|
|
||||||
my_bool log_warnings;
|
|
||||||
my_bool low_priority_updates;
|
my_bool low_priority_updates;
|
||||||
my_bool new_mode;
|
my_bool new_mode;
|
||||||
my_bool query_cache_wlock_invalidate;
|
my_bool query_cache_wlock_invalidate;
|
||||||
|
@ -1021,7 +1021,7 @@ pthread_handler_decl(handle_one_connection,arg)
|
|||||||
free_root(&thd->mem_root,MYF(0));
|
free_root(&thd->mem_root,MYF(0));
|
||||||
if (net->error && net->vio != 0 && net->report_error)
|
if (net->error && net->vio != 0 && net->report_error)
|
||||||
{
|
{
|
||||||
if (!thd->killed && thd->variables.log_warnings)
|
if (!thd->killed && thd->variables.log_warnings > 1)
|
||||||
sql_print_error(ER(ER_NEW_ABORTING_CONNECTION),
|
sql_print_error(ER(ER_NEW_ABORTING_CONNECTION),
|
||||||
thd->thread_id,(thd->db ? thd->db : "unconnected"),
|
thd->thread_id,(thd->db ? thd->db : "unconnected"),
|
||||||
thd->user ? thd->user : "unauthenticated",
|
thd->user ? thd->user : "unauthenticated",
|
||||||
|
@ -6369,7 +6369,8 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
|||||||
if ((join->tables == 1) && !join->tmp_table && !join->sort_and_group
|
if ((join->tables == 1) && !join->tmp_table && !join->sort_and_group
|
||||||
&& !join->send_group_parts && !join->having && !jt->select_cond &&
|
&& !join->send_group_parts && !join->having && !jt->select_cond &&
|
||||||
!(jt->select && jt->select->quick) &&
|
!(jt->select && jt->select->quick) &&
|
||||||
!(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT))
|
!(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT) &&
|
||||||
|
(jt->ref.key < 0))
|
||||||
{
|
{
|
||||||
/* Join over all rows in table; Return number of found rows */
|
/* Join over all rows in table; Return number of found rows */
|
||||||
TABLE *table=jt->table;
|
TABLE *table=jt->table;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user