Commit 4447937d authored by serg@sergbook.mysql.com's avatar serg@sergbook.mysql.com

Merge work:/home/bk/mysql-4.0

into sergbook.mysql.com:/usr/home/serg/Abk/mysql-4.0
parents ac26ba18 9acfbcdc
......@@ -2,12 +2,12 @@
use Getopt::Long;
$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_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;
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_distribution);
......@@ -172,8 +172,11 @@ if ($opt_stage <= 1)
if ($opt_stage <= 2)
{
my ($command);
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'
--dbd-options 'options'
Options for Makefile.PL when configuring msql-mysql-modules.
--make-options 'options'
Options to make after configure. (Like 'CXXLD=gcc')
--version-suffix suffix
Can be used to set a suffix (normally 'com' or '-max') for a distribution
......
......@@ -5710,7 +5710,8 @@ FreeBSD 2.x with the included MIT-pthreads package. @xref{FreeBSD}.
@item
FreeBSD 3.x and 4.x with native threads. @xref{FreeBSD}.
@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
HP-UX 11.x with the native threads. @xref{HP-UX 11.x}.
@item
......@@ -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
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
because it can't compile @code{.S} (assembler) files.
The following configure line should work:
The following configure line should work with gcc 2.95:
@example
CFLAGS="-DHPUX -I/opt/dce/include -fpic" \
CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions \
CFLAGS="-I/opt/dce/include -fpic" \
CXXFLAGS="-I/opt/dce/include -felide-constructors -fno-exceptions \
-fno-rtti" CXX=gcc ./configure --with-pthread \
--with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
@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
@subsubsection HP-UX Version 11.x Notes
......@@ -14146,9 +14137,9 @@ IP address to bind to.
Directory where character sets are. @xref{Character sets}.
@item --chroot=path
Chroot @code{mysqld} daemon during startup. Recommended security measure. It will
somewhat limit @code{LOAD DATA INFILE} and @code{SELECT ... INTO OUTFILE}
though.
Put @code{mysqld} daemon in chroot environment at startup. Recommended
security measure. It somewhat limits @code{LOAD DATA INFILE} and
@code{SELECT ... INTO OUTFILE} though.
@item --core-file
Write a core file if @code{mysqld} dies. For some systems you must also
......@@ -28290,7 +28281,7 @@ in ANSI mode. @xref{ANSI mode}.
@multitable @columnfractions .15 .15 .70
@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 Column @tab 64 @tab All characters.
@item Alias @tab 255 @tab All characters.
......@@ -30746,6 +30737,22 @@ mysql> SELECT 1 && 0;
mysql> SELECT 1 && NULL;
-> NULL
@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
......@@ -32817,7 +32824,7 @@ The result is an unsigned 64-bit integer.
@findex & (bitwise AND)
@findex AND, bitwise
@item &
Bitwise AND:
Bitwise AND
@example
mysql> SELECT 29 & 15;
-> 13
......@@ -32825,6 +32832,21 @@ mysql> SELECT 29 & 15;
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)
@item <<
Shifts a longlong (@code{BIGINT}) number to the left:
......@@ -33215,6 +33237,8 @@ string to perform cooperative advisory locking:
@example
mysql> SELECT GET_LOCK("lock1",10);
-> 1
mysql> SELECT IS_FREE_LOCK("lock2");
-> 1
mysql> SELECT GET_LOCK("lock2",10);
-> 1
mysql> SELECT RELEASE_LOCK("lock2");
......@@ -33239,6 +33263,13 @@ been released.
The @code{DO} statement is convinient to use with @code{RELEASE_LOCK()}.
@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()
@item BENCHMARK(count,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}.
@itemize @bullet
@item
Added binary XOR.
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}.
Changed @code{--chroot=path} option to execute @code{chroot()} immediately
after all options have been parsed.
@item
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}.
Don't allow database names that contain @samp{\}.
@item
Add function @code{CHECK_LOCK("lock_name")}.
This function returns a value indicating whether or not the lock with the
given name is available.
It does not attempt to acquire a lock.
It is used like this:
@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.
@code{lower_case_table_names} now also affects created and dropped databases.
@item
Added @code{XOR} operator (logical and bitwise @code{XOR}) with @code{^}
as a synonym for bitwise @code{XOR}.
Added function @code{IS_FREE_LOCK("lock_name")}.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
Removed @code{mysql_ssl_clear()}, as this was not needed.
Removed @code{mysql_ssl_clear()}, as it was not needed.
@item
@code{DECIMAL} and @code{NUMERIC} types can now read exponential numbers.
@item
......@@ -50225,7 +50228,7 @@ Added @code{@@@@VERSION} as a synonym for @code{VERSION()}.
@item
@code{SHOW VARIABLES LIKE 'xxx'} is now case-insensitive.
@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
Fixed memory allocation bug in the glibc library used to build Linux
binaries, which caused mysqld to die in 'free()'.
......@@ -1210,10 +1210,12 @@ AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
changequote(, )dnl
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
changequote([, ])dnl
if test "$GCC" = yes; then
ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
fi
;;
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__
fi
fi
;;
# IRIX 6.2 and later require cc -n32.
changequote(, )dnl
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
......
......@@ -1269,12 +1269,10 @@ You can turn off this feature to get a quicker startup with -A\n\n");
/* for gnu readline */
#ifndef HAVE_INDEX
#ifdef __cplusplus
extern "C" {
#endif
extern char *index(const char *,pchar c),*rindex(const char *,pchar);
extern char *index(const char *,int c),*rindex(const char *,int);
char *index(const char *s,pchar c)
char *index(const char *s,int c)
{
for (;;)
{
......@@ -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;
......@@ -1291,10 +1289,8 @@ char *rindex(const char *s,pchar c)
do if (*s == (char) c) t = (char*) s; while (*s++);
return (char*) t;
}
#ifdef __cplusplus
}
#endif
#endif
#endif /* HAVE_READLINE */
......
......@@ -552,3 +552,5 @@ int main(int argc, char** argv)
#else
#include "log_event.cc"
#endif
FIX_GCC_LINKING_PROBLEM
......@@ -318,7 +318,7 @@ then
# mysqld doesn't use run-time-type-checking, so we disable it.
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.
# The following code is used to fix this problem.
......@@ -326,8 +326,7 @@ then
then
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
then
CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW"
CXXLDFLAGS="$CXXLDFLAGS -Wl,--defsym -Wl,__cxa_pure_virtual=0"
CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL"
fi
fi
fi
......
......@@ -150,6 +150,13 @@
#define __LONG_MAX__ 2147483647
#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 */
#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
#define BAD_MEMCPY
......
......@@ -429,6 +429,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#endif /* defined(__WIN__) */
#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_mutex_trylock(a) my_pthread_mutex_trylock((a))
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
......
......@@ -36,6 +36,7 @@ AC_PROG_RANLIB
AC_PROG_INSTALL
AC_CHECK_HEADERS(aio.h sched.h)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_FUNCS(sched_yield)
AC_CHECK_FUNCS(fdatasync)
#AC_CHECK_FUNCS(localtime_r) # Already checked by MySQL
......
......@@ -27,11 +27,11 @@ ut_get_high32(
/* out: a >> 32 */
ulint a) /* in: ulint */
{
if (sizeof(ulint) == 4) {
return(0);
}
#if SIZEOF_LONG == 4
return 0;
#else
return(a >> 32);
#endif
}
/************************************************************
......
......@@ -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;
-1.49 or -1.49 0.6 or 0.6
1 1
select 3 ^ 11;
3 ^ 11
8
select 1 XOR 0;
1 XOR 0
1
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
8 0 1 NULL NULL
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
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;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
......
......@@ -17,7 +17,13 @@ get_lock("lock",3)
select * from t1;
n
1
select check_lock("lock");
check_lock("lock")
select is_free_lock("lock");
is_free_lock("lock")
0
select is_free_lock("lock2");
is_free_lock("lock2")
1
select is_free_lock(NULL);
is_free_lock(NULL)
NULL
drop table t1;
......@@ -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 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 3 ^ 11;
select 1 XOR 0;
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
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
#
......
......@@ -21,8 +21,11 @@ connection slave;
sync_with_master;
select get_lock("lock",3);
select * from t1;
select is_free_lock("lock");
# Check lock functions
select is_free_lock("lock2");
select is_free_lock(NULL);
connection master1;
select check_lock("lock");
drop table t1;
save_master_pos;
connection slave;
......
......@@ -109,13 +109,13 @@ my_string my_tempnam(const char *dir, const char *pfx,
old_env=(char**)environ;
if (dir)
{ /* 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;
}
#endif
res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
#ifndef OS2
environ=(const char**)old_env; /* May give warning */
((char**) environ)=(char**) old_env;
#endif
if (!res)
DBUG_PRINT("error",("Got error: %d from tempnam",errno));
......
......@@ -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()
{
List_iterator<Item> li(list);
Item *item;
int result=0;
null_value=1;
null_value=0;
while ((item=li++))
{
result ^= (item->val_int() != 0);
if (!item->null_value)
null_value=0;
result^= (item->val_int() != 0);
if (item->null_value)
{
null_value=1;
return 0;
}
}
return result;
return (longlong) result;
}
......@@ -429,9 +429,9 @@ Item *create_func_cast(Item *a, Item_cast cast_type)
return res;
}
Item *create_func_check_lock(Item* a)
Item *create_func_is_free_lock(Item* a)
{
current_thd->safe_to_cache_query=0;
return new Item_func_check_lock(a);
return new Item_func_is_free_lock(a);
}
......@@ -91,4 +91,4 @@ Item *create_func_version(void);
Item *create_func_weekday(Item* a);
Item *create_load_file(Item* a);
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);
......@@ -2260,18 +2260,9 @@ double Item_func_match::val()
longlong Item_func_bit_xor::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();
if (args[1]->null_value)
{
null_value=1;
if ((null_value= (args[0]->null_value || args[1]->null_value)))
return 0;
}
null_value=0;
return (longlong) (arg1 ^ arg2);
}
......@@ -2295,12 +2286,17 @@ Item *get_system_var(LEX_STRING name)
/*
Check a user level lock.
Returns 1: available
Returns 0: already taken
Returns NULL: Error
SYNOPSIS:
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);
struct timespec abstime;
......@@ -2309,23 +2305,17 @@ longlong Item_func_check_lock::val_int()
int error=0;
null_value=0;
if (/* check_global_access(thd,SUPER_ACL) ||*/ !res || !res->length())
if (!res || !res->length())
{
null_value=1;
return 0;
}
pthread_mutex_lock(&LOCK_user_locks);
ull= (ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(),
res->length());
pthread_mutex_unlock(&LOCK_user_locks);
if (!ull || !ull->locked)
return 1;
return 0;
}
......@@ -1000,11 +1000,11 @@ public:
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;
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();
const char *func_name() const { return "check_lock"; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
......
......@@ -413,7 +413,6 @@ static SYMBOL sql_functions[] = {
{ "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_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)},
{ "CHECK_LOCK", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_check_lock)},
{ "COALESCE", SYM(COALESCE),0,0},
{ "CONCAT", SYM(CONCAT),0,0},
{ "CONCAT_WS", SYM(CONCAT_WS),0,0},
......@@ -458,6 +457,7 @@ static SYMBOL sql_functions[] = {
{ "INET_NTOA", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_inet_ntoa)},
{ "INSTR", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_instr)},
{ "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)},
{ "LEAST", SYM(LEAST_SYM),0,0},
{ "LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_length)},
......
......@@ -1014,8 +1014,6 @@ static void server_init(void)
unireg_abort(1);
}
}
if (mysqld_chroot)
set_root(mysqld_chroot);
set_user(mysqld_user); // Works also with mysqld_user==NULL
#ifdef __NT__
......@@ -1838,7 +1836,7 @@ int main(int argc, char **argv)
init_signals();
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));
#ifdef HAVE_OPENSSL
......@@ -1906,7 +1904,7 @@ int main(int argc, char **argv)
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));
if (my_setwd(mysql_real_data_home,MYF(MY_WME)))
......@@ -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)))
exit(ho_error);
if (mysqld_chroot)
set_root(mysqld_chroot);
fix_paths();
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];
......@@ -4651,4 +4651,6 @@ template class I_List<THD>;
template class I_List_iterator<THD>;
template class I_List<i_string>;
template class I_List<i_string_pair>;
FIX_GCC_LINKING_PROBLEM
#endif
......@@ -344,6 +344,8 @@ bool mysql_change_db(THD *thd,const char *name)
x_free(dbname);
DBUG_RETURN(1);
}
if (lower_case_table_names)
casedn_str(dbname);
DBUG_PRINT("info",("Use database: %s", dbname));
if (test_all_bits(thd->master_access,DB_ACLS))
db_access=DB_ACLS;
......
......@@ -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");
break;
}
if (lower_case_table_names)
casedn_str(db);
if (check_access(thd,CREATE_ACL,db,0,1))
break;
mysql_log.write(thd,command,packet);
......@@ -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");
break;
}
if (lower_case_table_names)
casedn_str(db);
if (thd->locked_tables || thd->active_transaction())
{
send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION);
......@@ -2239,6 +2243,8 @@ mysql_execute_command(void)
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
break;
}
if (lower_case_table_names)
casedn_str(lex->name);
if (check_access(thd,CREATE_ACL,lex->name,0,1))
break;
res=mysql_create_db(thd,lex->name,lex->create_info.options,0);
......@@ -2251,6 +2257,8 @@ mysql_execute_command(void)
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
break;
}
if (lower_case_table_names)
casedn_str(lex->name);
if (check_access(thd,DROP_ACL,lex->name,0,1))
break;
if (thd->locked_tables || thd->active_transaction())
......
This diff is collapsed.
......@@ -1078,7 +1078,8 @@ bool check_db_name(const char *name)
}
}
#endif
if (*name == '/' || *name == FN_LIBCHAR || *name == FN_EXTCHAR)
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR)
return 1;
name++;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment