Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e72b51a7
Commit
e72b51a7
authored
Jun 30, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
parents
a83334fc
d90caf3d
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
267 additions
and
204 deletions
+267
-204
Build-tools/Do-compile
Build-tools/Do-compile
+9
-3
Docs/manual.texi
Docs/manual.texi
+60
-57
acinclude.m4
acinclude.m4
+6
-4
client/mysql.cc
client/mysql.cc
+3
-7
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+2
-0
configure.in
configure.in
+2
-3
include/my_global.h
include/my_global.h
+7
-0
include/my_pthread.h
include/my_pthread.h
+1
-0
innobase/configure.in
innobase/configure.in
+1
-0
innobase/ut/ut0ut.c
innobase/ut/ut0ut.c
+4
-4
mysql-test/r/func_test.result
mysql-test/r/func_test.result
+6
-6
mysql-test/r/rpl_get_lock.result
mysql-test/r/rpl_get_lock.result
+8
-2
mysql-test/t/func_test.test
mysql-test/t/func_test.test
+3
-2
mysql-test/t/rpl_get_lock.test
mysql-test/t/rpl_get_lock.test
+4
-1
mysys/my_tempnam.c
mysys/my_tempnam.c
+2
-2
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+29
-5
sql/item_create.cc
sql/item_create.cc
+2
-2
sql/item_create.h
sql/item_create.h
+1
-1
sql/item_func.cc
sql/item_func.cc
+11
-21
sql/item_func.h
sql/item_func.h
+2
-2
sql/lex.h
sql/lex.h
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+6
-4
sql/sql_db.cc
sql/sql_db.cc
+2
-0
sql/sql_parse.cc
sql/sql_parse.cc
+8
-0
sql/sql_select.cc
sql/sql_select.cc
+85
-76
sql/table.cc
sql/table.cc
+2
-1
No files found.
Build-tools/Do-compile
View file @
e72b51a7
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
use
Getopt::
Long
;
use
Getopt::
Long
;
$opt_distribution
=
$opt_user
=
$opt_result
=
$opt_config_options
=
$opt_config_env
=
"";
$opt_distribution
=
$opt_user
=
$opt_result
=
$opt_config_options
=
$opt_config_env
=
"";
$opt_dbd_options
=
$opt_perl_options
=
$opt_suffix
=
"";
$opt_dbd_options
=
$opt_perl_options
=
$opt_
make_options
=
$opt_
suffix
=
"";
$opt_tmp
=
$opt_version_suffix
=
"";
$opt_tmp
=
$opt_version_suffix
=
"";
$opt_help
=
$opt_Information
=
$opt_delete
=
$opt_debug
=
$opt_stage
=
$opt_rsh_mail
=
$opt_no_test
=
$opt_no_perl
=
$opt_with_low_memory
=
$opt_fast_benchmark
=
$opt_static_client
=
$opt_static_server
=
$opt_static_perl
=
$opt_sur
=
$opt_with_small_disk
=
$opt_local_perl
=
$opt_tcpip
=
$opt_build_thread
=
$opt_no_mysqltest
=
$opt_use_old_distribution
=
$opt_enable_shared
=
$opt_no_crash_me
=
$opt_no_strip
=
0
;
$opt_help
=
$opt_Information
=
$opt_delete
=
$opt_debug
=
$opt_stage
=
$opt_rsh_mail
=
$opt_no_test
=
$opt_no_perl
=
$opt_with_low_memory
=
$opt_fast_benchmark
=
$opt_static_client
=
$opt_static_server
=
$opt_static_perl
=
$opt_sur
=
$opt_with_small_disk
=
$opt_local_perl
=
$opt_tcpip
=
$opt_build_thread
=
$opt_no_mysqltest
=
$opt_use_old_distribution
=
$opt_enable_shared
=
$opt_no_crash_me
=
$opt_no_strip
=
0
;
$opt_innodb
=
$opt_bdb
=
0
;
$opt_innodb
=
$opt_bdb
=
0
;
GetOptions
("
Information
","
help
","
distribution=s
","
user=s
","
result=s
","
delete
","
no-test
","
no-mysqltest
","
perl-files=s
","
debug
","
config-options=s
","
config-env=s
","
stage=i
","
rsh-mail
","
with-low-memory
","
fast-benchmark
","
tmp=s
","
static-client
","
static-server
","
static-perl
","
no-perl
","
local-perl
","
perl-options=s
","
sur
","
with-small-disk
","
dbd-options=s
","
tcpip
","
suffix=s
","
build-thread=i
","
innodb
","
bdb
","
use-old-distribution
","
enable-shared
","
no-crash-me
","
no-strip
","
version-suffix=s
",
"
with-other-libc=s
")
||
usage
();
GetOptions
("
Information
","
help
","
distribution=s
","
user=s
","
result=s
","
delete
","
no-test
","
no-mysqltest
","
perl-files=s
","
debug
","
config-options=s
","
config-env=s
","
stage=i
","
rsh-mail
","
with-low-memory
","
fast-benchmark
","
tmp=s
","
static-client
","
static-server
","
static-perl
","
no-perl
","
local-perl
","
perl-options=s
","
make-options=s
",
"
sur
","
with-small-disk
","
dbd-options=s
","
tcpip
","
suffix=s
","
build-thread=i
","
innodb
","
bdb
","
use-old-distribution
","
enable-shared
","
no-crash-me
","
no-strip
","
version-suffix=s
",
"
with-other-libc=s
")
||
usage
();
usage
()
if
(
$opt_help
||
$opt_Information
);
usage
()
if
(
$opt_help
||
$opt_Information
);
usage
()
if
(
!
$opt_distribution
);
usage
()
if
(
!
$opt_distribution
);
...
@@ -172,8 +172,11 @@ if ($opt_stage <= 1)
...
@@ -172,8 +172,11 @@ if ($opt_stage <= 1)
if
(
$opt_stage
<=
2
)
if
(
$opt_stage
<=
2
)
{
{
my
(
$command
);
unlink
(
$opt_distribution
)
if
(
$opt_delete
&&
!
$opt_use_old_distribution
);
unlink
(
$opt_distribution
)
if
(
$opt_delete
&&
!
$opt_use_old_distribution
);
safe_system
("
$make
");
$command
=
$make
;
$command
.=
"
$opt_make_options
"
if
(
defined
(
$opt_make_options
)
&&
$opt_make_options
ne
"");
safe_system
(
$command
);
}
}
#
#
...
@@ -368,6 +371,9 @@ To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
...
@@ -368,6 +371,9 @@ To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
--dbd-options 'options'
--dbd-options 'options'
Options for Makefile.PL when configuring msql-mysql-modules.
Options for Makefile.PL when configuring msql-mysql-modules.
--make-options 'options'
Options to make after configure. (Like 'CXXLD=gcc')
--version-suffix suffix
--version-suffix suffix
Can be used to set a suffix (normally 'com' or '-max') for a distribution
Can be used to set a suffix (normally 'com' or '-max') for a distribution
...
...
Docs/manual.texi
View file @
e72b51a7
...
@@ -5710,7 +5710,8 @@ FreeBSD 2.x with the included MIT-pthreads package. @xref{FreeBSD}.
...
@@ -5710,7 +5710,8 @@ FreeBSD 2.x with the included MIT-pthreads package. @xref{FreeBSD}.
@item
@item
FreeBSD 3.x and 4.x with native threads. @xref{FreeBSD}.
FreeBSD 3.x and 4.x with native threads. @xref{FreeBSD}.
@item
@item
HP-UX 10.20 with the included MIT-pthreads package. @xref{HP-UX 10.20}.
HP-UX 10.20 with the DCE threads or the included MIT-pthreads package.
@xref{HP-UX 10.20}.
@item
@item
HP-UX 11.x with the native threads. @xref{HP-UX 11.x}.
HP-UX 11.x with the native threads. @xref{HP-UX 11.x}.
@item
@item
...
@@ -10396,25 +10397,15 @@ compiler, because @code{gcc} produces better code!
...
@@ -10396,25 +10397,15 @@ compiler, because @code{gcc} produces better code!
We recommend using gcc 2.95 on HP-UX. Don't use high optimisation
We recommend using gcc 2.95 on HP-UX. Don't use high optimisation
flags (like -O6) as this may not be safe on HP-UX.
flags (like -O6) as this may not be safe on HP-UX.
Note that MIT-pthreads can't be compiled with the HP-UX compiler
The following configure line should work with gcc 2.95:
because it can't compile @code{.S} (assembler) files.
The following configure line should work:
@example
@example
CFLAGS="-
DHPUX -
I/opt/dce/include -fpic" \
CFLAGS="-I/opt/dce/include -fpic" \
CXXFLAGS="-
DHPUX -
I/opt/dce/include -felide-constructors -fno-exceptions \
CXXFLAGS="-I/opt/dce/include -felide-constructors -fno-exceptions \
-fno-rtti" CXX=gcc ./configure --with-pthread \
-fno-rtti" CXX=gcc ./configure --with-pthread \
--with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
--with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
@end example
@end example
If you are compiling @code{gcc} 2.95 yourself, you should NOT link it with
the DCE libraries (@code{libdce.a} or @code{libcma.a}) if you want to compile
MySQL with MIT-pthreads. If you mix the DCE and MIT-pthreads
packages you will get a @code{mysqld} to which you cannot connect. Remove
the DCE libraries while you compile @code{gcc} 2.95!
@node HP-UX 11.x, IBM-AIX, HP-UX 10.20, Other Unix Notes
@node HP-UX 11.x, IBM-AIX, HP-UX 10.20, Other Unix Notes
@subsubsection HP-UX Version 11.x Notes
@subsubsection HP-UX Version 11.x Notes
...
@@ -14146,9 +14137,9 @@ IP address to bind to.
...
@@ -14146,9 +14137,9 @@ IP address to bind to.
Directory where character sets are. @xref{Character sets}.
Directory where character sets are. @xref{Character sets}.
@item --chroot=path
@item --chroot=path
Chroot @code{mysqld} daemon during startup. Recommended security measure. It will
Put @code{mysqld} daemon in chroot environment at startup. Recommended
s
omewhat limit @code{LOAD DATA INFILE} and @code{SELECT ... INTO OUTFILE}
s
ecurity measure. It somewhat limits @code{LOAD DATA INFILE} and
though.
@code{SELECT ... INTO OUTFILE}
though.
@item --core-file
@item --core-file
Write a core file if @code{mysqld} dies. For some systems you must also
Write a core file if @code{mysqld} dies. For some systems you must also
...
@@ -28290,7 +28281,7 @@ in ANSI mode. @xref{ANSI mode}.
...
@@ -28290,7 +28281,7 @@ in ANSI mode. @xref{ANSI mode}.
@multitable @columnfractions .15 .15 .70
@multitable @columnfractions .15 .15 .70
@item @strong{Identifier} @tab @strong{Max length} @tab @strong{Allowed characters}
@item @strong{Identifier} @tab @strong{Max length} @tab @strong{Allowed characters}
@item Database @tab 64 @tab Any character that is allowed in a directory name except @samp{/} or @samp{.}.
@item Database @tab 64 @tab Any character that is allowed in a directory name except @samp{/}
, @samp{\}
or @samp{.}.
@item Table @tab 64 @tab Any character that is allowed in a file name, except @samp{/} or @samp{.}.
@item Table @tab 64 @tab Any character that is allowed in a file name, except @samp{/} or @samp{.}.
@item Column @tab 64 @tab All characters.
@item Column @tab 64 @tab All characters.
@item Alias @tab 255 @tab All characters.
@item Alias @tab 255 @tab All characters.
...
@@ -30746,6 +30737,22 @@ mysql> SELECT 1 && 0;
...
@@ -30746,6 +30737,22 @@ mysql> SELECT 1 && 0;
mysql> SELECT 1 && NULL;
mysql> SELECT 1 && NULL;
-> NULL
-> NULL
@end example
@end example
@findex XOR, logical
@item XOR
Logical XOR. For non-@code{NULL} operands, evaluates to @code{1} if only one
of the operators is non-zero.
Produces @code{NULL} if either operand is @code{NULL}:
@example
mysql> SELECT 1 XOR 1;
-> 0
mysql> SELECT 1 XOR 0;
-> 1
mysql> SELECT 1 XOR NULL;
-> NULL
@end example
@code{a XOR b} is equal to @code{(a AND (NOT b)) OR ((NOT a) and b)}.
@end table
@end table
...
@@ -32817,7 +32824,7 @@ The result is an unsigned 64-bit integer.
...
@@ -32817,7 +32824,7 @@ The result is an unsigned 64-bit integer.
@findex & (bitwise AND)
@findex & (bitwise AND)
@findex AND, bitwise
@findex AND, bitwise
@item &
@item &
Bitwise AND
:
Bitwise AND
@example
@example
mysql> SELECT 29 & 15;
mysql> SELECT 29 & 15;
-> 13
-> 13
...
@@ -32825,6 +32832,21 @@ mysql> SELECT 29 & 15;
...
@@ -32825,6 +32832,21 @@ mysql> SELECT 29 & 15;
The result is an unsigned 64-bit integer.
The result is an unsigned 64-bit integer.
@findex ^ (bitwise XOR)
@findex XOR, bitwise
@item ^
Bitwise XOR
@example
mysql> SELECT 1 ^ 1;
-> 0
mysql> SELECT 1 ^ 0;
-> 1
mysql> SELECT 11 ^ 3;
-> 8
@end example
The result is an unsigned 64-bit integer.
@findex << (left shift)
@findex << (left shift)
@item <<
@item <<
Shifts a longlong (@code{BIGINT}) number to the left:
Shifts a longlong (@code{BIGINT}) number to the left:
...
@@ -33215,6 +33237,8 @@ string to perform cooperative advisory locking:
...
@@ -33215,6 +33237,8 @@ string to perform cooperative advisory locking:
@example
@example
mysql> SELECT GET_LOCK("lock1",10);
mysql> SELECT GET_LOCK("lock1",10);
-> 1
-> 1
mysql> SELECT IS_FREE_LOCK("lock2");
-> 1
mysql> SELECT GET_LOCK("lock2",10);
mysql> SELECT GET_LOCK("lock2",10);
-> 1
-> 1
mysql> SELECT RELEASE_LOCK("lock2");
mysql> SELECT RELEASE_LOCK("lock2");
...
@@ -33239,6 +33263,13 @@ been released.
...
@@ -33239,6 +33263,13 @@ been released.
The @code{DO} statement is convinient to use with @code{RELEASE_LOCK()}.
The @code{DO} statement is convinient to use with @code{RELEASE_LOCK()}.
@xref{DO}.
@xref{DO}.
@findex IS_FREE_LOCK()
@item IS_FREE_LOCK(str)
Checks if the the lock named @code{str} is free to use (i.e., not locked).
Returns @code{1} if the lock is free (no one is using the lock),
@code{0} if the lock is in use, and
@code{NULL} on errors (like incorrect arguments).
@findex BENCHMARK()
@findex BENCHMARK()
@item BENCHMARK(count,expr)
@item BENCHMARK(count,expr)
The @code{BENCHMARK()} function executes the expression @code{expr}
The @code{BENCHMARK()} function executes the expression @code{expr}
...
@@ -49578,47 +49609,19 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
...
@@ -49578,47 +49609,19 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@itemize @bullet
@item
@item
Added binary XOR.
Changed @code{--chroot=path} option to execute @code{chroot()} immediately
after all options have been parsed.
The one that with a query like :
@example
SELECT 11 ^ 3;
@end example
returns 8.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
@item
Don't allow database names that contain @samp{\}.
Added logical XOR.
The one that with a query like:
@example
SELECT 1 XOR 1;
@end example
returns 0;
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
@item
Add function @code{CHECK_LOCK("lock_name")}.
@code{lower_case_table_names} now also affects created and dropped databases.
This function returns a value indicating whether or not the lock with the
@item
given name is available.
Added @code{XOR} operator (logical and bitwise @code{XOR}) with @code{^}
It does not attempt to acquire a lock.
as a synonym for bitwise @code{XOR}.
It is used like this:
Added function @code{IS_FREE_LOCK("lock_name")}.
@example
SELECT CHECK_LOCK("some_lock");
@end example
@code{CHECK_LOCK()} returns 1 if the lock is available,
0 if the lock is held by any process (including the current process),
and @code{NULL} if an error occurs.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
@item
Removed @code{mysql_ssl_clear()}, as
this
was not needed.
Removed @code{mysql_ssl_clear()}, as
it
was not needed.
@item
@item
@code{DECIMAL} and @code{NUMERIC} types can now read exponential numbers.
@code{DECIMAL} and @code{NUMERIC} types can now read exponential numbers.
@item
@item
...
@@ -50225,7 +50228,7 @@ Added @code{@@@@VERSION} as a synonym for @code{VERSION()}.
...
@@ -50225,7 +50228,7 @@ Added @code{@@@@VERSION} as a synonym for @code{VERSION()}.
@item
@item
@code{SHOW VARIABLES LIKE 'xxx'} is now case-insensitive.
@code{SHOW VARIABLES LIKE 'xxx'} is now case-insensitive.
@item
@item
Fixed timeout for @code{GET_LOCK()} on HPUX with DCE threads.
Fixed timeout for @code{GET_LOCK()} on HP
-
UX with DCE threads.
@item
@item
Fixed memory allocation bug in the glibc library used to build Linux
Fixed memory allocation bug in the glibc library used to build Linux
binaries, which caused mysqld to die in 'free()'.
binaries, which caused mysqld to die in 'free()'.
acinclude.m4
View file @
e72b51a7
...
@@ -1211,8 +1211,10 @@ changequote(, )dnl
...
@@ -1211,8 +1211,10 @@ changequote(, )dnl
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
changequote([, ])dnl
changequote([, ])dnl
if test "$GCC" = yes; then
if test "$GCC" = yes; then
if $CC -v 2>&1 | grep 'version 2.95' > /dev/null 2>&1; then
ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
fi
fi
fi
;;
;;
# IRIX 6.2 and later require cc -n32.
# IRIX 6.2 and later require cc -n32.
changequote(, )dnl
changequote(, )dnl
...
...
client/mysql.cc
View file @
e72b51a7
...
@@ -1269,12 +1269,10 @@ You can turn off this feature to get a quicker startup with -A\n\n");
...
@@ -1269,12 +1269,10 @@ You can turn off this feature to get a quicker startup with -A\n\n");
/* for gnu readline */
/* for gnu readline */
#ifndef HAVE_INDEX
#ifndef HAVE_INDEX
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
extern
char
*
index
(
const
char
*
,
int
c
),
*
rindex
(
const
char
*
,
int
);
extern
char
*
index
(
const
char
*
,
pchar
c
),
*
rindex
(
const
char
*
,
pchar
);
char
*
index
(
const
char
*
s
,
pchar
c
)
char
*
index
(
const
char
*
s
,
int
c
)
{
{
for
(;;)
for
(;;)
{
{
...
@@ -1283,7 +1281,7 @@ char *index(const char *s,pchar c)
...
@@ -1283,7 +1281,7 @@ char *index(const char *s,pchar c)
}
}
}
}
char
*
rindex
(
const
char
*
s
,
pchar
c
)
char
*
rindex
(
const
char
*
s
,
int
c
)
{
{
reg3
char
*
t
;
reg3
char
*
t
;
...
@@ -1291,10 +1289,8 @@ char *rindex(const char *s,pchar c)
...
@@ -1291,10 +1289,8 @@ char *rindex(const char *s,pchar c)
do
if
(
*
s
==
(
char
)
c
)
t
=
(
char
*
)
s
;
while
(
*
s
++
);
do
if
(
*
s
==
(
char
)
c
)
t
=
(
char
*
)
s
;
while
(
*
s
++
);
return
(
char
*
)
t
;
return
(
char
*
)
t
;
}
}
#ifdef __cplusplus
}
}
#endif
#endif
#endif
#endif
/* HAVE_READLINE */
#endif
/* HAVE_READLINE */
...
...
client/mysqlbinlog.cc
View file @
e72b51a7
...
@@ -552,3 +552,5 @@ int main(int argc, char** argv)
...
@@ -552,3 +552,5 @@ int main(int argc, char** argv)
#else
#else
#include "log_event.cc"
#include "log_event.cc"
#endif
#endif
FIX_GCC_LINKING_PROBLEM
configure.in
View file @
e72b51a7
...
@@ -318,7 +318,7 @@ then
...
@@ -318,7 +318,7 @@ then
# mysqld doesn't use run-time-type-checking, so we disable it.
# mysqld doesn't use run-time-type-checking, so we disable it.
CXXFLAGS
=
"
$CXXFLAGS
-fno-implicit-templates -fno-exceptions -fno-rtti"
CXXFLAGS
=
"
$CXXFLAGS
-fno-implicit-templates -fno-exceptions -fno-rtti"
# If you are using 'gcc' 3.0 (not g++) to compile C++ programs,
# If you are using 'gcc' 3.0 (not g++) to compile C++ programs
on Linux
,
# we will gets some problems when linking static programs.
# we will gets some problems when linking static programs.
# The following code is used to fix this problem.
# The following code is used to fix this problem.
...
@@ -326,8 +326,7 @@ then
...
@@ -326,8 +326,7 @@ then
then
then
if
$CXX
-v
2>&1 |
grep
'version 3'
>
/dev/null 2>&1
if
$CXX
-v
2>&1 |
grep
'version 3'
>
/dev/null 2>&1
then
then
CXXFLAGS
=
"
$CXXFLAGS
-DUSE_MYSYS_NEW"
CXXFLAGS
=
"
$CXXFLAGS
-DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL"
CXXLDFLAGS
=
"
$CXXLDFLAGS
-Wl,--defsym -Wl,__cxa_pure_virtual=0"
fi
fi
fi
fi
fi
fi
...
...
include/my_global.h
View file @
e72b51a7
...
@@ -150,6 +150,13 @@
...
@@ -150,6 +150,13 @@
#define __LONG_MAX__ 2147483647
#define __LONG_MAX__ 2147483647
#endif
#endif
/* Fix problem when linking c++ programs with gcc 3.x */
#ifdef DEFINE_CXA_PURE_VIRTUAL
#define FIX_GCC_LINKING_PROBLEM extern "C" { int __cxa_pure_virtual() {return 0;} }
#else
#define FIX_GCC_LINKING_PROBLEM
#endif
/* egcs 1.1.2 has a problem with memcpy on Alpha */
/* egcs 1.1.2 has a problem with memcpy on Alpha */
#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
#define BAD_MEMCPY
#define BAD_MEMCPY
...
...
include/my_pthread.h
View file @
e72b51a7
...
@@ -429,6 +429,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
...
@@ -429,6 +429,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#endif
/* defined(__WIN__) */
#endif
/* defined(__WIN__) */
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#undef pthread_cond_timedwait
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
...
...
innobase/configure.in
View file @
e72b51a7
...
@@ -36,6 +36,7 @@ AC_PROG_RANLIB
...
@@ -36,6 +36,7 @@ AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_INSTALL
AC_CHECK_HEADERS(aio.h sched.h)
AC_CHECK_HEADERS(aio.h sched.h)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_FUNCS(sched_yield)
AC_CHECK_FUNCS(sched_yield)
AC_CHECK_FUNCS(fdatasync)
AC_CHECK_FUNCS(fdatasync)
#AC_CHECK_FUNCS(localtime_r) # Already checked by MySQL
#AC_CHECK_FUNCS(localtime_r) # Already checked by MySQL
...
...
innobase/ut/ut0ut.c
View file @
e72b51a7
...
@@ -27,11 +27,11 @@ ut_get_high32(
...
@@ -27,11 +27,11 @@ ut_get_high32(
/* out: a >> 32 */
/* out: a >> 32 */
ulint
a
)
/* in: ulint */
ulint
a
)
/* in: ulint */
{
{
if
(
sizeof
(
ulint
)
==
4
)
{
#if SIZEOF_LONG == 4
return
(
0
);
return
0
;
}
#else
return
(
a
>>
32
);
return
(
a
>>
32
);
#endif
}
}
/************************************************************
/************************************************************
...
...
mysql-test/r/func_test.result
View file @
e72b51a7
...
@@ -40,12 +40,12 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
...
@@ -40,12 +40,12 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
select -1.49 or -1.49,0.6 or 0.6;
select -1.49 or -1.49,0.6 or 0.6;
-1.49 or -1.49 0.6 or 0.6
-1.49 or -1.49 0.6 or 0.6
1 1
1 1
select 3 ^ 11;
select 3 ^ 11
, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1
;
3 ^ 11
3 ^ 11
1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
8
8
0 1 NULL NULL
select 1 XOR
0
;
select 1 XOR
1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL
;
1 XOR
0
1 XOR
1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
1
0 1 1 0 NULL NULL NULL
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
0 1
...
...
mysql-test/r/rpl_get_lock.result
View file @
e72b51a7
...
@@ -17,7 +17,13 @@ get_lock("lock",3)
...
@@ -17,7 +17,13 @@ get_lock("lock",3)
select * from t1;
select * from t1;
n
n
1
1
select check_lock("lock");
select is_free_lock("lock");
check_lock("lock")
is_free_lock("lock")
0
select is_free_lock("lock2");
is_free_lock("lock2")
1
1
select is_free_lock(NULL);
is_free_lock(NULL)
NULL
drop table t1;
drop table t1;
mysql-test/t/func_test.test
View file @
e72b51a7
...
@@ -15,8 +15,9 @@ select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between
...
@@ -15,8 +15,9 @@ select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between
select
'b'
between
'a'
and
'c'
,
'B'
between
'a'
and
'c'
;
select
'b'
between
'a'
and
'c'
,
'B'
between
'a'
and
'c'
;
select
2
in
(
3
,
2
,
5
,
9
,
5
,
1
),
"monty"
in
(
"david"
,
"monty"
,
"allan"
),
1.2
in
(
1.4
,
1.2
,
1.0
);
select
2
in
(
3
,
2
,
5
,
9
,
5
,
1
),
"monty"
in
(
"david"
,
"monty"
,
"allan"
),
1.2
in
(
1.4
,
1.2
,
1.0
);
select
-
1.49
or
-
1.49
,
0.6
or
0.6
;
select
-
1.49
or
-
1.49
,
0.6
or
0.6
;
select
3
^
11
;
select
3
^
11
,
1
^
1
,
1
^
0
,
1
^
NULL
,
NULL
^
1
;
select
1
XOR
0
;
select
1
XOR
1
,
1
XOR
0
,
0
XOR
1
,
0
XOR
0
,
NULL
XOR
1
,
1
XOR
NULL
,
0
XOR
NULL
;
#
#
# Wrong usage of functions
# Wrong usage of functions
#
#
...
...
mysql-test/t/rpl_get_lock.test
View file @
e72b51a7
...
@@ -21,8 +21,11 @@ connection slave;
...
@@ -21,8 +21,11 @@ connection slave;
sync_with_master
;
sync_with_master
;
select
get_lock
(
"lock"
,
3
);
select
get_lock
(
"lock"
,
3
);
select
*
from
t1
;
select
*
from
t1
;
select
is_free_lock
(
"lock"
);
# Check lock functions
select
is_free_lock
(
"lock2"
);
select
is_free_lock
(
NULL
);
connection
master1
;
connection
master1
;
select
check_lock
(
"lock"
);
drop
table
t1
;
drop
table
t1
;
save_master_pos
;
save_master_pos
;
connection
slave
;
connection
slave
;
...
...
mysys/my_tempnam.c
View file @
e72b51a7
...
@@ -109,13 +109,13 @@ my_string my_tempnam(const char *dir, const char *pfx,
...
@@ -109,13 +109,13 @@ my_string my_tempnam(const char *dir, const char *pfx,
old_env
=
(
char
**
)
environ
;
old_env
=
(
char
**
)
environ
;
if
(
dir
)
if
(
dir
)
{
/* Don't use TMPDIR if dir is given */
{
/* Don't use TMPDIR if dir is given */
environ
=
(
const
char
**
)
temp_env
;
/* May give warning */
((
char
**
)
environ
)
=
(
char
**
)
temp_env
;
temp_env
[
0
]
=
0
;
temp_env
[
0
]
=
0
;
}
}
#endif
#endif
res
=
tempnam
((
char
*
)
dir
,(
my_string
)
pfx
);
/* Use stand. dir with prefix */
res
=
tempnam
((
char
*
)
dir
,(
my_string
)
pfx
);
/* Use stand. dir with prefix */
#ifndef OS2
#ifndef OS2
environ
=
(
const
char
**
)
old_env
;
/* May give warning */
((
char
**
)
environ
)
=
(
char
**
)
old_env
;
#endif
#endif
if
(
!
res
)
if
(
!
res
)
DBUG_PRINT
(
"error"
,(
"Got error: %d from tempnam"
,
errno
));
DBUG_PRINT
(
"error"
,(
"Got error: %d from tempnam"
,
errno
));
...
...
sql/item_cmpfunc.cc
View file @
e72b51a7
...
@@ -1625,17 +1625,41 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
...
@@ -1625,17 +1625,41 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
}
}
}
}
/*
Make a logical XOR of the arguments.
SYNOPSIS
val_int()
DESCRIPTION
If either operator is NULL, return NULL.
NOTE
As we don't do any index optimization on XOR this is not going to be
very fast to use.
TODO (low priority)
Change this to be optimized as:
A XOR B -> (A) == 1 AND (B) <> 1) OR (A <> 1 AND (B) == 1)
To be able to do this, we would however first have to extend the MySQL
range optimizer to handle OR better.
*/
longlong
Item_cond_xor
::
val_int
()
longlong
Item_cond_xor
::
val_int
()
{
{
List_iterator
<
Item
>
li
(
list
);
List_iterator
<
Item
>
li
(
list
);
Item
*
item
;
Item
*
item
;
int
result
=
0
;
int
result
=
0
;
null_value
=
1
;
null_value
=
0
;
while
((
item
=
li
++
))
while
((
item
=
li
++
))
{
{
result
^=
(
item
->
val_int
()
!=
0
);
result
^=
(
item
->
val_int
()
!=
0
);
if
(
!
item
->
null_value
)
if
(
item
->
null_value
)
null_value
=
0
;
{
null_value
=
1
;
return
0
;
}
}
}
return
result
;
return
(
longlong
)
result
;
}
}
sql/item_create.cc
View file @
e72b51a7
...
@@ -429,9 +429,9 @@ Item *create_func_cast(Item *a, Item_cast cast_type)
...
@@ -429,9 +429,9 @@ Item *create_func_cast(Item *a, Item_cast cast_type)
return
res
;
return
res
;
}
}
Item
*
create_func_
check
_lock
(
Item
*
a
)
Item
*
create_func_
is_free
_lock
(
Item
*
a
)
{
{
current_thd
->
safe_to_cache_query
=
0
;
current_thd
->
safe_to_cache_query
=
0
;
return
new
Item_func_
check
_lock
(
a
);
return
new
Item_func_
is_free
_lock
(
a
);
}
}
sql/item_create.h
View file @
e72b51a7
...
@@ -91,4 +91,4 @@ Item *create_func_version(void);
...
@@ -91,4 +91,4 @@ Item *create_func_version(void);
Item
*
create_func_weekday
(
Item
*
a
);
Item
*
create_func_weekday
(
Item
*
a
);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_wait_for_master_pos
(
Item
*
a
,
Item
*
b
);
Item
*
create_wait_for_master_pos
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_
check
_lock
(
Item
*
a
);
Item
*
create_func_
is_free
_lock
(
Item
*
a
);
sql/item_func.cc
View file @
e72b51a7
...
@@ -2260,18 +2260,9 @@ double Item_func_match::val()
...
@@ -2260,18 +2260,9 @@ double Item_func_match::val()
longlong
Item_func_bit_xor
::
val_int
()
longlong
Item_func_bit_xor
::
val_int
()
{
{
ulonglong
arg1
=
(
ulonglong
)
args
[
0
]
->
val_int
();
ulonglong
arg1
=
(
ulonglong
)
args
[
0
]
->
val_int
();
if
(
args
[
0
]
->
null_value
)
{
null_value
=
1
;
return
0
;
}
ulonglong
arg2
=
(
ulonglong
)
args
[
1
]
->
val_int
();
ulonglong
arg2
=
(
ulonglong
)
args
[
1
]
->
val_int
();
if
(
args
[
1
]
->
null_value
)
if
((
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
)))
{
null_value
=
1
;
return
0
;
return
0
;
}
null_value
=
0
;
return
(
longlong
)
(
arg1
^
arg2
);
return
(
longlong
)
(
arg1
^
arg2
);
}
}
...
@@ -2295,12 +2286,17 @@ Item *get_system_var(LEX_STRING name)
...
@@ -2295,12 +2286,17 @@ Item *get_system_var(LEX_STRING name)
/*
/*
Check a user level lock.
Check a user level lock.
Returns 1: available
Returns 0: already taken
SYNOPSIS:
Returns NULL: Error
val_int()
RETURN VALUES
1 Available
0 Already taken
NULL Error
*/
*/
longlong
Item_func_
check
_lock
::
val_int
()
longlong
Item_func_
is_free
_lock
::
val_int
()
{
{
String
*
res
=
args
[
0
]
->
val_str
(
&
value
);
String
*
res
=
args
[
0
]
->
val_str
(
&
value
);
struct
timespec
abstime
;
struct
timespec
abstime
;
...
@@ -2309,23 +2305,17 @@ longlong Item_func_check_lock::val_int()
...
@@ -2309,23 +2305,17 @@ longlong Item_func_check_lock::val_int()
int
error
=
0
;
int
error
=
0
;
null_value
=
0
;
null_value
=
0
;
if
(
!
res
||
!
res
->
length
())
if
(
/* check_global_access(thd,SUPER_ACL) ||*/
!
res
||
!
res
->
length
())
{
{
null_value
=
1
;
null_value
=
1
;
return
0
;
return
0
;
}
}
pthread_mutex_lock
(
&
LOCK_user_locks
);
pthread_mutex_lock
(
&
LOCK_user_locks
);
ull
=
(
ULL
*
)
hash_search
(
&
hash_user_locks
,(
byte
*
)
res
->
ptr
(),
ull
=
(
ULL
*
)
hash_search
(
&
hash_user_locks
,(
byte
*
)
res
->
ptr
(),
res
->
length
());
res
->
length
());
pthread_mutex_unlock
(
&
LOCK_user_locks
);
pthread_mutex_unlock
(
&
LOCK_user_locks
);
if
(
!
ull
||
!
ull
->
locked
)
if
(
!
ull
||
!
ull
->
locked
)
return
1
;
return
1
;
return
0
;
return
0
;
}
}
sql/item_func.h
View file @
e72b51a7
...
@@ -1000,11 +1000,11 @@ class Item_func_bit_xor : public Item_int_func
...
@@ -1000,11 +1000,11 @@ class Item_func_bit_xor : public Item_int_func
void
fix_length_xor_dec
()
{
unsigned_flag
=
1
;
}
void
fix_length_xor_dec
()
{
unsigned_flag
=
1
;
}
};
};
class
Item_func_
check
_lock
:
public
Item_int_func
class
Item_func_
is_free
_lock
:
public
Item_int_func
{
{
String
value
;
String
value
;
public:
public:
Item_func_
check
_lock
(
Item
*
a
)
:
Item_int_func
(
a
)
{}
Item_func_
is_free
_lock
(
Item
*
a
)
:
Item_int_func
(
a
)
{}
longlong
val_int
();
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"check_lock"
;
}
const
char
*
func_name
()
const
{
return
"check_lock"
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
1
;
maybe_null
=
1
;}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
1
;
maybe_null
=
1
;}
...
...
sql/lex.h
View file @
e72b51a7
...
@@ -413,7 +413,6 @@ static SYMBOL sql_functions[] = {
...
@@ -413,7 +413,6 @@ static SYMBOL sql_functions[] = {
{
"BIT_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_bit_length
)},
{
"BIT_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_bit_length
)},
{
"CHAR_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHAR_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHARACTER_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHARACTER_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHECK_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_check_lock
)},
{
"COALESCE"
,
SYM
(
COALESCE
),
0
,
0
},
{
"COALESCE"
,
SYM
(
COALESCE
),
0
,
0
},
{
"CONCAT"
,
SYM
(
CONCAT
),
0
,
0
},
{
"CONCAT"
,
SYM
(
CONCAT
),
0
,
0
},
{
"CONCAT_WS"
,
SYM
(
CONCAT_WS
),
0
,
0
},
{
"CONCAT_WS"
,
SYM
(
CONCAT_WS
),
0
,
0
},
...
@@ -458,6 +457,7 @@ static SYMBOL sql_functions[] = {
...
@@ -458,6 +457,7 @@ static SYMBOL sql_functions[] = {
{
"INET_NTOA"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_inet_ntoa
)},
{
"INET_NTOA"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_inet_ntoa
)},
{
"INSTR"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_instr
)},
{
"INSTR"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_instr
)},
{
"ISNULL"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_isnull
)},
{
"ISNULL"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_isnull
)},
{
"IS_FREE_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_is_free_lock
)},
{
"LCASE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_lcase
)},
{
"LCASE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_lcase
)},
{
"LEAST"
,
SYM
(
LEAST_SYM
),
0
,
0
},
{
"LEAST"
,
SYM
(
LEAST_SYM
),
0
,
0
},
{
"LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_length
)},
{
"LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_length
)},
...
...
sql/mysqld.cc
View file @
e72b51a7
...
@@ -1014,8 +1014,6 @@ static void server_init(void)
...
@@ -1014,8 +1014,6 @@ static void server_init(void)
unireg_abort
(
1
);
unireg_abort
(
1
);
}
}
}
}
if
(
mysqld_chroot
)
set_root
(
mysqld_chroot
);
set_user
(
mysqld_user
);
// Works also with mysqld_user==NULL
set_user
(
mysqld_user
);
// Works also with mysqld_user==NULL
#ifdef __NT__
#ifdef __NT__
...
@@ -1838,7 +1836,7 @@ int main(int argc, char **argv)
...
@@ -1838,7 +1836,7 @@ int main(int argc, char **argv)
init_signals
();
init_signals
();
if
(
set_default_charset_by_name
(
default_charset
,
MYF
(
MY_WME
)))
if
(
set_default_charset_by_name
(
default_charset
,
MYF
(
MY_WME
)))
exit
(
1
);
exit
(
1
);
charsets_list
=
list_charsets
(
MYF
(
MY_COMPILED_SETS
|
MY_CONFIG_SETS
));
charsets_list
=
list_charsets
(
MYF
(
MY_COMPILED_SETS
|
MY_CONFIG_SETS
));
#ifdef HAVE_OPENSSL
#ifdef HAVE_OPENSSL
...
@@ -1906,7 +1904,7 @@ int main(int argc, char **argv)
...
@@ -1906,7 +1904,7 @@ int main(int argc, char **argv)
unireg_abort
(
1
);
unireg_abort
(
1
);
/*
/*
**
We have enough space for fiddling with the argv, continue
We have enough space for fiddling with the argv, continue
*/
*/
umask
(((
~
my_umask
)
&
0666
));
umask
(((
~
my_umask
)
&
0666
));
if
(
my_setwd
(
mysql_real_data_home
,
MYF
(
MY_WME
)))
if
(
my_setwd
(
mysql_real_data_home
,
MYF
(
MY_WME
)))
...
@@ -4430,6 +4428,8 @@ static void get_options(int argc,char **argv)
...
@@ -4430,6 +4428,8 @@ static void get_options(int argc,char **argv)
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
exit
(
ho_error
);
exit
(
ho_error
);
if
(
mysqld_chroot
)
set_root
(
mysqld_chroot
);
fix_paths
();
fix_paths
();
default_table_type_name
=
ha_table_typelib
.
type_names
[
default_table_type
-
1
];
default_table_type_name
=
ha_table_typelib
.
type_names
[
default_table_type
-
1
];
default_tx_isolation_name
=
tx_isolation_typelib
.
type_names
[
default_tx_isolation
];
default_tx_isolation_name
=
tx_isolation_typelib
.
type_names
[
default_tx_isolation
];
...
@@ -4651,4 +4651,6 @@ template class I_List<THD>;
...
@@ -4651,4 +4651,6 @@ template class I_List<THD>;
template
class
I_List_iterator
<
THD
>;
template
class
I_List_iterator
<
THD
>;
template
class
I_List
<
i_string
>;
template
class
I_List
<
i_string
>;
template
class
I_List
<
i_string_pair
>;
template
class
I_List
<
i_string_pair
>;
FIX_GCC_LINKING_PROBLEM
#endif
#endif
sql/sql_db.cc
View file @
e72b51a7
...
@@ -344,6 +344,8 @@ bool mysql_change_db(THD *thd,const char *name)
...
@@ -344,6 +344,8 @@ bool mysql_change_db(THD *thd,const char *name)
x_free
(
dbname
);
x_free
(
dbname
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
lower_case_table_names
)
casedn_str
(
dbname
);
DBUG_PRINT
(
"info"
,(
"Use database: %s"
,
dbname
));
DBUG_PRINT
(
"info"
,(
"Use database: %s"
,
dbname
));
if
(
test_all_bits
(
thd
->
master_access
,
DB_ACLS
))
if
(
test_all_bits
(
thd
->
master_access
,
DB_ACLS
))
db_access
=
DB_ACLS
;
db_access
=
DB_ACLS
;
...
...
sql/sql_parse.cc
View file @
e72b51a7
...
@@ -1035,6 +1035,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1035,6 +1035,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
db
?
db
:
"NULL"
);
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
db
?
db
:
"NULL"
);
break
;
break
;
}
}
if
(
lower_case_table_names
)
casedn_str
(
db
);
if
(
check_access
(
thd
,
CREATE_ACL
,
db
,
0
,
1
))
if
(
check_access
(
thd
,
CREATE_ACL
,
db
,
0
,
1
))
break
;
break
;
mysql_log
.
write
(
thd
,
command
,
packet
);
mysql_log
.
write
(
thd
,
command
,
packet
);
...
@@ -1051,6 +1053,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1051,6 +1053,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
db
?
db
:
"NULL"
);
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
db
?
db
:
"NULL"
);
break
;
break
;
}
}
if
(
lower_case_table_names
)
casedn_str
(
db
);
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
{
{
send_error
(
&
thd
->
net
,
ER_LOCK_OR_ACTIVE_TRANSACTION
);
send_error
(
&
thd
->
net
,
ER_LOCK_OR_ACTIVE_TRANSACTION
);
...
@@ -2239,6 +2243,8 @@ mysql_execute_command(void)
...
@@ -2239,6 +2243,8 @@ mysql_execute_command(void)
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
lex
->
name
);
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
lex
->
name
);
break
;
break
;
}
}
if
(
lower_case_table_names
)
casedn_str
(
lex
->
name
);
if
(
check_access
(
thd
,
CREATE_ACL
,
lex
->
name
,
0
,
1
))
if
(
check_access
(
thd
,
CREATE_ACL
,
lex
->
name
,
0
,
1
))
break
;
break
;
res
=
mysql_create_db
(
thd
,
lex
->
name
,
lex
->
create_info
.
options
,
0
);
res
=
mysql_create_db
(
thd
,
lex
->
name
,
lex
->
create_info
.
options
,
0
);
...
@@ -2251,6 +2257,8 @@ mysql_execute_command(void)
...
@@ -2251,6 +2257,8 @@ mysql_execute_command(void)
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
lex
->
name
);
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
lex
->
name
);
break
;
break
;
}
}
if
(
lower_case_table_names
)
casedn_str
(
lex
->
name
);
if
(
check_access
(
thd
,
DROP_ACL
,
lex
->
name
,
0
,
1
))
if
(
check_access
(
thd
,
DROP_ACL
,
lex
->
name
,
0
,
1
))
break
;
break
;
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
...
...
sql/sql_select.cc
View file @
e72b51a7
...
@@ -62,7 +62,7 @@ static void update_depend_map(JOIN *join);
...
@@ -62,7 +62,7 @@ static void update_depend_map(JOIN *join);
static
void
update_depend_map
(
JOIN
*
join
,
ORDER
*
order
);
static
void
update_depend_map
(
JOIN
*
join
,
ORDER
*
order
);
static
ORDER
*
remove_const
(
JOIN
*
join
,
ORDER
*
first_order
,
COND
*
cond
,
static
ORDER
*
remove_const
(
JOIN
*
join
,
ORDER
*
first_order
,
COND
*
cond
,
bool
*
simple_order
);
bool
*
simple_order
);
static
int
return_zero_rows
(
select_result
*
res
,
TABLE_LIST
*
tables
,
static
int
return_zero_rows
(
JOIN
*
join
,
select_result
*
res
,
TABLE_LIST
*
tables
,
List
<
Item
>
&
fields
,
bool
send_row
,
List
<
Item
>
&
fields
,
bool
send_row
,
uint
select_options
,
const
char
*
info
,
uint
select_options
,
const
char
*
info
,
Item
*
having
,
Procedure
*
proc
);
Item
*
having
,
Procedure
*
proc
);
...
@@ -145,7 +145,7 @@ static void init_sum_functions(Item_sum **func);
...
@@ -145,7 +145,7 @@ static void init_sum_functions(Item_sum **func);
static
bool
update_sum_func
(
Item_sum
**
func
);
static
bool
update_sum_func
(
Item_sum
**
func
);
static
void
select_describe
(
JOIN
*
join
,
bool
need_tmp_table
,
bool
need_order
,
static
void
select_describe
(
JOIN
*
join
,
bool
need_tmp_table
,
bool
need_order
,
bool
distinct
,
const
char
*
message
=
NullS
);
bool
distinct
,
const
char
*
message
=
NullS
);
static
void
describe_info
(
THD
*
thd
,
const
char
*
info
);
static
void
describe_info
(
JOIN
*
join
,
const
char
*
info
);
/*
/*
This handles SELECT with and without UNION
This handles SELECT with and without UNION
...
@@ -187,7 +187,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -187,7 +187,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
TABLE
*
tmp_table
;
TABLE
*
tmp_table
;
int
error
,
tmp_error
;
int
error
,
tmp_error
;
bool
need_tmp
,
hidden_group_fields
;
bool
need_tmp
,
hidden_group_fields
;
bool
simple_order
,
simple_group
,
no_order
,
skip_sort_order
,
buffer_result
;
bool
simple_order
,
simple_group
,
no_order
,
skip_sort_order
;
Item
::
cond_result
cond_value
;
Item
::
cond_result
cond_value
;
SQL_SELECT
*
select
;
SQL_SELECT
*
select
;
DYNAMIC_ARRAY
keyuse
;
DYNAMIC_ARRAY
keyuse
;
...
@@ -202,7 +202,6 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -202,7 +202,6 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
/* Check that all tables, fields, conds and order are ok */
/* Check that all tables, fields, conds and order are ok */
select_distinct
=
test
(
select_options
&
SELECT_DISTINCT
);
select_distinct
=
test
(
select_options
&
SELECT_DISTINCT
);
buffer_result
=
test
(
select_options
&
OPTION_BUFFER_RESULT
)
&&
!
test
(
select_options
&
OPTION_FOUND_ROWS
);
tmp_table
=
0
;
tmp_table
=
0
;
select
=
0
;
select
=
0
;
no_order
=
skip_sort_order
=
0
;
no_order
=
skip_sort_order
=
0
;
...
@@ -353,10 +352,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -353,10 +352,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
}
if
(
cond_value
==
Item
::
COND_FALSE
||
!
thd
->
select_limit
)
if
(
cond_value
==
Item
::
COND_FALSE
||
!
thd
->
select_limit
)
{
/* Impossible cond */
{
/* Impossible cond */
if
(
select_options
&
SELECT_DESCRIBE
&&
select_lex
->
next
)
error
=
return_zero_rows
(
&
join
,
result
,
tables
,
fields
,
select_describe
(
&
join
,
false
,
false
,
false
,
"Impossible WHERE"
);
else
error
=
return_zero_rows
(
result
,
tables
,
fields
,
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
!
group
,
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
!
group
,
select_options
,
"Impossible WHERE"
,
having
,
select_options
,
"Impossible WHERE"
,
having
,
procedure
);
procedure
);
...
@@ -372,10 +368,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -372,10 +368,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
{
{
if
(
res
<
0
)
if
(
res
<
0
)
{
{
if
(
select_options
&
SELECT_DESCRIBE
&&
select_lex
->
next
)
error
=
return_zero_rows
(
&
join
,
result
,
tables
,
fields
,
!
group
,
select_describe
(
&
join
,
false
,
false
,
false
,
"No matching min/max row"
);
else
error
=
return_zero_rows
(
result
,
tables
,
fields
,
!
group
,
select_options
,
"No matching min/max row"
,
select_options
,
"No matching min/max row"
,
having
,
procedure
);
having
,
procedure
);
delete
procedure
;
delete
procedure
;
...
@@ -383,10 +376,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -383,10 +376,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
}
if
(
select_options
&
SELECT_DESCRIBE
)
if
(
select_options
&
SELECT_DESCRIBE
)
{
{
if
(
select_lex
->
next
)
describe_info
(
&
join
,
"Select tables optimized away"
);
select_describe
(
&
join
,
false
,
false
,
false
,
"Select tables optimized away"
);
else
describe_info
(
thd
,
"Select tables optimized away"
);
delete
procedure
;
delete
procedure
;
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
@@ -397,12 +387,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -397,12 +387,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
{
// Only test of functions
{
// Only test of functions
error
=
0
;
error
=
0
;
if
(
select_options
&
SELECT_DESCRIBE
)
if
(
select_options
&
SELECT_DESCRIBE
)
{
describe_info
(
&
join
,
"No tables used"
);
if
(
select_lex
->
next
)
select_describe
(
&
join
,
false
,
false
,
false
,
"No tables used"
);
else
describe_info
(
thd
,
"No tables used"
);
}
else
else
{
{
result
->
send_fields
(
fields
,
1
);
result
->
send_fields
(
fields
,
1
);
...
@@ -435,7 +420,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -435,7 +420,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
if
(
join
.
const_table_map
!=
join
.
found_const_table_map
&&
if
(
join
.
const_table_map
!=
join
.
found_const_table_map
&&
!
(
select_options
&
SELECT_DESCRIBE
))
!
(
select_options
&
SELECT_DESCRIBE
))
{
{
error
=
return_zero_rows
(
result
,
tables
,
fields
,
error
=
return_zero_rows
(
&
join
,
result
,
tables
,
fields
,
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
!
group
,
0
,
""
,
having
,
procedure
);
!
group
,
0
,
""
,
having
,
procedure
);
goto
err
;
goto
err
;
...
@@ -480,10 +465,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -480,10 +465,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
}
if
(
make_join_select
(
&
join
,
select
,
conds
))
if
(
make_join_select
(
&
join
,
select
,
conds
))
{
{
if
(
select_options
&
SELECT_DESCRIBE
&&
select_lex
->
next
)
error
=
return_zero_rows
(
&
join
,
result
,
tables
,
fields
,
select_describe
(
&
join
,
false
,
false
,
false
,
"Impossible WHERE noticed after reading const tables"
);
else
error
=
return_zero_rows
(
result
,
tables
,
fields
,
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
!
group
,
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
!
group
,
select_options
,
select_options
,
"Impossible WHERE noticed after reading const tables"
,
"Impossible WHERE noticed after reading const tables"
,
...
@@ -546,21 +528,33 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -546,21 +528,33 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
simple_order
=
0
;
simple_order
=
0
;
}
}
/*
Check if we need to create a temporary table.
This has to be done if all tables are not already read (const tables)
and one of the following conditions holds:
- We are using DISTINCT (simple distinct's are already optimized away)
- We are using an ORDER BY or GROUP BY on fields not in the first table
- We are using different ORDER BY and GROUP BY orders
- The user wants us to buffer the result.
*/
need_tmp
=
(
join
.
const_tables
!=
join
.
tables
&&
need_tmp
=
(
join
.
const_tables
!=
join
.
tables
&&
((
select_distinct
||
!
simple_order
||
!
simple_group
)
||
((
select_distinct
||
!
simple_order
||
!
simple_group
)
||
(
group
&&
order
)
||
buffer_result
));
(
group
&&
order
)
||
test
(
select_options
&
OPTION_BUFFER_RESULT
)));
// No cache for MATCH
// No cache for MATCH
make_join_readinfo
(
&
join
,
make_join_readinfo
(
&
join
,
(
select_options
&
(
SELECT_DESCRIBE
|
(
select_options
&
(
SELECT_DESCRIBE
|
SELECT_NO_JOIN_CACHE
))
|
SELECT_NO_JOIN_CACHE
))
|
(
cur_sel
->
ftfunc_list
.
elements
?
SELECT_NO_JOIN_CACHE
:
0
));
(
cur_sel
->
ftfunc_list
.
elements
?
SELECT_NO_JOIN_CACHE
:
0
));
/* Need to tell Innobase that to play it safe, it should fetch all
/*
columns of the tables: this is because MySQL
Need to tell Innobase that to play it safe, it should fetch all
may build row pointers for the rows, and for all columns of the primary
columns of the tables: this is because MySQL may build row
key the field->query_id has not necessarily been set to thd->query_id
pointers for the rows, and for all columns of the primary key the
by MySQL. */
field->query_id has not necessarily been set to thd->query_id by
MySQL.
*/
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
if
(
need_tmp
||
select_distinct
||
group
||
order
)
if
(
need_tmp
||
select_distinct
||
group
||
order
)
...
@@ -2929,16 +2923,17 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
...
@@ -2929,16 +2923,17 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
DBUG_RETURN
(
first_order
);
DBUG_RETURN
(
first_order
);
}
}
static
int
static
int
return_zero_rows
(
select_result
*
result
,
TABLE_LIST
*
tables
,
List
<
Item
>
&
field
s
,
return_zero_rows
(
JOIN
*
join
,
select_result
*
result
,
TABLE_LIST
*
table
s
,
bool
send_row
,
uint
select_options
,
const
char
*
info
,
List
<
Item
>
&
fields
,
bool
send_row
,
uint
select_options
,
Item
*
having
,
Procedure
*
procedure
)
const
char
*
info
,
Item
*
having
,
Procedure
*
procedure
)
{
{
DBUG_ENTER
(
"return_zero_rows"
);
DBUG_ENTER
(
"return_zero_rows"
);
if
(
select_options
&
SELECT_DESCRIBE
)
if
(
select_options
&
SELECT_DESCRIBE
)
{
{
describe_info
(
current_thd
,
info
);
describe_info
(
join
,
info
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
if
(
procedure
)
if
(
procedure
)
...
@@ -7007,6 +7002,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7007,6 +7002,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
MYSQL_LOCK
*
save_lock
;
MYSQL_LOCK
*
save_lock
;
SELECT_LEX
*
select_lex
=
&
(
join
->
thd
->
lex
.
select_lex
);
SELECT_LEX
*
select_lex
=
&
(
join
->
thd
->
lex
.
select_lex
);
select_result
*
result
=
join
->
result
;
select_result
*
result
=
join
->
result
;
Item
*
item_null
=
new
Item_null
();
DBUG_ENTER
(
"select_describe"
);
DBUG_ENTER
(
"select_describe"
);
/* Don't log this into the slow query log */
/* Don't log this into the slow query log */
...
@@ -7034,13 +7030,9 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7034,13 +7030,9 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if
(
message
)
if
(
message
)
{
{
item_list
.
push_back
(
new
Item_empty_string
(
""
,
0
));
Item
*
empty
=
new
Item_empty_string
(
""
,
0
);
item_list
.
push_back
(
new
Item_empty_string
(
""
,
0
));
for
(
uint
i
=
0
;
i
<
7
;
i
++
)
item_list
.
push_back
(
new
Item_empty_string
(
""
,
0
));
item_list
.
push_back
(
empty
);
item_list
.
push_back
(
new
Item_empty_string
(
""
,
0
));
item_list
.
push_back
(
new
Item_empty_string
(
""
,
0
));
item_list
.
push_back
(
new
Item_empty_string
(
""
,
0
));
item_list
.
push_back
(
new
Item_empty_string
(
""
,
0
));
item_list
.
push_back
(
new
Item_string
(
message
,
strlen
(
message
)));
item_list
.
push_back
(
new
Item_string
(
message
,
strlen
(
message
)));
if
(
result
->
send_data
(
item_list
))
if
(
result
->
send_data
(
item_list
))
result
->
send_error
(
0
,
NullS
);
result
->
send_error
(
0
,
NullS
);
...
@@ -7053,15 +7045,19 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7053,15 +7045,19 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
JOIN_TAB
*
tab
=
join
->
join_tab
+
i
;
JOIN_TAB
*
tab
=
join
->
join_tab
+
i
;
TABLE
*
table
=
tab
->
table
;
TABLE
*
table
=
tab
->
table
;
char
buff
[
512
],
*
buff_ptr
=
buff
;
char
buff
[
512
],
*
buff_ptr
=
buff
;
char
buff1
[
512
],
buff2
[
512
],
buff
f
[
512
];
char
buff1
[
512
],
buff2
[
512
],
buff
3
[
512
];
String
tmp1
(
buff1
,
sizeof
(
buff1
));
String
tmp1
(
buff1
,
sizeof
(
buff1
));
String
tmp2
(
buff2
,
sizeof
(
buff2
));
String
tmp2
(
buff2
,
sizeof
(
buff2
));
tmp1
.
length
(
0
);
tmp2
.
length
(
0
);
item_list
.
empty
();
item_list
.
empty
();
if
(
tab
->
type
==
JT_ALL
&&
tab
->
select
&&
tab
->
select
->
quick
)
if
(
tab
->
type
==
JT_ALL
&&
tab
->
select
&&
tab
->
select
->
quick
)
tab
->
type
=
JT_RANGE
;
tab
->
type
=
JT_RANGE
;
item_list
.
push_back
(
new
Item_string
(
table
->
table_name
,
strlen
(
table
->
table_name
)));
item_list
.
push_back
(
new
Item_string
(
table
->
table_name
,
item_list
.
push_back
(
new
Item_string
(
join_type_str
[
tab
->
type
],
strlen
(
join_type_str
[
tab
->
type
])));
strlen
(
table
->
table_name
)));
tmp1
.
length
(
0
);
tmp2
.
length
(
0
);
item_list
.
push_back
(
new
Item_string
(
join_type_str
[
tab
->
type
],
strlen
(
join_type_str
[
tab
->
type
])));
key_map
bits
;
key_map
bits
;
uint
j
;
uint
j
;
for
(
j
=
0
,
bits
=
tab
->
keys
;
bits
;
j
++
,
bits
>>=
1
)
for
(
j
=
0
,
bits
=
tab
->
keys
;
bits
;
j
++
,
bits
>>=
1
)
...
@@ -7076,11 +7072,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7076,11 +7072,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if
(
tmp1
.
length
())
if
(
tmp1
.
length
())
item_list
.
push_back
(
new
Item_string
(
tmp1
.
ptr
(),
tmp1
.
length
()));
item_list
.
push_back
(
new
Item_string
(
tmp1
.
ptr
(),
tmp1
.
length
()));
else
else
item_list
.
push_back
(
new
Item_null
()
);
item_list
.
push_back
(
item_null
);
if
(
tab
->
ref
.
key_parts
)
if
(
tab
->
ref
.
key_parts
)
{
{
item_list
.
push_back
(
new
Item_string
(
table
->
key_info
[
tab
->
ref
.
key
].
name
,
KEY
*
key_info
=
table
->
key_info
+
tab
->
ref
.
key
;
strlen
(
table
->
key_info
[
tab
->
ref
.
key
].
name
)));
item_list
.
push_back
(
new
Item_string
(
key_info
->
name
,
strlen
(
key_info
->
name
)));
item_list
.
push_back
(
new
Item_int
((
int32
)
tab
->
ref
.
key_length
));
item_list
.
push_back
(
new
Item_int
((
int32
)
tab
->
ref
.
key_length
));
for
(
store_key
**
ref
=
tab
->
ref
.
key_copy
;
*
ref
;
ref
++
)
for
(
store_key
**
ref
=
tab
->
ref
.
key_copy
;
*
ref
;
ref
++
)
{
{
...
@@ -7092,24 +7089,28 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7092,24 +7089,28 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
}
else
if
(
tab
->
type
==
JT_NEXT
)
else
if
(
tab
->
type
==
JT_NEXT
)
{
{
item_list
.
push_back
(
new
Item_string
(
table
->
key_info
[
tab
->
index
].
name
,
strlen
(
table
->
key_info
[
tab
->
index
].
name
)));
KEY
*
key_info
=
table
->
key_info
+
tab
->
index
;
item_list
.
push_back
(
new
Item_int
((
int32
)
table
->
key_info
[
tab
->
index
].
key_length
));
item_list
.
push_back
(
new
Item_string
(
key_info
->
name
,
item_list
.
push_back
(
new
Item_null
());
strlen
(
key_info
->
name
)));
item_list
.
push_back
(
new
Item_int
((
int32
)
key_info
->
key_length
));
item_list
.
push_back
(
item_null
);
}
}
else
if
(
tab
->
select
&&
tab
->
select
->
quick
)
else
if
(
tab
->
select
&&
tab
->
select
->
quick
)
{
{
item_list
.
push_back
(
new
Item_string
(
table
->
key_info
[
tab
->
select
->
quick
->
index
].
name
,
strlen
(
table
->
key_info
[
tab
->
select
->
quick
->
index
].
name
)));
KEY
*
key_info
=
table
->
key_info
+
tab
->
select
->
quick
->
index
;
item_list
.
push_back
(
new
Item_string
(
key_info
->
name
,
strlen
(
key_info
->
name
)));
item_list
.
push_back
(
new
Item_int
((
int32
)
tab
->
select
->
quick
->
max_used_key_length
));
item_list
.
push_back
(
new
Item_int
((
int32
)
tab
->
select
->
quick
->
max_used_key_length
));
item_list
.
push_back
(
new
Item_null
()
);
item_list
.
push_back
(
item_null
);
}
}
else
else
{
{
item_list
.
push_back
(
new
Item_null
()
);
item_list
.
push_back
(
item_null
);
item_list
.
push_back
(
new
Item_null
()
);
item_list
.
push_back
(
item_null
);
item_list
.
push_back
(
new
Item_null
()
);
item_list
.
push_back
(
item_null
);
}
}
sprintf
(
buff
f
,
"%.0f"
,
join
->
best_positions
[
i
].
records_read
);
sprintf
(
buff
3
,
"%.0f"
,
join
->
best_positions
[
i
].
records_read
);
item_list
.
push_back
(
new
Item_string
(
buff
f
,
strlen
(
bufff
)));
item_list
.
push_back
(
new
Item_string
(
buff
3
,
strlen
(
buff3
)));
my_bool
key_read
=
table
->
key_read
;
my_bool
key_read
=
table
->
key_read
;
if
(
tab
->
type
==
JT_NEXT
&&
if
(
tab
->
type
==
JT_NEXT
&&
((
table
->
used_keys
&
((
key_map
)
1
<<
tab
->
index
))))
((
table
->
used_keys
&
((
key_map
)
1
<<
tab
->
index
))))
...
@@ -7177,7 +7178,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7177,7 +7178,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
result
->
send_error
(
0
,
NullS
);
result
->
send_error
(
0
,
NullS
);
}
}
}
}
if
(
!
join
->
thd
->
lex
.
select
->
next
)
if
(
!
thd
->
lex
.
select
->
next
)
// Not union
{
{
save_lock
=
thd
->
lock
;
save_lock
=
thd
->
lock
;
thd
->
lock
=
(
MYSQL_LOCK
*
)
0
;
thd
->
lock
=
(
MYSQL_LOCK
*
)
0
;
...
@@ -7188,13 +7189,21 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7188,13 +7189,21 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
}
static
void
describe_info
(
THD
*
thd
,
const
char
*
info
)
static
void
describe_info
(
JOIN
*
join
,
const
char
*
info
)
{
{
THD
*
thd
=
join
->
thd
;
if
(
thd
->
lex
.
select_lex
.
next
)
/* If in UNION */
{
select_describe
(
join
,
FALSE
,
FALSE
,
FALSE
,
info
);
return
;
}
List
<
Item
>
field_list
;
List
<
Item
>
field_list
;
String
*
packet
=
&
thd
->
packet
;
String
*
packet
=
&
thd
->
packet
;
/* Don't log this into the slow query log */
/* Don't log this into the slow query log */
thd
->
lex
.
select_lex
.
options
&=
~
(
QUERY_NO_INDEX_USED
|
QUERY_NO_GOOD_INDEX_USED
);
thd
->
lex
.
select_lex
.
options
&=
~
(
QUERY_NO_INDEX_USED
|
QUERY_NO_GOOD_INDEX_USED
);
field_list
.
push_back
(
new
Item_empty_string
(
"Comment"
,
80
));
field_list
.
push_back
(
new
Item_empty_string
(
"Comment"
,
80
));
if
(
send_fields
(
thd
,
field_list
,
1
))
if
(
send_fields
(
thd
,
field_list
,
1
))
return
;
/* purecov: inspected */
return
;
/* purecov: inspected */
...
...
sql/table.cc
View file @
e72b51a7
...
@@ -1078,7 +1078,8 @@ bool check_db_name(const char *name)
...
@@ -1078,7 +1078,8 @@ bool check_db_name(const char *name)
}
}
}
}
#endif
#endif
if
(
*
name
==
'/'
||
*
name
==
FN_LIBCHAR
||
*
name
==
FN_EXTCHAR
)
if
(
*
name
==
'/'
||
*
name
==
'\\'
||
*
name
==
FN_LIBCHAR
||
*
name
==
FN_EXTCHAR
)
return
1
;
return
1
;
name
++
;
name
++
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment