Commit fdc16915 authored by unknown's avatar unknown

Merge work:/home/bk/mysql into serg.mysql.com:/usr/home/serg/Abk/mysql


BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parents bd6c9e97 94063bf9
heikki@donna.mysql.fi heikki@donna.mysql.fi
jani@janikt.pp.saunalahti.fi jani@hynda.mysql.fi
miguel@light.local
monty@hundin.mysql.fi
monty@tik.mysql.fi
monty@work.mysql.com
mwagner@evoq.mwagner.org
paul@central.snake.net
paul@teton.kitebird.com
sasha@mysql.sashanet.com
serg@serg.mysql.com
tim@threads.polyesthetic.msg
tim@white.box
jcole@tetra.spaceapes.com jcole@tetra.spaceapes.com
davida@isil.mysql.com tim@work.mysql.com
tonu@x153.internalnet serg@serg.mysql.com
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2351,6 +2351,7 @@ btr_estimate_n_rows_in_range( ...@@ -2351,6 +2351,7 @@ btr_estimate_n_rows_in_range(
btr_path_t* slot1; btr_path_t* slot1;
btr_path_t* slot2; btr_path_t* slot2;
ibool diverged; ibool diverged;
ulint divergence_level;
ulint n_rows; ulint n_rows;
ulint i; ulint i;
mtr_t mtr; mtr_t mtr;
...@@ -2393,6 +2394,7 @@ btr_estimate_n_rows_in_range( ...@@ -2393,6 +2394,7 @@ btr_estimate_n_rows_in_range(
n_rows = 1; n_rows = 1;
diverged = FALSE; diverged = FALSE;
divergence_level = 1000000;
for (i = 0; ; i++) { for (i = 0; ; i++) {
ut_ad(i < BTR_PATH_ARRAY_N_SLOTS); ut_ad(i < BTR_PATH_ARRAY_N_SLOTS);
...@@ -2403,6 +2405,13 @@ btr_estimate_n_rows_in_range( ...@@ -2403,6 +2405,13 @@ btr_estimate_n_rows_in_range(
if (slot1->nth_rec == ULINT_UNDEFINED if (slot1->nth_rec == ULINT_UNDEFINED
|| slot2->nth_rec == ULINT_UNDEFINED) { || slot2->nth_rec == ULINT_UNDEFINED) {
if (i > divergence_level + 1) {
/* In trees whose height is > 1 our algorithm
tends to underestimate: multiply the estimate
by 2: */
n_rows = n_rows * 2;
}
return(n_rows); return(n_rows);
} }
...@@ -2417,6 +2426,8 @@ btr_estimate_n_rows_in_range( ...@@ -2417,6 +2426,8 @@ btr_estimate_n_rows_in_range(
return(10); return(10);
} }
divergence_level = i;
diverged = TRUE; diverged = TRUE;
} else if (diverged) { } else if (diverged) {
n_rows = (n_rows * (slot1->n_recs + slot2->n_recs)) n_rows = (n_rows * (slot1->n_recs + slot2->n_recs))
......
...@@ -21,6 +21,7 @@ Created 11/11/1995 Heikki Tuuri ...@@ -21,6 +21,7 @@ Created 11/11/1995 Heikki Tuuri
#include "ibuf0ibuf.h" #include "ibuf0ibuf.h"
#include "log0log.h" #include "log0log.h"
#include "os0file.h" #include "os0file.h"
#include "trx0sys.h"
/* When flushed, dirty blocks are searched in neigborhoods of this size, and /* When flushed, dirty blocks are searched in neigborhoods of this size, and
flushed along with the original page. */ flushed along with the original page. */
......
...@@ -1698,8 +1698,7 @@ ibuf_contract( ...@@ -1698,8 +1698,7 @@ ibuf_contract(
btr_pcur_open_at_rnd_pos(data->index, BTR_SEARCH_LEAF, &pcur, &mtr); btr_pcur_open_at_rnd_pos(data->index, BTR_SEARCH_LEAF, &pcur, &mtr);
if (data->size == 1 if (0 == page_get_n_recs(btr_pcur_get_page(&pcur))) {
&& 0 == page_get_n_recs(btr_pcur_get_page(&pcur))) {
/* This tree is empty */ /* This tree is empty */
......
...@@ -789,8 +789,8 @@ row_upd_store_row( ...@@ -789,8 +789,8 @@ row_upd_store_row(
node->row = row_build(ROW_COPY_DATA, clust_index, rec, node->heap); node->row = row_build(ROW_COPY_DATA, clust_index, rec, node->heap);
node->ext_vec = mem_heap_alloc(node->heap, rec_get_n_fields(rec)); node->ext_vec = mem_heap_alloc(node->heap, sizeof(ulint)
* rec_get_n_fields(rec));
if (node->is_delete) { if (node->is_delete) {
update = NULL; update = NULL;
} else { } else {
......
...@@ -678,6 +678,8 @@ trx_purge_choose_next_log(void) ...@@ -678,6 +678,8 @@ trx_purge_choose_next_log(void)
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list); rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
min_trx_no = ut_dulint_max;
min_rseg = NULL; min_rseg = NULL;
while (rseg) { while (rseg) {
......
...@@ -1798,6 +1798,9 @@ compiler." ...@@ -1798,6 +1798,9 @@ compiler."
*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
# these systems don't actually have a c library (as such)! # these systems don't actually have a c library (as such)!
;; ;;
*-*-freebsd*)
#FreeBSD needs to handle -lc and -lc_r itself
;;
*-*-rhapsody*) *-*-rhapsody*)
# rhapsody is a little odd... # rhapsody is a little odd...
deplibs="$deplibs -framework System" deplibs="$deplibs -framework System"
......
...@@ -822,11 +822,11 @@ ha_innobase::open( ...@@ -822,11 +822,11 @@ ha_innobase::open(
if (NULL == (ib_table = dict_table_get(norm_name, NULL))) { if (NULL == (ib_table = dict_table_get(norm_name, NULL))) {
fprintf(stderr, "\ fprintf(stderr,
Cannot find table %s from the internal data dictionary\n\ "Cannot find table %s from the internal data dictionary\n"
of InnoDB though the .frm file for the table exists. Maybe you have deleted\n\ "of InnoDB though the .frm file for the table exists. Maybe you have deleted\n"
and created again an InnoDB database but forgotten to delete the\n\ "and created again an InnoDB database but forgotten to delete the\n"
corresponding .frm files of old InnoDB tables?\n", "corresponding .frm files of old InnoDB tables?\n",
norm_name); norm_name);
free_share(share); free_share(share);
...@@ -2659,6 +2659,37 @@ ha_innobase::records_in_range( ...@@ -2659,6 +2659,37 @@ ha_innobase::records_in_range(
DBUG_RETURN((ha_rows) n_rows); DBUG_RETURN((ha_rows) n_rows);
} }
/*************************************************************************
Gives an UPPER BOUND to the number of rows in a table. This is used in
filesort.cc and the upper bound must hold. TODO: Since the number of
rows in a table may change after this function is called, we still may
get a 'Sort aborted' error in filesort.cc of MySQL. The ultimate fix is to
improve the algorithm of filesort.cc. */
ha_rows
ha_innobase::estimate_number_of_rows(void)
/*======================================*/
/* out: upper bound of rows, currently 32-bit int
or uint */
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
dict_table_t* ib_table;
DBUG_ENTER("info");
ib_table = prebuilt->table;
dict_update_statistics(ib_table);
data_file_length = ((ulonglong)
ib_table->stat_clustered_index_size)
* UNIV_PAGE_SIZE;
/* The minimum clustered index record size is 20 bytes */
return((ha_rows) (1000 + data_file_length / 20));
}
/************************************************************************* /*************************************************************************
How many seeks it will take to read through the table. This is to be How many seeks it will take to read through the table. This is to be
comparable to the number returned by records_in_range so that we can comparable to the number returned by records_in_range so that we can
......
...@@ -137,6 +137,7 @@ class ha_innobase: public handler ...@@ -137,6 +137,7 @@ class ha_innobase: public handler
enum ha_rkey_function start_search_flag, enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len, const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag); enum ha_rkey_function end_search_flag);
ha_rows estimate_number_of_rows();
int create(const char *name, register TABLE *form, int create(const char *name, register TABLE *form,
HA_CREATE_INFO *create_info); HA_CREATE_INFO *create_info);
......
...@@ -35,7 +35,7 @@ ulong myisam_recover_options= HA_RECOVER_NONE; ...@@ -35,7 +35,7 @@ ulong myisam_recover_options= HA_RECOVER_NONE;
/* bits in myisam_recover_options */ /* bits in myisam_recover_options */
const char *myisam_recover_names[] = const char *myisam_recover_names[] =
{ "DEFAULT", "BACKUP", "FORCE", "QUICK"}; { "DEFAULT", "BACKUP", "FORCE", "QUICK", NullS};
TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names),"", TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names),"",
myisam_recover_names}; myisam_recover_names};
......
...@@ -156,8 +156,7 @@ void kill_one_thread(THD *thd, ulong id); ...@@ -156,8 +156,7 @@ void kill_one_thread(THD *thd, ulong id);
#define OPTION_LOW_PRIORITY_UPDATES 8192 #define OPTION_LOW_PRIORITY_UPDATES 8192
#define OPTION_WARNINGS 16384 #define OPTION_WARNINGS 16384
#define OPTION_AUTO_IS_NULL 32768 #define OPTION_AUTO_IS_NULL 32768
#define OPTION_ANSI_MODE 65536L #define OPTION_SAFE_UPDATES 65536L*2
#define OPTION_SAFE_UPDATES OPTION_ANSI_MODE*2
#define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2 #define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2
#define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2 #define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2
#define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2 #define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2
...@@ -173,6 +172,14 @@ void kill_one_thread(THD *thd, ulong id); ...@@ -173,6 +172,14 @@ void kill_one_thread(THD *thd, ulong id);
#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2 #define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2
#define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2 #define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2
/* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT 1
#define MODE_PIPES_AS_CONCAT 2
#define MODE_ANSI_QUOTES 4
#define MODE_IGNORE_SPACE 8
#define MODE_SERIALIZABLE 16
#define MODE_ONLY_FULL_GROUP_BY 32
#define RAID_BLOCK_SIZE 1024 #define RAID_BLOCK_SIZE 1024
/* BINLOG_DUMP options */ /* BINLOG_DUMP options */
...@@ -530,7 +537,7 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size, ...@@ -530,7 +537,7 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
what_to_log,flush_time, what_to_log,flush_time,
max_tmp_tables,max_heap_table_size,query_buff_size, max_tmp_tables,max_heap_table_size,query_buff_size,
lower_case_table_names,thread_stack,thread_stack_min, lower_case_table_names,thread_stack,thread_stack_min,
binlog_cache_size, max_binlog_cache_size; binlog_cache_size, max_binlog_cache_size, opt_sql_mode;
extern ulong specialflag, current_pid; extern ulong specialflag, current_pid;
extern bool low_priority_updates, using_update_log; extern bool low_priority_updates, using_update_log;
extern bool opt_sql_bin_update, opt_safe_show_db, opt_warnings; extern bool opt_sql_bin_update, opt_safe_show_db, opt_warnings;
......
...@@ -211,7 +211,7 @@ static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN]; ...@@ -211,7 +211,7 @@ static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN];
static pthread_t select_thread; static pthread_t select_thread;
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl, static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0, opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
opt_ansi_mode=0,opt_myisam_log=0, opt_myisam_log=0,
opt_large_files=sizeof(my_off_t) > 4; opt_large_files=sizeof(my_off_t) > 4;
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0; bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0;
FILE *bootstrap_file=0; FILE *bootstrap_file=0;
...@@ -307,6 +307,7 @@ char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION; ...@@ -307,6 +307,7 @@ char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION;
const char *first_keyword="first"; const char *first_keyword="first";
const char **errmesg; /* Error messages */ const char **errmesg; /* Error messages */
const char *myisam_recover_options_str="OFF"; const char *myisam_recover_options_str="OFF";
const char *sql_mode_str="OFF";
const char *default_tx_isolation_name; const char *default_tx_isolation_name;
enum_tx_isolation default_tx_isolation=ISO_READ_COMMITTED; enum_tx_isolation default_tx_isolation=ISO_READ_COMMITTED;
...@@ -320,6 +321,12 @@ double log_10[32]; /* 10 potences */ ...@@ -320,6 +321,12 @@ double log_10[32]; /* 10 potences */
I_List<THD> threads,thread_cache; I_List<THD> threads,thread_cache;
time_t start_time; time_t start_time;
ulong opt_sql_mode = 0L;
const char *sql_mode_names[] =
{ "REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE",
"SERIALIZE","ONLY_FULL_GROUP_BY", NullS };
TYPELIB sql_mode_typelib= {array_elements(sql_mode_names),"",
sql_mode_names};
MY_BITMAP temp_pool; MY_BITMAP temp_pool;
bool use_temp_pool=0; bool use_temp_pool=0;
...@@ -2471,7 +2478,8 @@ enum options { ...@@ -2471,7 +2478,8 @@ enum options {
OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER, OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER,
OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC, OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC,
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
OPT_SQL_MODE
}; };
static struct option long_options[] = { static struct option long_options[] = {
...@@ -2604,6 +2612,7 @@ static struct option long_options[] = { ...@@ -2604,6 +2612,7 @@ static struct option long_options[] = {
{"skip-symlink", no_argument, 0, (int) OPT_SKIP_SYMLINKS}, {"skip-symlink", no_argument, 0, (int) OPT_SKIP_SYMLINKS},
{"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR}, {"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR},
{"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME}, {"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME},
{"sql-mode", required_argument, 0, (int) OPT_SQL_MODE},
#include "sslopt-longopts.h" #include "sslopt-longopts.h"
#ifdef __WIN__ #ifdef __WIN__
{"standalone", no_argument, 0, (int) OPT_STANDALONE}, {"standalone", no_argument, 0, (int) OPT_STANDALONE},
...@@ -2764,7 +2773,6 @@ CHANGEABLE_VAR changeable_vars[] = { ...@@ -2764,7 +2773,6 @@ CHANGEABLE_VAR changeable_vars[] = {
struct show_var_st init_vars[]= { struct show_var_st init_vars[]= {
{"ansi_mode", (char*) &opt_ansi_mode, SHOW_BOOL},
{"back_log", (char*) &back_log, SHOW_LONG}, {"back_log", (char*) &back_log, SHOW_LONG},
{"basedir", mysql_home, SHOW_CHAR}, {"basedir", mysql_home, SHOW_CHAR},
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
...@@ -2866,6 +2874,7 @@ struct show_var_st init_vars[]= { ...@@ -2866,6 +2874,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},
{"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},
...@@ -3049,6 +3058,9 @@ static void usage(void) ...@@ -3049,6 +3058,9 @@ static void usage(void)
Don't give threads different priorities.\n\ Don't give threads different priorities.\n\
--socket=... Socket file to use for connection\n\ --socket=... Socket file to use for connection\n\
-t, --tmpdir=path Path for temporary files\n\ -t, --tmpdir=path Path for temporary files\n\
--sql-mode=option[,option[,option...]] where option can be one of:\n\
REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES,\n\
IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY.\n\
--transaction-isolation\n\ --transaction-isolation\n\
Default transaction isolation level\n\ Default transaction isolation level\n\
--temp-pool Use a pool of temporary files\n\ --temp-pool Use a pool of temporary files\n\
...@@ -3202,8 +3214,9 @@ static void get_options(int argc,char **argv) ...@@ -3202,8 +3214,9 @@ static void get_options(int argc,char **argv)
opt_warnings=1; opt_warnings=1;
break; break;
case 'a': case 'a':
opt_ansi_mode=1; opt_sql_mode = (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT |
thd_startup_options|=OPTION_ANSI_MODE; MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_SERIALIZABLE
| MODE_ONLY_FULL_GROUP_BY);
default_tx_isolation= ISO_SERIALIZABLE; default_tx_isolation= ISO_SERIALIZABLE;
break; break;
case 'b': case 'b':
...@@ -3726,6 +3739,19 @@ static void get_options(int argc,char **argv) ...@@ -3726,6 +3739,19 @@ 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);
}
if (opt_sql_mode & MODE_SERIALIZABLE)
default_tx_isolation= ISO_SERIALIZABLE;
break;
}
case OPT_MASTER_HOST: case OPT_MASTER_HOST:
master_host=optarg; master_host=optarg;
break; break;
......
...@@ -120,6 +120,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), ...@@ -120,6 +120,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
server_status=SERVER_STATUS_AUTOCOMMIT; server_status=SERVER_STATUS_AUTOCOMMIT;
update_lock_default= low_priority_updates ? TL_WRITE_LOW_PRIORITY : TL_WRITE; update_lock_default= low_priority_updates ? TL_WRITE_LOW_PRIORITY : TL_WRITE;
options=thd_startup_options; options=thd_startup_options;
sql_mode=(uint) opt_sql_mode;
inactive_timeout=net_wait_timeout; inactive_timeout=net_wait_timeout;
open_options=ha_open_options; open_options=ha_open_options;
tx_isolation=session_tx_isolation=default_tx_isolation; tx_isolation=session_tx_isolation=default_tx_isolation;
......
...@@ -232,7 +232,7 @@ class THD :public ilink { ...@@ -232,7 +232,7 @@ class THD :public ilink {
char *query,*thread_stack; char *query,*thread_stack;
char *host,*user,*priv_user,*db,*ip; char *host,*user,*priv_user,*db,*ip;
const char *proc_info; const char *proc_info;
uint client_capabilities,max_packet_length; uint client_capabilities,sql_mode,max_packet_length;
uint master_access,db_access; uint master_access,db_access;
TABLE *open_tables,*temporary_tables; TABLE *open_tables,*temporary_tables;
MYSQL_LOCK *lock,*locked_tables; MYSQL_LOCK *lock,*locked_tables;
......
...@@ -121,7 +121,7 @@ void lex_init(void) ...@@ -121,7 +121,7 @@ void lex_init(void)
state_map[(uchar)'*']= (uchar) STATE_END_LONG_COMMENT; state_map[(uchar)'*']= (uchar) STATE_END_LONG_COMMENT;
state_map[(uchar)'@']= (uchar) STATE_USER_END; state_map[(uchar)'@']= (uchar) STATE_USER_END;
state_map[(uchar) '`']= (uchar) STATE_USER_VARIABLE_DELIMITER; state_map[(uchar) '`']= (uchar) STATE_USER_VARIABLE_DELIMITER;
if (thd_startup_options & OPTION_ANSI_MODE) if (opt_sql_mode & MODE_ANSI_QUOTES)
{ {
state_map[(uchar) '"'] = STATE_USER_VARIABLE_DELIMITER; state_map[(uchar) '"'] = STATE_USER_VARIABLE_DELIMITER;
} }
...@@ -149,7 +149,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) ...@@ -149,7 +149,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->ftfunc_list.empty(); lex->ftfunc_list.empty();
lex->convert_set=(lex->thd=thd)->convert_set; lex->convert_set=(lex->thd=thd)->convert_set;
lex->yacc_yyss=lex->yacc_yyvs=0; lex->yacc_yyss=lex->yacc_yyvs=0;
lex->ignore_space=test(thd->client_capabilities & CLIENT_IGNORE_SPACE); lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
return lex; return lex;
} }
......
...@@ -412,6 +412,8 @@ check_connections(THD *thd) ...@@ -412,6 +412,8 @@ check_connections(THD *thd)
return(ER_OUT_OF_RESOURCES); return(ER_OUT_OF_RESOURCES);
thd->client_capabilities=uint2korr(net->read_pos); thd->client_capabilities=uint2korr(net->read_pos);
if (thd->client_capabilities & CLIENT_IGNORE_SPACE)
thd->sql_mode|= MODE_IGNORE_SPACE;
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
DBUG_PRINT("info", DBUG_PRINT("info",
("pkt_len:%d, client capabilities: %d", ("pkt_len:%d, client capabilities: %d",
...@@ -538,8 +540,6 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -538,8 +540,6 @@ pthread_handler_decl(handle_one_connection,arg)
thd->options |= OPTION_BIG_SELECTS; thd->options |= OPTION_BIG_SELECTS;
if (thd->client_capabilities & CLIENT_COMPRESS) if (thd->client_capabilities & CLIENT_COMPRESS)
net->compress=1; // Use compression net->compress=1; // Use compression
if (thd->options & OPTION_ANSI_MODE)
thd->client_capabilities|=CLIENT_IGNORE_SPACE;
thd->proc_info=0; // Remove 'login' thd->proc_info=0; // Remove 'login'
thd->command=COM_SLEEP; thd->command=COM_SLEEP;
......
...@@ -5425,6 +5425,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, ...@@ -5425,6 +5425,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
{ {
if ((error=file->delete_row(record))) if ((error=file->delete_row(record)))
goto err; goto err;
error=file->rnd_next(record);
continue; continue;
} }
if (copy_blobs(first_field)) if (copy_blobs(first_field))
...@@ -5936,7 +5937,7 @@ setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields, ...@@ -5936,7 +5937,7 @@ setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields,
if (!order) if (!order)
return 0; /* Everything is ok */ return 0; /* Everything is ok */
if (thd->options & OPTION_ANSI_MODE) if (thd->sql_mode & MODE_ONLY_FULL_GROUP_BY)
{ {
Item *item; Item *item;
List_iterator<Item> li(fields); List_iterator<Item> li(fields);
...@@ -5958,7 +5959,7 @@ setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields, ...@@ -5958,7 +5959,7 @@ setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields,
return 1; return 1;
} }
} }
if (thd->options & OPTION_ANSI_MODE) if (thd->sql_mode & MODE_ONLY_FULL_GROUP_BY)
{ {
/* Don't allow one to use fields that is not used in GROUP BY */ /* Don't allow one to use fields that is not used in GROUP BY */
Item *item; Item *item;
......
...@@ -34,7 +34,7 @@ int yylex(void *yylval); ...@@ -34,7 +34,7 @@ int yylex(void *yylval);
inline Item *or_or_concat(Item* A, Item* B) inline Item *or_or_concat(Item* A, Item* B)
{ {
return (current_thd->options & OPTION_ANSI_MODE ? return (current_thd->sql_mode & MODE_PIPES_AS_CONCAT ?
(Item*) new Item_func_concat(A,B) : (Item*) new Item_cond_or(A,B)); (Item*) new Item_func_concat(A,B) : (Item*) new Item_cond_or(A,B));
} }
...@@ -915,7 +915,7 @@ int_type: ...@@ -915,7 +915,7 @@ int_type:
| BIGINT { $$=FIELD_TYPE_LONGLONG; } | BIGINT { $$=FIELD_TYPE_LONGLONG; }
real_type: real_type:
REAL { $$= current_thd->options & OPTION_ANSI_MODE ? REAL { $$= current_thd->sql_mode & MODE_REAL_AS_FLOAT ?
FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; } FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; }
| DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; } | DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; }
| DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; } | DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; }
......
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