Commit 72671338 authored by sasha@mysql.sashanet.com's avatar sasha@mysql.sashanet.com

merged

parents 89ac8682 5b7da426
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
*.lo *.lo
*.o *.o
*.spec *.spec
*/*_pure_*warnings
*/.pure
*~ *~
.*.swp .*.swp
.deps .deps
...@@ -121,6 +123,7 @@ bdb/include/gen_server_ext.h ...@@ -121,6 +123,7 @@ bdb/include/gen_server_ext.h
bdb/include/hash_auto.h bdb/include/hash_auto.h
bdb/include/log_auto.h bdb/include/log_auto.h
bdb/include/qam_auto.h bdb/include/qam_auto.h
bdb/include/rpc_client_ext.h
bdb/include/rpc_server_ext.h bdb/include/rpc_server_ext.h
bdb/include/txn_auto.h bdb/include/txn_auto.h
bdb/java/src/com/sleepycat/db/DbConstants.java bdb/java/src/com/sleepycat/db/DbConstants.java
...@@ -175,6 +178,7 @@ heap/hp_test2 ...@@ -175,6 +178,7 @@ heap/hp_test2
include/my_config.h include/my_config.h
include/my_global.h include/my_global.h
include/mysql_version.h include/mysql_version.h
include/widec.h
innobase/ib_config.h innobase/ib_config.h
innobase/ib_config.h.in innobase/ib_config.h.in
isam/isamchk isam/isamchk
......
#! /bin/sh #! /bin/sh
path=`dirname $0` gmake -k clean || true
. "$path/SETUP.sh" /bin/rm -f */.deps/*.P config.cache
aclocal && autoheader && aclocal && automake && autoconf
(cd bdb/dist && sh s_all)
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
if [ -d gemini ]
then
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
fi
CFLAGS="-g -Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
extra_flags="$sparc_cflags $fast_cflags" gmake -j 4
extra_configs="$sparc_configs"
. "$path/FINISH.sh"
...@@ -6,6 +6,8 @@ aclocal && autoheader && aclocal && automake && autoconf ...@@ -6,6 +6,8 @@ aclocal && autoheader && aclocal && automake && autoconf
(cd bdb/dist && sh s_all) (cd bdb/dist && sh s_all)
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf) (cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
CFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -O2" CXX=gcc CXXFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_PURIFY -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-debug=full CFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_purify -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-debug=full --with-berkeley-db --with-innodb
gmake -j 4 gmake -j 4
cd sql ; rm mysqld ; make CXXLD="purify -best-effort g++" mysqld
...@@ -7,6 +7,7 @@ jcole@abel.spaceapes.com ...@@ -7,6 +7,7 @@ jcole@abel.spaceapes.com
jcole@main.burghcom.com jcole@main.burghcom.com
jcole@tetra.spaceapes.com jcole@tetra.spaceapes.com
miguel@light.local miguel@light.local
monty@bitch.mysql.fi
monty@donna.mysql.fi monty@donna.mysql.fi
monty@hundin.mysql.fi monty@hundin.mysql.fi
monty@tik.mysql.fi monty@tik.mysql.fi
...@@ -17,6 +18,7 @@ paul@teton.kitebird.com ...@@ -17,6 +18,7 @@ paul@teton.kitebird.com
root@x3.internalnet root@x3.internalnet
sasha@mysql.sashanet.com sasha@mysql.sashanet.com
serg@serg.mysql.com serg@serg.mysql.com
tim@bitch.mysql.fi
tim@black.box tim@black.box
tim@hundin.mysql.fi tim@hundin.mysql.fi
tim@threads.polyesthetic.msg tim@threads.polyesthetic.msg
......
This diff is collapsed.
/* DO NOT EDIT: automatically built by dist/s_include. */
#ifndef _rpc_client_ext_h_
#define _rpc_client_ext_h_
#if defined(__cplusplus)
extern "C" {
#endif
int __dbcl_envserver __P((DB_ENV *, char *, long, long, u_int32_t));
int __dbcl_refresh __P((DB_ENV *));
int __dbcl_txn_close __P((DB_ENV *));
void __dbcl_txn_end __P((DB_TXN *));
int __dbcl_c_destroy __P((DBC *));
void __dbcl_c_refresh __P((DBC *));
int __dbcl_c_setup __P((long, DB *, DBC **));
int __dbcl_retcopy __P((DB_ENV *, DBT *, void *, u_int32_t));
int __dbcl_dbclose_common __P((DB *));
#if defined(__cplusplus)
}
#endif
#endif /* _rpc_client_ext_h_ */
...@@ -137,7 +137,7 @@ the mysql command line client\n\n"); ...@@ -137,7 +137,7 @@ the mysql command line client\n\n");
-o, --offset=N Skip the first N entries\n\ -o, --offset=N Skip the first N entries\n\
-h, --host=server Get the binlog from server\n\ -h, --host=server Get the binlog from server\n\
-P, --port=port Use port to connect to the remote server\n\ -P, --port=port Use port to connect to the remote server\n\
-u, --user=username Connect to the remove server as username\n\ -u, --user=username Connect to the remote server as username\n\
-p, --password=password Password to connect to remote server\n\ -p, --password=password Password to connect to remote server\n\
-r, --result-file=file Direct output to a given file\n\ -r, --result-file=file Direct output to a given file\n\
-j, --position=N Start reading the binlog at position N\n\ -j, --position=N Start reading the binlog at position N\n\
...@@ -467,4 +467,8 @@ int main(int argc, char** argv) ...@@ -467,4 +467,8 @@ int main(int argc, char** argv)
the server the server
*/ */
#ifdef __WIN__
#include "log_event.cpp"
#else
#include "log_event.cc" #include "log_event.cc"
#endif
...@@ -226,6 +226,8 @@ void hash_password(unsigned long *result, const char *password); ...@@ -226,6 +226,8 @@ void hash_password(unsigned long *result, const char *password);
void my_init(void); void my_init(void);
void load_defaults(const char *conf_file, const char **groups, void load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv); int *argc, char ***argv);
my_bool my_thread_init(void);
void my_thread_end(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -216,4 +216,5 @@ ...@@ -216,4 +216,5 @@
#define ER_ERROR_WHEN_EXECUTING_COMMAND 1213 #define ER_ERROR_WHEN_EXECUTING_COMMAND 1213
#define ER_WRONG_USAGE 1214 #define ER_WRONG_USAGE 1214
#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1215 #define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1215
#define ER_ERROR_MESSAGES 216 #define ER_NO_PERSMISSION_TO_CREATE_USER 1216
#define ER_ERROR_MESSAGES 217
...@@ -10,6 +10,7 @@ Created 11/11/1995 Heikki Tuuri ...@@ -10,6 +10,7 @@ Created 11/11/1995 Heikki Tuuri
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
#include "buf0flu.ic" #include "buf0flu.ic"
#include "trx0sys.h"
#endif #endif
#include "ut0byte.h" #include "ut0byte.h"
......
...@@ -9,12 +9,10 @@ Created 1/20/1994 Heikki Tuuri ...@@ -9,12 +9,10 @@ Created 1/20/1994 Heikki Tuuri
#ifndef univ_i #ifndef univ_i
#define univ_i #define univ_i
#if (defined(_WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64)) && !defined(MYSQL_SERVER)
#define __WIN__ #define __WIN__
#ifndef MYSQL_SERVER
#include <windows.h> #include <windows.h>
#endif
/* If you want to check for errors with compiler level -W4, /* If you want to check for errors with compiler level -W4,
comment out the above include of windows.h and let the following defines comment out the above include of windows.h and let the following defines
......
...@@ -167,3 +167,9 @@ a sec_to_time(sum(time_to_sec(t))) ...@@ -167,3 +167,9 @@ a sec_to_time(sum(time_to_sec(t)))
a sec_to_time(sum(time_to_sec(t))) a sec_to_time(sum(time_to_sec(t)))
1 00:06:15 1 00:06:15
1 00:36:30 1 00:36:30
a
4
3
a c
4 NULL
3 NULL
Table Op Msg_type Msg_text
test.test check status OK
...@@ -438,7 +438,7 @@ hello 1 ...@@ -438,7 +438,7 @@ hello 1
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize error The handler for the table doesn't support check/repair test.t1 optimize error The handler for the table doesn't support check/repair
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
t1 0 PRIMARY 1 a A 1 NULL NULL t1 0 PRIMARY 1 a A 2 NULL NULL
i j i j
1 2 1 2
i j i j
......
...@@ -198,3 +198,12 @@ insert into t2 values (1,1),(2,2),(3,3); ...@@ -198,3 +198,12 @@ insert into t2 values (1,1),(2,2),(3,3);
select t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b; select t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
select distinct t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b; select distinct t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
drop table t1,t2; drop table t1,t2;
#
# Test problem with DISTINCT and HAVING
#
create table t1 (a int not null,b char(5), c text);
insert into t1 (a) values (1),(2),(3),(4),(1),(2),(3),(4);
select distinct a from t1 group by b,a having a > 2 order by a desc;
select distinct a,c from t1 group by b,c,a having a > 2 order by a desc;
drop table t1;
#
# Test for bug by voi@ims.at
#
drop table if exists test;
CREATE TABLE test (
gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
url VARCHAR(80) DEFAULT '' NOT NULL,
shortdesc VARCHAR(200) DEFAULT '' NOT NULL,
longdesc text DEFAULT '' NOT NULL,
description VARCHAR(80) DEFAULT '' NOT NULL,
name VARCHAR(80) DEFAULT '' NOT NULL,
FULLTEXT(url,description,shortdesc,longdesc),
PRIMARY KEY(gnr)
);
insert into test (url,shortdesc,longdesc,description,name) VALUES
("http:/test.at", "kurz", "lang","desc", "name");
insert into test (url,shortdesc,longdesc,description,name) VALUES
("http:/test.at", "kurz", "","desc", "name");
update test set url='test', description='ddd', name='nam' where gnr=2;
update test set url='test', shortdesc='ggg', longdesc='mmm',
description='ddd', name='nam' where gnr=2;
check table test;
drop table test;
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Original version by Tim Bunce, sometime in 2000. # Original version by Tim Bunce, sometime in 2000.
# Further changes by Tim Bunce, 8th March 2001. # Further changes by Tim Bunce, 8th March 2001.
# Handling of strings with \ and double '' by Monty 11 Aug 2001.
use strict; use strict;
use Getopt::Long; use Getopt::Long;
...@@ -95,8 +96,8 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) { ...@@ -95,8 +96,8 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) {
unless ($opt{a}) { unless ($opt{a}) {
s/\b\d+\b/N/g; s/\b\d+\b/N/g;
s/\b0x[0-9A-Fa-f]+\b/N/g; s/\b0x[0-9A-Fa-f]+\b/N/g;
s/'.*?'/'S'/g; s/'([^\\\']|\\.|\'\')+'/'S'/g;
s/".*?"/"S"/g; s/"([^\\\"]|\\.|\"\")+"/"S"/g;
# -n=8: turn log_20001231 into log_NNNNNNNN # -n=8: turn log_20001231 into log_NNNNNNNN
s/([a-z_]+)(\d{$opt{n},})/$1.('N' x length($2))/ieg if $opt{n}; s/([a-z_]+)(\d{$opt{n},})/$1.('N' x length($2))/ieg if $opt{n};
# abbreviate massive "in (...)" statements and similar # abbreviate massive "in (...)" statements and similar
......
...@@ -37,12 +37,12 @@ dist-hook: ...@@ -37,12 +37,12 @@ dist-hook:
mkdir -p $(distdir)/Data/ATIS $(distdir)/Data/Wisconsin \ mkdir -p $(distdir)/Data/ATIS $(distdir)/Data/Wisconsin \
$(distdir)/Results $(distdir)/Results-win32 \ $(distdir)/Results $(distdir)/Results-win32 \
$(distdir)/limits $(distdir)/Comments $(distdir)/limits $(distdir)/Comments
$(INSTALL_DATA) $(srcdir)/Data/ATIS/*.* $(distdir)/Data/ATIS for i in $(srcdir)/Data/ATIS/*.* ; do $(INSTALL_DATA) $$i $(distdir)/Data/ATIS ; done
$(INSTALL_DATA) $(srcdir)/Data/Wisconsin/*.* $(distdir)/Data/Wisconsin for i in $(srcdir)/Data/Wisconsin/*.* ; do $(INSTALL_DATA) $$i $(distdir)/Data/Wisconsin ; done
$(INSTALL_DATA) $(srcdir)/Results/*-* $(distdir)/Results for i in $(srcdir)/Results/*-* ; do $(INSTALL_DATA) $$i $(distdir)/Results; done
$(INSTALL_DATA) $(srcdir)/Results-win32/*-* $(distdir)/Results-win32 for i in $(srcdir)/Results-win32/*-* ; do $(INSTALL_DATA) $$i $(distdir)/Results-win32; done
$(INSTALL_DATA) $(srcdir)/limits/*.* $(distdir)/limits for i in $(srcdir)/limits/*.* ; do $(INSTALL_DATA) $$i $(distdir)/limits; done
$(INSTALL_DATA) $(srcdir)/Comments/*.* $(distdir)/Comments for i in $(srcdir)/Comments/*.* ; do $(INSTALL_DATA) $$i $(distdir)/Comments; done
install-data-local: install-data-local:
$(mkinstalldirs) \ $(mkinstalldirs) \
...@@ -54,12 +54,13 @@ install-data-local: ...@@ -54,12 +54,13 @@ install-data-local:
$(DESTDIR)$(benchdir)/limits \ $(DESTDIR)$(benchdir)/limits \
$(DESTDIR)$(benchdir)/Comments $(DESTDIR)$(benchdir)/Comments
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(benchdir) $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(benchdir)
$(INSTALL_DATA) $(srcdir)/Data/ATIS/*.* $(DESTDIR)$(benchdir)/Data/ATIS for i in $(srcdir)/Data/ATIS/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Data/ATIS ; done
$(INSTALL_DATA) $(srcdir)/Data/Wisconsin/*.* $(DESTDIR)$(benchdir)/Data/Wisconsin for i in $(srcdir)/Data/Wisconsin/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Data/Wisconsin ; done
$(INSTALL_DATA) $(srcdir)/Results/*-* $(DESTDIR)$(benchdir)/Results for i in $(srcdir)/Results/*-* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Results; done
$(INSTALL_DATA) $(srcdir)/Results-win32/*-* $(DESTDIR)$(benchdir)/Results-win32 for i in $(srcdir)/Results-win32/*-* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Results-win32; done
$(INSTALL_DATA) $(srcdir)/limits/*.* $(DESTDIR)$(benchdir)/limits for i in $(srcdir)/limits/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/limits; done
$(INSTALL_DATA) $(srcdir)/Comments/*.* $(DESTDIR)$(benchdir)/Comments for i in $(srcdir)/Comments/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Comments; done
SUFFIXES = .sh SUFFIXES = .sh
......
...@@ -229,6 +229,7 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info) ...@@ -229,6 +229,7 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
MYRG_TABLE *table; MYRG_TABLE *table;
THD *thd=current_thd; THD *thd=current_thd;
create_info->merge_list.next= &create_info->merge_list.first; create_info->merge_list.next= &create_info->merge_list.first;
create_info->merge_list.elements=0;
for (table=file->open_tables ; table != file->end_table ; table++) for (table=file->open_tables ; table != file->end_table ; table++)
{ {
...@@ -240,6 +241,7 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info) ...@@ -240,6 +241,7 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
fn_format(buff,name,"","",3); fn_format(buff,name,"","",3);
if (!(ptr->real_name=thd->strdup(buff))) if (!(ptr->real_name=thd->strdup(buff)))
goto err; goto err;
create_info->merge_list.elements++;
(*create_info->merge_list.next) = (byte*) ptr; (*create_info->merge_list.next) = (byte*) ptr;
create_info->merge_list.next= (byte**) &ptr->next; create_info->merge_list.next= (byte**) &ptr->next;
} }
......
...@@ -1532,9 +1532,13 @@ static void open_log(MYSQL_LOG *log, const char *hostname, ...@@ -1532,9 +1532,13 @@ static void open_log(MYSQL_LOG *log, const char *hostname,
// get rid of extention if the log is binary to avoid problems // get rid of extention if the log is binary to avoid problems
if (type == LOG_BIN) if (type == LOG_BIN)
{ {
char* p = strrchr((char*) opt_name, FN_EXTCHAR); char *p = fn_ext(opt_name);
if (p) if (p)
*p = 0; {
uint length=(uint) (p-opt_name);
strmake(tmp,opt_name,min(length,FN_REFLEN));
opt_name=tmp;
}
} }
log->open(opt_name,type); log->open(opt_name,type);
} }
...@@ -2818,6 +2822,8 @@ CHANGEABLE_VAR changeable_vars[] = { ...@@ -2818,6 +2822,8 @@ CHANGEABLE_VAR changeable_vars[] = {
0, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE }, 0, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE },
{ "record_buffer", (long*) &my_default_record_cache_size, { "record_buffer", (long*) &my_default_record_cache_size,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE }, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE },
{ "record_rnd_buffer", (long*) &record_rnd_cache_size,
0, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE },
{ "slave_net_timeout", (long*) &slave_net_timeout, { "slave_net_timeout", (long*) &slave_net_timeout,
SLAVE_NET_TIMEOUT, 1, 65535, 0, 1 }, SLAVE_NET_TIMEOUT, 1, 65535, 0, 1 },
{ "slow_launch_time", (long*) &slow_launch_time, { "slow_launch_time", (long*) &slow_launch_time,
...@@ -2907,6 +2913,7 @@ struct show_var_st init_vars[]= { ...@@ -2907,6 +2913,7 @@ struct show_var_st init_vars[]= {
{"log_update", (char*) &opt_update_log, SHOW_BOOL}, {"log_update", (char*) &opt_update_log, SHOW_BOOL},
{"log_bin", (char*) &opt_bin_log, SHOW_BOOL}, {"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_BOOL}, {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_BOOL},
{"log_long_queries", (char*) &opt_slow_log, SHOW_BOOL},
{"long_query_time", (char*) &long_query_time, SHOW_LONG}, {"long_query_time", (char*) &long_query_time, SHOW_LONG},
{"low_priority_updates", (char*) &low_priority_updates, SHOW_BOOL}, {"low_priority_updates", (char*) &low_priority_updates, SHOW_BOOL},
{"lower_case_table_names", (char*) &lower_case_table_names, SHOW_LONG}, {"lower_case_table_names", (char*) &lower_case_table_names, SHOW_LONG},
...@@ -2937,6 +2944,7 @@ struct show_var_st init_vars[]= { ...@@ -2937,6 +2944,7 @@ struct show_var_st init_vars[]= {
{"port", (char*) &mysql_port, SHOW_INT}, {"port", (char*) &mysql_port, SHOW_INT},
{"protocol_version", (char*) &protocol_version, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT},
{"record_buffer", (char*) &my_default_record_cache_size,SHOW_LONG}, {"record_buffer", (char*) &my_default_record_cache_size,SHOW_LONG},
{"record_rnd_buffer", (char*) &record_rnd_cache_size, SHOW_LONG},
{"query_buffer_size", (char*) &query_buff_size, SHOW_LONG}, {"query_buffer_size", (char*) &query_buff_size, SHOW_LONG},
{"safe_show_database", (char*) &opt_safe_show_db, SHOW_BOOL}, {"safe_show_database", (char*) &opt_safe_show_db, SHOW_BOOL},
{"server_id", (char*) &server_id, SHOW_LONG}, {"server_id", (char*) &server_id, SHOW_LONG},
...@@ -2947,7 +2955,7 @@ struct show_var_st init_vars[]= { ...@@ -2947,7 +2955,7 @@ struct show_var_st init_vars[]= {
{"slow_launch_time", (char*) &slow_launch_time, SHOW_LONG}, {"slow_launch_time", (char*) &slow_launch_time, SHOW_LONG},
{"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR}, {"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR},
{"sort_buffer", (char*) &sortbuff_size, SHOW_LONG}, {"sort_buffer", (char*) &sortbuff_size, SHOW_LONG},
{"sql_mode", (char*) &sql_mode_str, SHOW_CHAR_PTR}, {"sql_mode", (char*) &opt_sql_mode, SHOW_LONG},
{"table_cache", (char*) &table_cache_size, SHOW_LONG}, {"table_cache", (char*) &table_cache_size, SHOW_LONG},
{"table_type", (char*) &default_table_type_name, SHOW_CHAR_PTR}, {"table_type", (char*) &default_table_type_name, SHOW_CHAR_PTR},
{"thread_cache_size", (char*) &thread_cache_size, SHOW_LONG}, {"thread_cache_size", (char*) &thread_cache_size, SHOW_LONG},
...@@ -3109,6 +3117,8 @@ static void usage(void) ...@@ -3109,6 +3117,8 @@ static void usage(void)
--safe-mode Skip some optimize stages (for testing)\n\ --safe-mode Skip some optimize stages (for testing)\n\
--safe-show-database Don't show databases for which the user has no\n\ --safe-show-database Don't show databases for which the user has no\n\
privileges\n\ privileges\n\
--safe-user-create Don't new users cretaion without privileges to the\n\
mysql.user table\n\
--skip-concurrent-insert\n\ --skip-concurrent-insert\n\
Don't use concurrent insert with MyISAM\n\ Don't use concurrent insert with MyISAM\n\
--skip-delay-key-write\n\ --skip-delay-key-write\n\
...@@ -3817,6 +3827,20 @@ static void get_options(int argc,char **argv) ...@@ -3817,6 +3827,20 @@ static void get_options(int argc,char **argv)
ha_open_options|=HA_OPEN_ABORT_IF_CRASHED; ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
break; break;
} }
case OPT_SQL_MODE:
{
sql_mode_str = optarg;
if ((opt_sql_mode =
find_bit_type(optarg, &sql_mode_typelib)) == ~(ulong) 0)
{
fprintf(stderr, "Unknown option to sql-mode: %s\n", optarg);
exit(1);
}
default_tx_isolation= ((opt_sql_mode & MODE_SERIALIZABLE) ?
ISO_SERIALIZABLE :
ISO_READ_COMMITTED);
break;
}
case OPT_MASTER_HOST: case OPT_MASTER_HOST:
master_host=optarg; master_host=optarg;
break; break;
...@@ -3850,6 +3874,9 @@ static void get_options(int argc,char **argv) ...@@ -3850,6 +3874,9 @@ static void get_options(int argc,char **argv)
case OPT_SAFE_SHOW_DB: case OPT_SAFE_SHOW_DB:
opt_safe_show_db=1; opt_safe_show_db=1;
break; break;
case OPT_SAFE_USER_CREATE:
opt_safe_user_create=1;
break;
case OPT_SKIP_SAFEMALLOC: case OPT_SKIP_SAFEMALLOC:
#ifdef SAFEMALLOC #ifdef SAFEMALLOC
sf_malloc_quick=1; sf_malloc_quick=1;
...@@ -3874,6 +3901,9 @@ static void get_options(int argc,char **argv) ...@@ -3874,6 +3901,9 @@ static void get_options(int argc,char **argv)
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];
/* To be deleted in MySQL 4.0 */
if (!record_rnd_cache_size)
record_rnd_cache_size=my_default_record_cache_size;
} }
...@@ -4149,7 +4179,7 @@ static int get_service_parameters() ...@@ -4149,7 +4179,7 @@ static int get_service_parameters()
} }
else if ( lstrcmp(szKeyValueName, TEXT("KeyBufferSize")) == 0 ) else if ( lstrcmp(szKeyValueName, TEXT("KeyBufferSize")) == 0 )
{ {
SET_CHANGEABLE_VARVAL( "key_buffer_size" ); SET_CHANGEABLE_VARVAL( "key_buffer" );
} }
else if ( lstrcmp(szKeyValueName, TEXT("LongQueryTime")) == 0 ) else if ( lstrcmp(szKeyValueName, TEXT("LongQueryTime")) == 0 )
{ {
...@@ -4463,7 +4493,9 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib) ...@@ -4463,7 +4493,9 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
found=0; found=0;
found_end= 0; found_end= 0;
pos=(my_string) x; pos=(my_string) x;
do while (*pos == ' ') pos++;
found_end= *pos == 0;
while (!found_end)
{ {
if (!*(end=strcend(pos,','))) /* Let end point at fieldend */ if (!*(end=strcend(pos,','))) /* Let end point at fieldend */
{ {
...@@ -4496,7 +4528,7 @@ skipp: ; ...@@ -4496,7 +4528,7 @@ skipp: ;
DBUG_RETURN(~(ulong) 0); // No unique value DBUG_RETURN(~(ulong) 0); // No unique value
found|=found_int; found|=found_int;
pos=end+1; pos=end+1;
} while (! found_end); }
DBUG_PRINT("exit",("bit-field: %ld",(ulong) found)); DBUG_PRINT("exit",("bit-field: %ld",(ulong) found));
DBUG_RETURN(found); DBUG_RETURN(found);
......
...@@ -66,7 +66,7 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table, ...@@ -66,7 +66,7 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
table->file->rnd_init(0); table->file->rnd_init(0);
if (! (specialflag & SPECIAL_SAFE_MODE) && if (! (specialflag & SPECIAL_SAFE_MODE) &&
my_default_record_cache_size && record_rnd_cache_size &&
!table->file->fast_key_read() && !table->file->fast_key_read() &&
(table->db_stat & HA_READ_ONLY || (table->db_stat & HA_READ_ONLY ||
table->reginfo.lock_type <= TL_READ_NO_INSERT) && table->reginfo.lock_type <= TL_READ_NO_INSERT) &&
...@@ -216,7 +216,7 @@ static int init_rr_cache(READ_RECORD *info) ...@@ -216,7 +216,7 @@ static int init_rr_cache(READ_RECORD *info)
info->reclength=ALIGN_SIZE(info->struct_length); info->reclength=ALIGN_SIZE(info->struct_length);
info->error_offset=info->table->reclength; info->error_offset=info->table->reclength;
info->cache_records=my_default_record_cache_size/ info->cache_records=record_rnd_cache_size/
(info->reclength+info->struct_length); (info->reclength+info->struct_length);
rec_cache_size=info->cache_records*info->reclength; rec_cache_size=info->cache_records*info->reclength;
info->rec_cache_size=info->cache_records*info->ref_length; info->rec_cache_size=info->cache_records*info->ref_length;
......
...@@ -943,16 +943,41 @@ end: ...@@ -943,16 +943,41 @@ end:
DBUG_RETURN(error); DBUG_RETURN(error);
} }
/* Return 1 if we are allowed to create new users */
static bool test_if_create_new_users(THD *thd)
{
bool create_new_users=1; // Assume that we are allowed to create new users
if (opt_safe_user_create && !(thd->master_access & INSERT_ACL))
{
TABLE_LIST tl;
uint db_access;
bzero((char*) &tl,sizeof(tl));
tl.db= (char*) "mysql";
tl.real_name= (char*) "user";
db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
thd->priv_user, tl.db);
if (!(db_access & INSERT_ACL))
{
if (check_grant(thd,INSERT_ACL,&tl,0,1))
create_new_users=0;
}
}
return create_new_users;
}
/**************************************************************************** /****************************************************************************
** Handle GRANT commands ** Handle GRANT commands
****************************************************************************/ ****************************************************************************/
static int replace_user_table(TABLE *table, const LEX_USER &combo, static int replace_user_table(TABLE *table, const LEX_USER &combo,
uint rights, char what) uint rights, char what, bool create_user)
{ {
int error = -1; int error = -1;
uint i,j; uint i,j;
bool ima=0; bool old_row_exists=0;
char *password,empty_string[1]; char *password,empty_string[1];
DBUG_ENTER("replace_user_table"); DBUG_ENTER("replace_user_table");
...@@ -971,14 +996,21 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo, ...@@ -971,14 +996,21 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo,
(byte*) table->field[0]->ptr,0, (byte*) table->field[0]->ptr,0,
HA_READ_KEY_EXACT)) HA_READ_KEY_EXACT))
{ {
if (what == 'N') if (!create_user)
{ {
my_printf_error(ER_NONEXISTING_GRANT,ER(ER_NONEXISTING_GRANT), THD *thd=current_thd;
MYF(0),combo.user.str,combo.host.str); if (what == 'N')
my_printf_error(ER_NONEXISTING_GRANT,ER(ER_NONEXISTING_GRANT),
MYF(0),combo.user.str,combo.host.str);
else
my_printf_error(ER_NO_PERMISSON_TO_CREATE_USER,
ER(ER_NO_PERMISSON_TO_CREATE_USER),
MYF(0),thd->user,
thd->host ? thd->host : thd->ip ? thd->ip: "");
error= -1; error= -1;
goto end; goto end;
} }
ima = 0; // no row; ima on Serbian means 'there is something' old_row_exists = 0;
restore_record(table,2); // cp empty row from record[2] restore_record(table,2); // cp empty row from record[2]
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(combo.user.str,combo.user.length); table->field[1]->store(combo.user.str,combo.user.length);
...@@ -986,7 +1018,7 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo, ...@@ -986,7 +1018,7 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo,
} }
else else
{ {
ima = 1; old_row_exists = 1;
store_record(table,1); // Save copy for update store_record(table,1); // Save copy for update
if (combo.password.str) // If password given if (combo.password.str) // If password given
table->field[2]->store(password,(uint) strlen(password)); table->field[2]->store(password,(uint) strlen(password));
...@@ -1001,7 +1033,7 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo, ...@@ -1001,7 +1033,7 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo,
} }
rights=get_access(table,3); rights=get_access(table,3);
if (ima) // there is a row, therefore go to update, instead of insert if (old_row_exists)
{ {
/* /*
We should NEVER delete from the user table, as a uses can still We should NEVER delete from the user table, as a uses can still
...@@ -1033,7 +1065,7 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo, ...@@ -1033,7 +1065,7 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo,
acl_cache->clear(1); // Clear privilege cache acl_cache->clear(1); // Clear privilege cache
if (!combo.password.str) if (!combo.password.str)
password=0; // No password given on command password=0; // No password given on command
if (ima) if (old_row_exists)
acl_update_user(combo.user.str,combo.host.str,password,rights); acl_update_user(combo.user.str,combo.host.str,password,rights);
else else
acl_insert_user(combo.user.str,combo.host.str,password,rights); acl_insert_user(combo.user.str,combo.host.str,password,rights);
...@@ -1052,7 +1084,7 @@ static int replace_db_table(TABLE *table, const char *db, ...@@ -1052,7 +1084,7 @@ static int replace_db_table(TABLE *table, const char *db,
uint rights, char what) uint rights, char what)
{ {
uint i,j,store_rights; uint i,j,store_rights;
bool ima=0; bool old_row_exists=0;
int error; int error;
DBUG_ENTER("replace_db_table"); DBUG_ENTER("replace_db_table");
...@@ -1076,7 +1108,7 @@ static int replace_db_table(TABLE *table, const char *db, ...@@ -1076,7 +1108,7 @@ static int replace_db_table(TABLE *table, const char *db,
combo.user.str,combo.host.str); combo.user.str,combo.host.str);
goto abort; goto abort;
} }
ima = 0; // no row old_row_exists = 0;
restore_record(table,2); // cp empty row from record[2] restore_record(table,2); // cp empty row from record[2]
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(db,(uint) strlen(db)); table->field[1]->store(db,(uint) strlen(db));
...@@ -1084,7 +1116,7 @@ static int replace_db_table(TABLE *table, const char *db, ...@@ -1084,7 +1116,7 @@ static int replace_db_table(TABLE *table, const char *db,
} }
else else
{ {
ima = 1; old_row_exists = 1;
store_record(table,1); store_record(table,1);
} }
...@@ -1097,8 +1129,9 @@ static int replace_db_table(TABLE *table, const char *db, ...@@ -1097,8 +1129,9 @@ static int replace_db_table(TABLE *table, const char *db,
rights=get_access(table,3); rights=get_access(table,3);
rights=fix_rights_for_db(rights); rights=fix_rights_for_db(rights);
if (ima) // there is a row, therefore go update, else insert if (old_row_exists)
{ {
// update old existing row
if (rights) if (rights)
{ {
if ((error=table->file->update_row(table->record[1],table->record[0]))) if ((error=table->file->update_row(table->record[1],table->record[0])))
...@@ -1117,7 +1150,7 @@ static int replace_db_table(TABLE *table, const char *db, ...@@ -1117,7 +1150,7 @@ static int replace_db_table(TABLE *table, const char *db,
} }
acl_cache->clear(1); // Clear privilege cache acl_cache->clear(1); // Clear privilege cache
if (ima) if (old_row_exists)
acl_update_db(combo.user.str,combo.host.str,db,rights); acl_update_db(combo.user.str,combo.host.str,db,rights);
else else
acl_insert_db(combo.user.str,combo.host.str,db,rights); acl_insert_db(combo.user.str,combo.host.str,db,rights);
...@@ -1324,7 +1357,7 @@ static int replace_column_table(GRANT_TABLE *g_t, ...@@ -1324,7 +1357,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
while ((xx=iter++)) while ((xx=iter++))
{ {
uint privileges = xx->rights; uint privileges = xx->rights;
bool ima=0; bool old_row_exists=0;
key_restore(table,key,0,key_length); key_restore(table,key,0,key_length);
table->field[4]->store(xx->column.ptr(),xx->column.length()); table->field[4]->store(xx->column.ptr(),xx->column.length());
...@@ -1339,7 +1372,7 @@ static int replace_column_table(GRANT_TABLE *g_t, ...@@ -1339,7 +1372,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
result= -1; /* purecov: inspected */ result= -1; /* purecov: inspected */
continue; /* purecov: inspected */ continue; /* purecov: inspected */
} }
ima = 0; old_row_exists = 0;
restore_record(table,2); // Get empty record restore_record(table,2); // Get empty record
key_restore(table,key,0,key_length); key_restore(table,key,0,key_length);
table->field[4]->store(xx->column.ptr(),xx->column.length()); table->field[4]->store(xx->column.ptr(),xx->column.length());
...@@ -1353,13 +1386,13 @@ static int replace_column_table(GRANT_TABLE *g_t, ...@@ -1353,13 +1386,13 @@ static int replace_column_table(GRANT_TABLE *g_t,
privileges = tmp & ~(privileges | rights); privileges = tmp & ~(privileges | rights);
else else
privileges |= tmp; privileges |= tmp;
ima = 1; old_row_exists = 1;
store_record(table,1); // copy original row store_record(table,1); // copy original row
} }
table->field[6]->store((longlong) get_rights_for_column(privileges)); table->field[6]->store((longlong) get_rights_for_column(privileges));
if (ima) // there is a row, therefore go update, else insert if (old_row_exists)
{ {
if (privileges) if (privileges)
error=table->file->update_row(table->record[1],table->record[0]); error=table->file->update_row(table->record[1],table->record[0]);
...@@ -1465,7 +1498,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, ...@@ -1465,7 +1498,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
uint rights, uint kolone, bool revoke_grant) uint rights, uint kolone, bool revoke_grant)
{ {
char grantor[HOSTNAME_LENGTH+1+USERNAME_LENGTH]; char grantor[HOSTNAME_LENGTH+1+USERNAME_LENGTH];
int ima = 1; int old_row_exists = 1;
int error=0; int error=0;
uint store_table_rights,store_col_rights; uint store_table_rights,store_col_rights;
DBUG_ENTER("replace_table_table"); DBUG_ENTER("replace_table_table");
...@@ -1505,13 +1538,13 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, ...@@ -1505,13 +1538,13 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
table_name); /* purecov: deadcode */ table_name); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */ DBUG_RETURN(-1); /* purecov: deadcode */
} }
ima = 0; // no row old_row_exists = 0;
restore_record(table,1); // Get saved record restore_record(table,1); // Get saved record
} }
store_table_rights=get_rights_for_table(rights); store_table_rights=get_rights_for_table(rights);
store_col_rights=get_rights_for_column(kolone); store_col_rights=get_rights_for_column(kolone);
if (ima) if (old_row_exists)
{ {
uint j,k; uint j,k;
store_record(table,1); store_record(table,1);
...@@ -1536,7 +1569,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, ...@@ -1536,7 +1569,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
rights=fix_rights_for_table(store_table_rights); rights=fix_rights_for_table(store_table_rights);
kolone=fix_rights_for_column(store_col_rights); kolone=fix_rights_for_column(store_col_rights);
if (ima) // there is a row, therefore go update, else insert if (old_row_exists)
{ {
if (store_table_rights || store_col_rights) if (store_table_rights || store_col_rights)
{ {
...@@ -1668,10 +1701,12 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, ...@@ -1668,10 +1701,12 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
continue; continue;
} }
/* Create user if needed */ /* Create user if needed */
if ((replace_user_table(tables[0].table, if (replace_user_table(tables[0].table,
*Str, *Str,
0, 0,
revoke_grant ? 'N' : 'Y'))) revoke_grant ? 'N' : 'Y',
(revoke_grant ? 0 :
test_if_create_new_users(thd))))
{ {
result= -1; // Remember error result= -1; // Remember error
continue; // Add next user continue; // Add next user
...@@ -1773,6 +1808,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights, ...@@ -1773,6 +1808,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights,
List_iterator <LEX_USER> str_list (list); List_iterator <LEX_USER> str_list (list);
LEX_USER *Str; LEX_USER *Str;
char what; char what;
bool create_new_users=0;
TABLE_LIST tables[2]; TABLE_LIST tables[2];
DBUG_ENTER("mysql_grant"); DBUG_ENTER("mysql_grant");
...@@ -1799,8 +1835,10 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights, ...@@ -1799,8 +1835,10 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights,
DBUG_RETURN(-1); /* purecov: deadcode */ DBUG_RETURN(-1); /* purecov: deadcode */
} }
// go through users in user_list if (!revoke_grant)
create_new_users= test_if_create_new_users(thd);
// go through users in user_list
pthread_mutex_lock(&LOCK_grant); pthread_mutex_lock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
grant_version++; grant_version++;
...@@ -1822,11 +1860,14 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights, ...@@ -1822,11 +1860,14 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights,
} }
if ((replace_user_table(tables[0].table, if ((replace_user_table(tables[0].table,
*Str, *Str,
(!db ? rights : 0), what))) (!db ? rights : 0), what, create_new_users)))
result= -1;
if (db && replace_db_table(tables[1].table, db, *Str, rights & DB_ACLS,
what))
result= -1; result= -1;
else
{
if (db && replace_db_table(tables[1].table, db, *Str, rights & DB_ACLS,
what))
result= -1;
}
} }
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
pthread_mutex_unlock(&LOCK_grant); pthread_mutex_unlock(&LOCK_grant);
...@@ -1978,7 +2019,7 @@ void grant_reload(void) ...@@ -1978,7 +2019,7 @@ void grant_reload(void)
****************************************************************************/ ****************************************************************************/
bool check_grant(THD *thd, uint want_access, TABLE_LIST *tables, bool check_grant(THD *thd, uint want_access, TABLE_LIST *tables,
uint show_table) uint show_table, bool no_errors)
{ {
TABLE_LIST *table; TABLE_LIST *table;
char *user = thd->priv_user; char *user = thd->priv_user;
...@@ -2026,7 +2067,7 @@ bool check_grant(THD *thd, uint want_access, TABLE_LIST *tables, ...@@ -2026,7 +2067,7 @@ bool check_grant(THD *thd, uint want_access, TABLE_LIST *tables,
err: err:
pthread_mutex_unlock(&LOCK_grant); pthread_mutex_unlock(&LOCK_grant);
if (show_table != 1) // Not a silent skip of table if (!no_errors) // Not a silent skip of table
{ {
const char *command=""; const char *command="";
if (want_access & SELECT_ACL) if (want_access & SELECT_ACL)
......
...@@ -74,7 +74,7 @@ int grant_init(void); ...@@ -74,7 +74,7 @@ int grant_init(void);
void grant_free(void); void grant_free(void);
void grant_reload(void); void grant_reload(void);
bool check_grant(THD *thd, uint want_access, TABLE_LIST *tables, bool check_grant(THD *thd, uint want_access, TABLE_LIST *tables,
uint show_command=0); uint show_command=0, bool dont_print_error=0);
bool check_grant_column (THD *thd,TABLE *table, const char *name,uint length, bool check_grant_column (THD *thd,TABLE *table, const char *name,uint length,
uint show_command=0); uint show_command=0);
bool check_grant_all_columns(THD *thd, uint want_access, TABLE *table); bool check_grant_all_columns(THD *thd, uint want_access, TABLE *table);
......
...@@ -27,8 +27,15 @@ class Sql_alloc ...@@ -27,8 +27,15 @@ class Sql_alloc
public: public:
static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr, size_t size) {} /*lint -e715 */ static void operator delete(void *ptr, size_t size) {} /*lint -e715 */
inline Sql_alloc() {}; #ifdef HAVE_purify
inline ~Sql_alloc() {}; bool dummy;
inline Sql_alloc() :dummy(0) {}
inline ~Sql_alloc() {}
#else
inline Sql_alloc() {}
inline ~Sql_alloc() {}
#endif
}; };
/* /*
......
...@@ -2116,7 +2116,7 @@ mysql_execute_command(void) ...@@ -2116,7 +2116,7 @@ mysql_execute_command(void)
else else
res = mysql_grant(thd, select_lex->db, lex->users_list, lex->grant, res = mysql_grant(thd, select_lex->db, lex->users_list, lex->grant,
lex->sql_command == SQLCOM_REVOKE); lex->sql_command == SQLCOM_REVOKE);
if(!res) if (!res)
{ {
mysql_update_log.write(thd, thd->query,thd->query_length); mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
......
...@@ -1413,24 +1413,27 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array, ...@@ -1413,24 +1413,27 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
if (cond->type() == Item::FUNC_ITEM) if (cond->type() == Item::FUNC_ITEM)
{ {
Item_func *func=(Item_func *)cond, Item_func *func=(Item_func *)cond;
*arg0=(Item_func *)(func->arguments()[0]), Item_func::Functype functype= func->functype();
*arg1=(Item_func *)(func->arguments()[1]); if (functype == Item_func::FT_FUNC)
if (func->functype() == Item_func::FT_FUNC)
cond_func=(Item_func_match *)cond; cond_func=(Item_func_match *)cond;
else if ((func->functype() == Item_func::GE_FUNC || else if (func->arg_count == 2)
func->functype() == Item_func::GT_FUNC) && {
arg0->type() == Item::FUNC_ITEM && Item_func *arg0=(Item_func *)(func->arguments()[0]),
arg0->functype() == Item_func::FT_FUNC && *arg1=(Item_func *)(func->arguments()[1]);
arg1->const_item() && arg1->val()>=0) if ((functype == Item_func::GE_FUNC ||
cond_func=(Item_func_match *)arg0; functype == Item_func::GT_FUNC) &&
else if ((func->functype() == Item_func::LE_FUNC || arg0->type() == Item::FUNC_ITEM &&
func->functype() == Item_func::LT_FUNC) && arg0->functype() == Item_func::FT_FUNC &&
arg1->type() == Item::FUNC_ITEM && arg1->const_item() && arg1->val()>=0)
arg1->functype() == Item_func::FT_FUNC && cond_func=(Item_func_match *) arg0;
arg0->const_item() && arg0->val()>=0) else if ((functype == Item_func::LE_FUNC ||
cond_func=(Item_func_match *)arg1; functype == Item_func::LT_FUNC) &&
arg1->type() == Item::FUNC_ITEM &&
arg1->functype() == Item_func::FT_FUNC &&
arg0->const_item() && arg0->val()>=0)
cond_func=(Item_func_match *) arg1;
}
} }
else if (cond->type() == Item::COND_ITEM) else if (cond->type() == Item::COND_ITEM)
{ {
...@@ -1439,18 +1442,21 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array, ...@@ -1439,18 +1442,21 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC) if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{ {
Item *item; Item *item;
/* I'm too lazy to implement proper recursive descent here, /*
I', (Sergei) too lazy to implement proper recursive descent here,
and anyway, nobody will use such a stupid queries and anyway, nobody will use such a stupid queries
that will require it :-) that will require it :-)
May be later... May be later...
*/ */
while ((item=li++)) while ((item=li++))
{
if (item->type() == Item::FUNC_ITEM && if (item->type() == Item::FUNC_ITEM &&
((Item_func *)item)->functype() == Item_func::FT_FUNC) ((Item_func *)item)->functype() == Item_func::FT_FUNC)
{ {
cond_func=(Item_func_match *)item; cond_func=(Item_func_match *)item;
break; break;
} }
}
} }
} }
......
...@@ -217,7 +217,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path, ...@@ -217,7 +217,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
table_list.db= (char*) db; table_list.db= (char*) db;
table_list.real_name=file->name; table_list.real_name=file->name;
table_list.grant.privilege=col_access; table_list.grant.privilege=col_access;
if (check_grant(thd,TABLE_ACLS,&table_list,1)) if (check_grant(thd,TABLE_ACLS,&table_list,1,1))
continue; continue;
} }
if (files->push_back(thd->strdup(file->name))) if (files->push_back(thd->strdup(file->name)))
......
...@@ -1128,11 +1128,15 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1128,11 +1128,15 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
strmov(new_name_buff,new_name); strmov(new_name_buff,new_name);
fn_same(new_name_buff,table_name,3); fn_same(new_name_buff,table_name,3);
// Check if name changed
#ifdef FN_LOWER_CASE #ifdef FN_LOWER_CASE
if (!strcmp(db,new_db) && !my_strcasecmp(new_name_buff,table_name)) if (lower_case_table_names)
casedn_str(new_name);
if ((lower_case_table_names &&
!my_strcasecmp(new_name_buff,table_name)) ||
(!lower_case_table_names &&
!strcmp(new_name_buff,table_name)))
#else #else
if (!strcmp(db,new_db) && !strcmp(new_name_buff,table_name)) if (!strcmp(new_name_buff,table_name)) // Check if name changed
#endif #endif
new_name=table_name; // No. Make later check easier new_name=table_name; // No. Make later check easier
else else
......
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