mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge of mysql-trunk-bugfixing into mysql-trunk-merge.
This commit is contained in:
135
sql/sql_class.h
135
sql/sql_class.h
@ -1570,6 +1570,125 @@ public:
|
||||
return current_stmt_binlog_format == BINLOG_FORMAT_ROW;
|
||||
}
|
||||
|
||||
enum enum_stmt_accessed_table
|
||||
{
|
||||
/*
|
||||
If a transactional table is about to be read. Note that
|
||||
a write implies a read.
|
||||
*/
|
||||
STMT_READS_TRANS_TABLE= 0,
|
||||
/*
|
||||
If a transactional table is about to be updated.
|
||||
*/
|
||||
STMT_WRITES_TRANS_TABLE,
|
||||
/*
|
||||
If a non-transactional table is about to be read. Note that
|
||||
a write implies a read.
|
||||
*/
|
||||
STMT_READS_NON_TRANS_TABLE,
|
||||
/*
|
||||
If a non-transactional table is about to be updated.
|
||||
*/
|
||||
STMT_WRITES_NON_TRANS_TABLE,
|
||||
/*
|
||||
If a temporary transactional table is about to be read. Note
|
||||
that a write implies a read.
|
||||
*/
|
||||
STMT_READS_TEMP_TRANS_TABLE,
|
||||
/*
|
||||
If a temporary transactional table is about to be updated.
|
||||
*/
|
||||
STMT_WRITES_TEMP_TRANS_TABLE,
|
||||
/*
|
||||
If a temporary non-transactional table is about to be read. Note
|
||||
that a write implies a read.
|
||||
*/
|
||||
STMT_READS_TEMP_NON_TRANS_TABLE,
|
||||
/*
|
||||
If a temporary non-transactional table is about to be updated.
|
||||
*/
|
||||
STMT_WRITES_TEMP_NON_TRANS_TABLE,
|
||||
/*
|
||||
The last element of the enumeration. Please, if necessary add
|
||||
anything before this.
|
||||
*/
|
||||
STMT_ACCESS_TABLE_COUNT
|
||||
};
|
||||
|
||||
/**
|
||||
Sets the type of table that is about to be accessed while executing a
|
||||
statement.
|
||||
|
||||
@param accessed_table Enumeration type that defines the type of table,
|
||||
e.g. temporary, transactional, non-transactional.
|
||||
*/
|
||||
inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table)
|
||||
{
|
||||
DBUG_ENTER("THD::set_stmt_accessed_table");
|
||||
|
||||
DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
|
||||
stmt_accessed_table_flag |= (1U << accessed_table);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
Checks if a type of table is about to be accessed while executing a
|
||||
statement.
|
||||
|
||||
@param accessed_table Enumeration type that defines the type of table,
|
||||
e.g. temporary, transactional, non-transactional.
|
||||
|
||||
@return
|
||||
@retval TRUE if the type of the table is about to be accessed
|
||||
@retval FALSE otherwise
|
||||
*/
|
||||
inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table)
|
||||
{
|
||||
DBUG_ENTER("THD::stmt_accessed_table");
|
||||
|
||||
DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
|
||||
|
||||
DBUG_RETURN((stmt_accessed_table_flag & (1U << accessed_table)) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
Checks if a temporary table is about to be accessed while executing a
|
||||
statement.
|
||||
|
||||
@return
|
||||
@retval TRUE if a temporary table is about to be accessed
|
||||
@retval FALSE otherwise
|
||||
*/
|
||||
inline bool stmt_accessed_temp_table()
|
||||
{
|
||||
DBUG_ENTER("THD::stmt_accessed_temp_table");
|
||||
|
||||
DBUG_RETURN((stmt_accessed_table_flag &
|
||||
((1U << STMT_READS_TEMP_TRANS_TABLE) |
|
||||
(1U << STMT_WRITES_TEMP_TRANS_TABLE) |
|
||||
(1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
|
||||
(1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
Checks if a temporary non-transactional table is about to be accessed
|
||||
while executing a statement.
|
||||
|
||||
@return
|
||||
@retval TRUE if a temporary non-transactional table is about to be
|
||||
accessed
|
||||
@retval FALSE otherwise
|
||||
*/
|
||||
inline bool stmt_accessed_non_trans_temp_table()
|
||||
{
|
||||
DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
|
||||
|
||||
DBUG_RETURN((stmt_accessed_table_flag &
|
||||
((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
|
||||
(1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
Indicates the format in which the current statement will be
|
||||
@ -1607,6 +1726,12 @@ private:
|
||||
*/
|
||||
uint32 binlog_unsafe_warning_flags;
|
||||
|
||||
/**
|
||||
Bit field that determines the type of tables that are about to be
|
||||
be accessed while executing a statement.
|
||||
*/
|
||||
uint32 stmt_accessed_table_flag;
|
||||
|
||||
void issue_unsafe_warnings();
|
||||
|
||||
/*
|
||||
@ -2025,7 +2150,6 @@ public:
|
||||
is set if a statement accesses a temporary table created through
|
||||
CREATE TEMPORARY TABLE.
|
||||
*/
|
||||
bool thread_temporary_used;
|
||||
bool charset_is_system_charset, charset_is_collation_connection;
|
||||
bool charset_is_character_set_filesystem;
|
||||
bool enable_slow_log; /* enable slow log for current statement */
|
||||
@ -2339,7 +2463,12 @@ public:
|
||||
/** Return FALSE if connection to client is broken. */
|
||||
bool is_connected()
|
||||
{
|
||||
return vio_ok() ? vio_is_connected(net.vio) : FALSE;
|
||||
/*
|
||||
All system threads (e.g., the slave IO thread) are connected but
|
||||
not using vio. So this function always returns true for all
|
||||
system threads.
|
||||
*/
|
||||
return system_thread || (vio_ok() ? vio_is_connected(net.vio) : FALSE);
|
||||
}
|
||||
#else
|
||||
inline bool vio_ok() const { return TRUE; }
|
||||
@ -2537,7 +2666,7 @@ public:
|
||||
memcpy(db, new_db, new_db_len+1);
|
||||
else
|
||||
{
|
||||
x_free(db);
|
||||
my_free(db);
|
||||
if (new_db)
|
||||
db= my_strndup(new_db, new_db_len, MYF(MY_WME | ME_FATALERROR));
|
||||
else
|
||||
|
Reference in New Issue
Block a user