Fixes during review of new pushed code
Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong
This commit is contained in:
parent
e80252e53c
commit
4c0d23e156
@ -958,8 +958,6 @@ int ha_berkeley::write_row(byte * record)
|
|||||||
{
|
{
|
||||||
DB_TXN *sub_trans = transaction;
|
DB_TXN *sub_trans = transaction;
|
||||||
/* Don't use sub transactions in temporary tables */
|
/* Don't use sub transactions in temporary tables */
|
||||||
ulong thd_options= (table->s->tmp_table == NO_TMP_TABLE ?
|
|
||||||
table->in_use->options : 0);
|
|
||||||
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
|
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
|
||||||
{
|
{
|
||||||
key_map changed_keys(0);
|
key_map changed_keys(0);
|
||||||
@ -1070,7 +1068,7 @@ int ha_berkeley::key_cmp(uint keynr, const byte * old_row,
|
|||||||
int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
|
int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
|
||||||
const byte * old_row, DBT *old_key,
|
const byte * old_row, DBT *old_key,
|
||||||
const byte * new_row, DBT *new_key,
|
const byte * new_row, DBT *new_key,
|
||||||
ulong thd_options, bool local_using_ignore)
|
bool local_using_ignore)
|
||||||
{
|
{
|
||||||
DBT row;
|
DBT row;
|
||||||
int error;
|
int error;
|
||||||
@ -1119,8 +1117,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
|
|||||||
int ha_berkeley::restore_keys(DB_TXN *trans, key_map *changed_keys,
|
int ha_berkeley::restore_keys(DB_TXN *trans, key_map *changed_keys,
|
||||||
uint primary_key,
|
uint primary_key,
|
||||||
const byte *old_row, DBT *old_key,
|
const byte *old_row, DBT *old_key,
|
||||||
const byte *new_row, DBT *new_key,
|
const byte *new_row, DBT *new_key)
|
||||||
ulong thd_options)
|
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
DBT tmp_key;
|
DBT tmp_key;
|
||||||
@ -1130,7 +1127,7 @@ int ha_berkeley::restore_keys(DB_TXN *trans, key_map *changed_keys,
|
|||||||
/* Restore the old primary key, and the old row, but don't ignore
|
/* Restore the old primary key, and the old row, but don't ignore
|
||||||
duplicate key failure */
|
duplicate key failure */
|
||||||
if ((error=update_primary_key(trans, TRUE, new_row, new_key,
|
if ((error=update_primary_key(trans, TRUE, new_row, new_key,
|
||||||
old_row, old_key, thd_options, FALSE)))
|
old_row, old_key, FALSE)))
|
||||||
goto err; /* purecov: inspected */
|
goto err; /* purecov: inspected */
|
||||||
|
|
||||||
/* Remove the new key, and put back the old key
|
/* Remove the new key, and put back the old key
|
||||||
@ -1167,8 +1164,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
|
|||||||
DBT prim_key, key, old_prim_key;
|
DBT prim_key, key, old_prim_key;
|
||||||
int error;
|
int error;
|
||||||
DB_TXN *sub_trans;
|
DB_TXN *sub_trans;
|
||||||
ulong thd_options= (table->s->tmp_table == NO_TMP_TABLE ?
|
|
||||||
table->in_use->options : 0);
|
|
||||||
bool primary_key_changed;
|
bool primary_key_changed;
|
||||||
DBUG_ENTER("update_row");
|
DBUG_ENTER("update_row");
|
||||||
LINT_INIT(error);
|
LINT_INIT(error);
|
||||||
@ -1204,7 +1199,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
|
|||||||
if (!(error=update_primary_key(sub_trans, primary_key_changed,
|
if (!(error=update_primary_key(sub_trans, primary_key_changed,
|
||||||
old_row, &old_prim_key,
|
old_row, &old_prim_key,
|
||||||
new_row, &prim_key,
|
new_row, &prim_key,
|
||||||
thd_options, using_ignore)))
|
using_ignore)))
|
||||||
{
|
{
|
||||||
// Update all other keys
|
// Update all other keys
|
||||||
for (uint keynr=0 ; keynr < table->s->keys ; keynr++)
|
for (uint keynr=0 ; keynr < table->s->keys ; keynr++)
|
||||||
@ -1239,8 +1234,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
|
|||||||
int new_error = 0;
|
int new_error = 0;
|
||||||
if (!changed_keys.is_clear_all())
|
if (!changed_keys.is_clear_all())
|
||||||
new_error=restore_keys(transaction, &changed_keys, primary_key,
|
new_error=restore_keys(transaction, &changed_keys, primary_key,
|
||||||
old_row, &old_prim_key, new_row, &prim_key,
|
old_row, &old_prim_key, new_row, &prim_key);
|
||||||
thd_options);
|
|
||||||
if (new_error)
|
if (new_error)
|
||||||
{
|
{
|
||||||
/* This shouldn't happen */
|
/* This shouldn't happen */
|
||||||
@ -1342,8 +1336,6 @@ int ha_berkeley::delete_row(const byte * record)
|
|||||||
int error;
|
int error;
|
||||||
DBT row, prim_key;
|
DBT row, prim_key;
|
||||||
key_map keys= table->s->keys_in_use;
|
key_map keys= table->s->keys_in_use;
|
||||||
ulong thd_options= (table->s->tmp_table == NO_TMP_TABLE ?
|
|
||||||
table->in_use->options : 0);
|
|
||||||
DBUG_ENTER("delete_row");
|
DBUG_ENTER("delete_row");
|
||||||
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
|
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
|
||||||
|
|
||||||
|
@ -74,13 +74,12 @@ class ha_berkeley: public handler
|
|||||||
DBT *prim_key, key_map *keys);
|
DBT *prim_key, key_map *keys);
|
||||||
int restore_keys(DB_TXN *trans, key_map *changed_keys, uint primary_key,
|
int restore_keys(DB_TXN *trans, key_map *changed_keys, uint primary_key,
|
||||||
const byte *old_row, DBT *old_key,
|
const byte *old_row, DBT *old_key,
|
||||||
const byte *new_row, DBT *new_key,
|
const byte *new_row, DBT *new_key);
|
||||||
ulong thd_options);
|
|
||||||
int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
|
int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
|
||||||
int update_primary_key(DB_TXN *trans, bool primary_key_changed,
|
int update_primary_key(DB_TXN *trans, bool primary_key_changed,
|
||||||
const byte * old_row, DBT *old_key,
|
const byte * old_row, DBT *old_key,
|
||||||
const byte * new_row, DBT *prim_key,
|
const byte * new_row, DBT *prim_key,
|
||||||
ulong thd_options, bool local_using_ignore);
|
bool local_using_ignore);
|
||||||
int read_row(int error, char *buf, uint keynr, DBT *row, DBT *key, bool);
|
int read_row(int error, char *buf, uint keynr, DBT *row, DBT *key, bool);
|
||||||
DBT *get_pos(DBT *to, byte *pos);
|
DBT *get_pos(DBT *to, byte *pos);
|
||||||
|
|
||||||
|
@ -6997,6 +6997,8 @@ ha_ndbcluster::build_scan_filter_predicate(Ndb_cond * &cond,
|
|||||||
break;
|
break;
|
||||||
Ndb_item *a= cond->next->ndb_item;
|
Ndb_item *a= cond->next->ndb_item;
|
||||||
Ndb_item *b, *field, *value= NULL;
|
Ndb_item *b, *field, *value= NULL;
|
||||||
|
LINT_INIT(field);
|
||||||
|
|
||||||
switch (cond->ndb_item->argument_count()) {
|
switch (cond->ndb_item->argument_count()) {
|
||||||
case 1:
|
case 1:
|
||||||
field=
|
field=
|
||||||
|
@ -39,12 +39,11 @@ void unireg_init(ulong options)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
VOID(strmov(reg_ext,".frm"));
|
VOID(strmov(reg_ext,".frm"));
|
||||||
specialflag=SPECIAL_SAME_DB_NAME;
|
specialflag=SPECIAL_SAME_DB_NAME | options; /* Set options from argv */
|
||||||
/* Make a tab of powers of 10 */
|
/* Make a tab of powers of 10 */
|
||||||
for (i=0,nr=1.0; i < array_elements(log_10) ; i++)
|
for (i=0,nr=1.0; i < array_elements(log_10) ; i++)
|
||||||
{ /* It's used by filesort... */
|
{ /* It's used by filesort... */
|
||||||
log_10[i]= nr ; nr*= 10.0;
|
log_10[i]= nr ; nr*= 10.0;
|
||||||
}
|
}
|
||||||
specialflag|=options; /* Set options from argv */
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -2291,8 +2291,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
|
|||||||
DBUG_ASSERT(table == 0);
|
DBUG_ASSERT(table == 0);
|
||||||
if (!(table= create_tmp_table(thd, tmp_table_param, list, (ORDER*) 0, 1,
|
if (!(table= create_tmp_table(thd, tmp_table_param, list, (ORDER*) 0, 1,
|
||||||
0,
|
0,
|
||||||
(select_lex->options | thd->options) &
|
(select_lex->options | thd->options),
|
||||||
~TMP_TABLE_FORCE_MYISAM,
|
|
||||||
HA_POS_ERROR, (char*)"")))
|
HA_POS_ERROR, (char*)"")))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
table->file->extra(HA_EXTRA_NO_ROWS); // Don't update rows
|
table->file->extra(HA_EXTRA_NO_ROWS); // Don't update rows
|
||||||
@ -3074,8 +3073,7 @@ bool Item_func_group_concat::setup(THD *thd)
|
|||||||
*/
|
*/
|
||||||
if (!(table= create_tmp_table(thd, tmp_table_param, all_fields,
|
if (!(table= create_tmp_table(thd, tmp_table_param, all_fields,
|
||||||
(ORDER*) 0, 0, TRUE,
|
(ORDER*) 0, 0, TRUE,
|
||||||
(select_lex->options | thd->options) &
|
(select_lex->options | thd->options),
|
||||||
~TMP_TABLE_FORCE_MYISAM,
|
|
||||||
HA_POS_ERROR, (char*) "")))
|
HA_POS_ERROR, (char*) "")))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
table->file->extra(HA_EXTRA_NO_ROWS);
|
table->file->extra(HA_EXTRA_NO_ROWS);
|
||||||
|
@ -256,13 +256,6 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
|
|||||||
#define OPTION_WARNINGS (1L << 13) // THD, user
|
#define OPTION_WARNINGS (1L << 13) // THD, user
|
||||||
#define OPTION_AUTO_IS_NULL (1L << 14) // THD, user, binlog
|
#define OPTION_AUTO_IS_NULL (1L << 14) // THD, user, binlog
|
||||||
#define OPTION_FOUND_COMMENT (1L << 15) // SELECT, intern, parser
|
#define OPTION_FOUND_COMMENT (1L << 15) // SELECT, intern, parser
|
||||||
/*
|
|
||||||
Force the used temporary table to be a MyISAM table (because we will use
|
|
||||||
fulltext functions when reading from it. This uses the same constant as
|
|
||||||
OPTION_FOUND_COMMENT because we've run out of bits and these two values
|
|
||||||
are not used together.
|
|
||||||
*/
|
|
||||||
#define TMP_TABLE_FORCE_MYISAM (1L << 15)
|
|
||||||
#define OPTION_SAFE_UPDATES (1L << 16) // THD, user
|
#define OPTION_SAFE_UPDATES (1L << 16) // THD, user
|
||||||
#define OPTION_BUFFER_RESULT (1L << 17) // SELECT, user
|
#define OPTION_BUFFER_RESULT (1L << 17) // SELECT, user
|
||||||
#define OPTION_BIN_LOG (1L << 18) // THD, user
|
#define OPTION_BIN_LOG (1L << 18) // THD, user
|
||||||
@ -291,6 +284,11 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
|
|||||||
#define OPTION_SETUP_TABLES_DONE (1L << 30) // intern
|
#define OPTION_SETUP_TABLES_DONE (1L << 30) // intern
|
||||||
/* If not set then the thread will ignore all warnings with level notes. */
|
/* If not set then the thread will ignore all warnings with level notes. */
|
||||||
#define OPTION_SQL_NOTES (1L << 31) // THD, user
|
#define OPTION_SQL_NOTES (1L << 31) // THD, user
|
||||||
|
/*
|
||||||
|
Force the used temporary table to be a MyISAM table (because we will use
|
||||||
|
fulltext functions when reading from it.
|
||||||
|
*/
|
||||||
|
#define TMP_TABLE_FORCE_MYISAM (LL(1) << 32)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Maximum length of time zone name that we support
|
Maximum length of time zone name that we support
|
||||||
@ -726,7 +724,7 @@ int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
|
|||||||
enum enum_duplicates handle_duplicates, bool ignore);
|
enum enum_duplicates handle_duplicates, bool ignore);
|
||||||
bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
|
bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
|
||||||
List<Item> *fields, List<Item> *values,
|
List<Item> *fields, List<Item> *values,
|
||||||
COND *conds, ulong options,
|
COND *conds, ulonglong options,
|
||||||
enum enum_duplicates handle_duplicates, bool ignore,
|
enum enum_duplicates handle_duplicates, bool ignore,
|
||||||
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
|
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
|
||||||
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
||||||
@ -742,7 +740,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
|
|||||||
TABLE_LIST *table_list);
|
TABLE_LIST *table_list);
|
||||||
bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
|
bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
|
||||||
bool mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
|
bool mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
|
||||||
ha_rows rows, ulong options);
|
ha_rows rows, ulonglong options);
|
||||||
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
|
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
|
||||||
bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
|
bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
|
||||||
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
|
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
|
||||||
@ -1107,6 +1105,7 @@ extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
|
|||||||
extern double log_10[32];
|
extern double log_10[32];
|
||||||
extern ulonglong log_10_int[20];
|
extern ulonglong log_10_int[20];
|
||||||
extern ulonglong keybuff_size;
|
extern ulonglong keybuff_size;
|
||||||
|
extern ulonglong thd_startup_options;
|
||||||
extern ulong refresh_version,flush_version, thread_id;
|
extern ulong refresh_version,flush_version, thread_id;
|
||||||
extern ulong binlog_cache_use, binlog_cache_disk_use;
|
extern ulong binlog_cache_use, binlog_cache_disk_use;
|
||||||
extern ulong aborted_threads,aborted_connects;
|
extern ulong aborted_threads,aborted_connects;
|
||||||
@ -1116,7 +1115,7 @@ extern ulong delayed_insert_threads, delayed_insert_writes;
|
|||||||
extern ulong delayed_rows_in_use,delayed_insert_errors;
|
extern ulong delayed_rows_in_use,delayed_insert_errors;
|
||||||
extern ulong slave_open_temp_tables;
|
extern ulong slave_open_temp_tables;
|
||||||
extern ulong query_cache_size, query_cache_min_res_unit;
|
extern ulong query_cache_size, query_cache_min_res_unit;
|
||||||
extern ulong thd_startup_options, slow_launch_threads, slow_launch_time;
|
extern ulong slow_launch_threads, slow_launch_time;
|
||||||
extern ulong table_cache_size;
|
extern ulong table_cache_size;
|
||||||
extern ulong max_connections,max_connect_errors, connect_timeout;
|
extern ulong max_connections,max_connect_errors, connect_timeout;
|
||||||
extern ulong slave_net_timeout, slave_trans_retries;
|
extern ulong slave_net_timeout, slave_trans_retries;
|
||||||
|
@ -387,8 +387,8 @@ uint delay_key_write_options, protocol_version;
|
|||||||
uint lower_case_table_names;
|
uint lower_case_table_names;
|
||||||
uint tc_heuristic_recover= 0;
|
uint tc_heuristic_recover= 0;
|
||||||
uint volatile thread_count, thread_running;
|
uint volatile thread_count, thread_running;
|
||||||
ulong back_log, connect_timeout, concurrency;
|
ulonglong thd_startup_options;
|
||||||
ulong server_id, thd_startup_options;
|
ulong back_log, connect_timeout, concurrency, server_id;
|
||||||
ulong table_cache_size, thread_stack, what_to_log;
|
ulong table_cache_size, thread_stack, what_to_log;
|
||||||
ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
|
ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
|
||||||
ulong open_files_limit, max_binlog_size, max_relay_log_size;
|
ulong open_files_limit, max_binlog_size, max_relay_log_size;
|
||||||
|
@ -1246,7 +1246,8 @@ public:
|
|||||||
update auto-updatable fields (like auto_increment and timestamp).
|
update auto-updatable fields (like auto_increment and timestamp).
|
||||||
*/
|
*/
|
||||||
query_id_t query_id, warn_id;
|
query_id_t query_id, warn_id;
|
||||||
ulong options, thread_id, col_access;
|
ulonglong options;
|
||||||
|
ulong thread_id, col_access;
|
||||||
|
|
||||||
/* Statement id is thread-wide. This counter is used to generate ids */
|
/* Statement id is thread-wide. This counter is used to generate ids */
|
||||||
ulong statement_id_counter;
|
ulong statement_id_counter;
|
||||||
@ -1498,7 +1499,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#define tmp_disable_binlog(A) \
|
#define tmp_disable_binlog(A) \
|
||||||
{ulong tmp_disable_binlog__save_options= (A)->options; \
|
{ulonglong tmp_disable_binlog__save_options= (A)->options; \
|
||||||
(A)->options&= ~OPTION_BIN_LOG
|
(A)->options&= ~OPTION_BIN_LOG
|
||||||
|
|
||||||
#define reenable_binlog(A) (A)->options= tmp_disable_binlog__save_options;}
|
#define reenable_binlog(A) (A)->options= tmp_disable_binlog__save_options;}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "sql_trigger.h"
|
#include "sql_trigger.h"
|
||||||
|
|
||||||
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||||
SQL_LIST *order, ha_rows limit, ulong options)
|
SQL_LIST *order, ha_rows limit, ulonglong options)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
TABLE *table;
|
TABLE *table;
|
||||||
@ -807,7 +807,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
|||||||
ha_enable_transaction(thd, FALSE);
|
ha_enable_transaction(thd, FALSE);
|
||||||
mysql_init_select(thd->lex);
|
mysql_init_select(thd->lex);
|
||||||
error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
|
error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
|
||||||
HA_POS_ERROR, 0);
|
HA_POS_ERROR, LL(0));
|
||||||
ha_enable_transaction(thd, TRUE);
|
ha_enable_transaction(thd, TRUE);
|
||||||
thd->options= save_options;
|
thd->options= save_options;
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
@ -142,8 +142,7 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
|
|||||||
unit->types, (ORDER*) 0,
|
unit->types, (ORDER*) 0,
|
||||||
FALSE, 1,
|
FALSE, 1,
|
||||||
(first_select->options | thd->options |
|
(first_select->options | thd->options |
|
||||||
TMP_TABLE_ALL_COLUMNS) &
|
TMP_TABLE_ALL_COLUMNS),
|
||||||
~TMP_TABLE_FORCE_MYISAM,
|
|
||||||
HA_POS_ERROR,
|
HA_POS_ERROR,
|
||||||
orig_table_list->alias)))
|
orig_table_list->alias)))
|
||||||
{
|
{
|
||||||
|
@ -305,7 +305,7 @@ protected:
|
|||||||
*link_next, **link_prev; /* list of whole SELECT_LEX */
|
*link_next, **link_prev; /* list of whole SELECT_LEX */
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ulong options;
|
ulonglong options;
|
||||||
/*
|
/*
|
||||||
result of this query can't be cached, bit field, can be :
|
result of this query can't be cached, bit field, can be :
|
||||||
UNCACHEABLE_DEPENDENT
|
UNCACHEABLE_DEPENDENT
|
||||||
|
@ -2943,8 +2943,8 @@ end_with_restore_list:
|
|||||||
*/
|
*/
|
||||||
if (thd->locked_tables || thd->active_transaction())
|
if (thd->locked_tables || thd->active_transaction())
|
||||||
{
|
{
|
||||||
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, ER(ER_LOCK_OR_ACTIVE_TRANSACTION),
|
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
|
||||||
MYF(0));
|
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -6465,12 +6465,14 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
|||||||
THR_LOCK_DATA **end_p= lock_p + thd->locked_tables->lock_count;
|
THR_LOCK_DATA **end_p= lock_p + thd->locked_tables->lock_count;
|
||||||
|
|
||||||
for (; lock_p < end_p; lock_p++)
|
for (; lock_p < end_p; lock_p++)
|
||||||
|
{
|
||||||
if ((*lock_p)->type == TL_WRITE)
|
if ((*lock_p)->type == TL_WRITE)
|
||||||
{
|
{
|
||||||
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
|
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Writing to the binlog could cause deadlocks, as we don't log
|
Writing to the binlog could cause deadlocks, as we don't log
|
||||||
UNLOCK TABLES
|
UNLOCK TABLES
|
||||||
|
@ -1016,7 +1016,7 @@ JOIN::optimize()
|
|||||||
group_list : (ORDER*) 0),
|
group_list : (ORDER*) 0),
|
||||||
group_list ? 0 : select_distinct,
|
group_list ? 0 : select_distinct,
|
||||||
group_list && simple_group,
|
group_list && simple_group,
|
||||||
select_options & ~TMP_TABLE_FORCE_MYISAM,
|
select_options,
|
||||||
(order == 0 || skip_sort_order) ? select_limit :
|
(order == 0 || skip_sort_order) ? select_limit :
|
||||||
HA_POS_ERROR,
|
HA_POS_ERROR,
|
||||||
(char *) "")))
|
(char *) "")))
|
||||||
@ -1287,7 +1287,15 @@ JOIN::exec()
|
|||||||
if (need_tmp)
|
if (need_tmp)
|
||||||
{
|
{
|
||||||
if (tmp_join)
|
if (tmp_join)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
We are in a non cacheable sub query. Get the saved join structure
|
||||||
|
after optimization.
|
||||||
|
(curr_join may have been modified during last exection and we need
|
||||||
|
to reset it)
|
||||||
|
*/
|
||||||
curr_join= tmp_join;
|
curr_join= tmp_join;
|
||||||
|
}
|
||||||
curr_tmp_table= exec_tmp_table1;
|
curr_tmp_table= exec_tmp_table1;
|
||||||
|
|
||||||
/* Copy data to the temporary table */
|
/* Copy data to the temporary table */
|
||||||
@ -1397,8 +1405,7 @@ JOIN::exec()
|
|||||||
(ORDER*) 0,
|
(ORDER*) 0,
|
||||||
curr_join->select_distinct &&
|
curr_join->select_distinct &&
|
||||||
!curr_join->group_list,
|
!curr_join->group_list,
|
||||||
1, curr_join->select_options
|
1, curr_join->select_options,
|
||||||
& ~TMP_TABLE_FORCE_MYISAM,
|
|
||||||
HA_POS_ERROR,
|
HA_POS_ERROR,
|
||||||
(char *) "")))
|
(char *) "")))
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -8128,7 +8135,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
|||||||
TABLE *
|
TABLE *
|
||||||
create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||||
ORDER *group, bool distinct, bool save_sum_fields,
|
ORDER *group, bool distinct, bool save_sum_fields,
|
||||||
ulong select_options, ha_rows rows_limit,
|
ulonglong select_options, ha_rows rows_limit,
|
||||||
char *table_alias)
|
char *table_alias)
|
||||||
{
|
{
|
||||||
TABLE *table;
|
TABLE *table;
|
||||||
|
@ -202,7 +202,7 @@ class JOIN :public Sql_alloc
|
|||||||
Item *having;
|
Item *having;
|
||||||
Item *tmp_having; // To store having when processed temporary table
|
Item *tmp_having; // To store having when processed temporary table
|
||||||
Item *having_history; // Store having for explain
|
Item *having_history; // Store having for explain
|
||||||
uint select_options;
|
ulonglong select_options;
|
||||||
select_result *result;
|
select_result *result;
|
||||||
TMP_TABLE_PARAM tmp_table_param;
|
TMP_TABLE_PARAM tmp_table_param;
|
||||||
MYSQL_LOCK *lock;
|
MYSQL_LOCK *lock;
|
||||||
@ -258,14 +258,14 @@ class JOIN :public Sql_alloc
|
|||||||
bool union_part; // this subselect is part of union
|
bool union_part; // this subselect is part of union
|
||||||
bool optimized; // flag to avoid double optimization in EXPLAIN
|
bool optimized; // flag to avoid double optimization in EXPLAIN
|
||||||
|
|
||||||
JOIN(THD *thd_arg, List<Item> &fields_arg, ulong select_options_arg,
|
JOIN(THD *thd_arg, List<Item> &fields_arg, ulonglong select_options_arg,
|
||||||
select_result *result_arg)
|
select_result *result_arg)
|
||||||
:fields_list(fields_arg)
|
:fields_list(fields_arg)
|
||||||
{
|
{
|
||||||
init(thd_arg, fields_arg, select_options_arg, result_arg);
|
init(thd_arg, fields_arg, select_options_arg, result_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(THD *thd_arg, List<Item> &fields_arg, ulong select_options_arg,
|
void init(THD *thd_arg, List<Item> &fields_arg, ulonglong select_options_arg,
|
||||||
select_result *result_arg)
|
select_result *result_arg)
|
||||||
{
|
{
|
||||||
join_tab= join_tab_save= 0;
|
join_tab= join_tab_save= 0;
|
||||||
@ -437,7 +437,7 @@ void TEST_join(JOIN *join);
|
|||||||
bool store_val_in_field(Field *field,Item *val);
|
bool store_val_in_field(Field *field,Item *val);
|
||||||
TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||||
ORDER *group, bool distinct, bool save_sum_fields,
|
ORDER *group, bool distinct, bool save_sum_fields,
|
||||||
ulong select_options, ha_rows rows_limit,
|
ulonglong select_options, ha_rows rows_limit,
|
||||||
char* alias);
|
char* alias);
|
||||||
TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list);
|
TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list);
|
||||||
void free_tmp_table(THD *thd, TABLE *entry);
|
void free_tmp_table(THD *thd, TABLE *entry);
|
||||||
|
@ -3332,8 +3332,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
|||||||
if (!(table= create_tmp_table(thd, tmp_table_param,
|
if (!(table= create_tmp_table(thd, tmp_table_param,
|
||||||
field_list, (ORDER*) 0, 0, 0,
|
field_list, (ORDER*) 0, 0, 0,
|
||||||
(select_lex->options | thd->options |
|
(select_lex->options | thd->options |
|
||||||
TMP_TABLE_ALL_COLUMNS) &
|
TMP_TABLE_ALL_COLUMNS),
|
||||||
~TMP_TABLE_FORCE_MYISAM,
|
|
||||||
HA_POS_ERROR, table_list->alias)))
|
HA_POS_ERROR, table_list->alias)))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
table_list->schema_table_param= tmp_table_param;
|
table_list->schema_table_param= tmp_table_param;
|
||||||
|
@ -289,6 +289,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||||||
List_iterator_fast<Item> tp(types);
|
List_iterator_fast<Item> tp(types);
|
||||||
Query_arena *arena= thd->current_arena;
|
Query_arena *arena= thd->current_arena;
|
||||||
Item *type;
|
Item *type;
|
||||||
|
ulonglong create_options;
|
||||||
|
|
||||||
while ((type= tp++))
|
while ((type= tp++))
|
||||||
{
|
{
|
||||||
@ -300,8 +301,8 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong create_options= (first_select_in_union()->options | thd_arg->options |
|
create_options= (first_select_in_union()->options | thd_arg->options |
|
||||||
TMP_TABLE_ALL_COLUMNS) & ~TMP_TABLE_FORCE_MYISAM;
|
TMP_TABLE_ALL_COLUMNS);
|
||||||
/*
|
/*
|
||||||
Force the temporary table to be a MyISAM table if we're going to use
|
Force the temporary table to be a MyISAM table if we're going to use
|
||||||
fullext functions (MATCH ... AGAINST .. IN BOOLEAN MODE) when reading
|
fullext functions (MATCH ... AGAINST .. IN BOOLEAN MODE) when reading
|
||||||
|
@ -811,7 +811,7 @@ bool mysql_multi_update(THD *thd,
|
|||||||
List<Item> *fields,
|
List<Item> *fields,
|
||||||
List<Item> *values,
|
List<Item> *values,
|
||||||
COND *conds,
|
COND *conds,
|
||||||
ulong options,
|
ulonglong options,
|
||||||
enum enum_duplicates handle_duplicates, bool ignore,
|
enum enum_duplicates handle_duplicates, bool ignore,
|
||||||
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
|
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
|
||||||
{
|
{
|
||||||
|
@ -7752,7 +7752,8 @@ sys_option_value:
|
|||||||
/* We are in trigger and assigning value to field of new row */
|
/* We are in trigger and assigning value to field of new row */
|
||||||
Item *it;
|
Item *it;
|
||||||
Item_trigger_field *trg_fld;
|
Item_trigger_field *trg_fld;
|
||||||
sp_instr_set_trigger_field *i;
|
sp_instr_set_trigger_field *sp_fld;
|
||||||
|
LINT_INIT(sp_fld);
|
||||||
if ($1)
|
if ($1)
|
||||||
{
|
{
|
||||||
yyerror(ER(ER_SYNTAX_ERROR));
|
yyerror(ER(ER_SYNTAX_ERROR));
|
||||||
@ -7770,9 +7771,10 @@ sys_option_value:
|
|||||||
context,
|
context,
|
||||||
Item_trigger_field::NEW_ROW,
|
Item_trigger_field::NEW_ROW,
|
||||||
$2.base_name.str)) ||
|
$2.base_name.str)) ||
|
||||||
!(i= new sp_instr_set_trigger_field(lex->sphead->
|
!(sp_fld= new sp_instr_set_trigger_field(lex->sphead->
|
||||||
instructions(),
|
instructions(),
|
||||||
lex->spcont, trg_fld,
|
lex->spcont,
|
||||||
|
trg_fld,
|
||||||
it, lex)))
|
it, lex)))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
|
||||||
@ -7783,7 +7785,7 @@ sys_option_value:
|
|||||||
lex->trg_table_fields.link_in_list((byte *)trg_fld,
|
lex->trg_table_fields.link_in_list((byte *)trg_fld,
|
||||||
(byte **)&trg_fld->next_trg_field);
|
(byte **)&trg_fld->next_trg_field);
|
||||||
|
|
||||||
lex->sphead->add_instr(i);
|
lex->sphead->add_instr(sp_fld);
|
||||||
}
|
}
|
||||||
else if ($2.var)
|
else if ($2.var)
|
||||||
{ /* System variable */
|
{ /* System variable */
|
||||||
@ -7797,7 +7799,7 @@ sys_option_value:
|
|||||||
/* An SP local variable */
|
/* An SP local variable */
|
||||||
sp_pcontext *ctx= lex->spcont;
|
sp_pcontext *ctx= lex->spcont;
|
||||||
sp_pvar_t *spv;
|
sp_pvar_t *spv;
|
||||||
sp_instr_set *i;
|
sp_instr_set *sp_set;
|
||||||
Item *it;
|
Item *it;
|
||||||
if ($1)
|
if ($1)
|
||||||
{
|
{
|
||||||
@ -7813,9 +7815,9 @@ sys_option_value:
|
|||||||
it= spv->dflt;
|
it= spv->dflt;
|
||||||
else
|
else
|
||||||
it= new Item_null();
|
it= new Item_null();
|
||||||
i= new sp_instr_set(lex->sphead->instructions(), ctx,
|
sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
|
||||||
spv->offset, it, spv->type, lex, TRUE);
|
spv->offset, it, spv->type, lex, TRUE);
|
||||||
lex->sphead->add_instr(i);
|
lex->sphead->add_instr(sp_set);
|
||||||
spv->isset= TRUE;
|
spv->isset= TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user