1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Manual merge from mysql-trunk-bugfixing.

Conflicts:
  - BUILD/SETUP.sh
  - mysql-test/mysql-test-run.pl
  - mysql-test/r/partition_error.result
  - mysql-test/t/disabled.def
  - mysql-test/t/partition_error.test
  - sql/share/errmsg-utf8.txt
This commit is contained in:
Alexander Nozdrin
2010-06-07 12:47:04 +04:00
571 changed files with 28513 additions and 24883 deletions

View File

@ -428,6 +428,7 @@ typedef struct system_variables
uint binlog_format; ///< binlog format for this thd (see enum_binlog_format)
my_bool binlog_direct_non_trans_update;
my_bool sql_log_bin;
uint completion_type;
uint query_cache_type;
uint tx_isolation;
@ -1672,8 +1673,6 @@ public:
/* <> 0 if we are inside of trigger or stored function. */
uint in_sub_stmt;
/* TRUE when the current top has SQL_LOG_BIN ON */
bool sql_log_bin_toplevel;
/* container for handler's private per-connection data */
Ha_data ha_data[MAX_HA];
@ -2119,8 +2118,6 @@ public:
char scramble[SCRAMBLE_LENGTH+1];
bool slave_thread, one_shot_set;
bool locked, some_tables_deleted;
bool last_cuted_field;
bool no_errors, password;
/**
Set to TRUE if execution of the current compound statement
@ -2369,10 +2366,6 @@ public:
{
return limit_found_rows;
}
inline bool active_transaction()
{
return server_status & SERVER_STATUS_IN_TRANS;
}
/**
Returns TRUE if session is in a multi-statement transaction mode.
@ -2383,11 +2376,60 @@ public:
OPTION_BEGIN: Regardless of the autocommit status, a multi-statement
transaction can be explicitly started with the statements "START
TRANSACTION", "BEGIN [WORK]", "[COMMIT | ROLLBACK] AND CHAIN", etc.
Note: this doesn't tell you whether a transaction is active.
A session can be in multi-statement transaction mode, and yet
have no active transaction, e.g., in case of:
set @@autocommit=0;
set @a= 3; <-- these statements don't
set transaction isolation level serializable; <-- start an active
flush tables; <-- transaction
I.e. for the above scenario this function returns TRUE, even
though no active transaction has begun.
@sa in_active_multi_stmt_transaction()
*/
inline bool in_multi_stmt_transaction()
inline bool in_multi_stmt_transaction_mode()
{
return variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN);
}
/**
TRUE if the session is in a multi-statement transaction mode
(@sa in_multi_stmt_transaction_mode()) *and* there is an
active transaction, i.e. there is an explicit start of a
transaction with BEGIN statement, or implicit with a
statement that uses a transactional engine.
For example, these scenarios don't start an active transaction
(even though the server is in multi-statement transaction mode):
set @@autocommit=0;
select * from nontrans_table;
set @var=TRUE;
flush tables;
Note, that even for a statement that starts a multi-statement
transaction (i.e. select * from trans_table), this
flag won't be set until we open the statement's tables
and the engines register themselves for the transaction
(see trans_register_ha()),
hence this method is reliable to use only after
open_tables() has completed.
Why do we need a flag?
----------------------
We need to maintain a (at first glance redundant)
session flag, rather than looking at thd->transaction.all.ha_list
because of explicit start of a transaction with BEGIN.
I.e. in case of
BEGIN;
select * from nontrans_t1; <-- in_active_multi_stmt_transaction() is true
*/
inline bool in_active_multi_stmt_transaction()
{
return server_status & SERVER_STATUS_IN_TRANS;
}
inline bool fill_derived_tables()
{
return !stmt_arena->is_stmt_prepare() && !lex->only_view_structure();
@ -3582,6 +3624,12 @@ public:
*/
#define CF_PROTECT_AGAINST_GRL (1U << 10)
/**
Identifies statements that may generate row events
and that may end up in the binary log.
*/
#define CF_CAN_GENERATE_ROW_EVENTS (1U << 11)
/* Bits in server_command_flags */
/**
@ -3642,7 +3690,7 @@ inline bool add_group_to_list(THD *thd, Item *item, bool asc)
three calling-info parameters.
*/
extern "C"
const char *set_thd_proc_info(THD *thd, const char *info,
const char *set_thd_proc_info(void *thd_arg, const char *info,
const char *calling_func,
const char *calling_file,
const unsigned int calling_line);