mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
after-review fixes
This commit is contained in:
@ -86,8 +86,7 @@ extern "C" void free_user_var(user_var_entry *entry)
|
|||||||
** Thread specific functions
|
** Thread specific functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
THD::THD():user_time(0),
|
THD::THD():user_time(0), is_fatal_error(0),
|
||||||
is_fatal_error(0),
|
|
||||||
last_insert_id_used(0),
|
last_insert_id_used(0),
|
||||||
insert_id_used(0), rand_used(0), in_lock_tables(0),
|
insert_id_used(0), rand_used(0), in_lock_tables(0),
|
||||||
global_read_lock(0), bootstrap(0), spcont(NULL)
|
global_read_lock(0), bootstrap(0), spcont(NULL)
|
||||||
@ -108,6 +107,7 @@ THD::THD():user_time(0),
|
|||||||
cuted_fields= sent_row_count= 0L;
|
cuted_fields= sent_row_count= 0L;
|
||||||
statement_id_counter= 0UL;
|
statement_id_counter= 0UL;
|
||||||
// Must be reset to handle error with THD's created for init of mysqld
|
// Must be reset to handle error with THD's created for init of mysqld
|
||||||
|
lex->current_select= 0;
|
||||||
start_time=(time_t) 0;
|
start_time=(time_t) 0;
|
||||||
current_linfo = 0;
|
current_linfo = 0;
|
||||||
slave_thread = 0;
|
slave_thread = 0;
|
||||||
@ -339,12 +339,12 @@ THD::~THD()
|
|||||||
safeFree(user);
|
safeFree(user);
|
||||||
safeFree(db);
|
safeFree(db);
|
||||||
safeFree(ip);
|
safeFree(ip);
|
||||||
free_root(&warn_root,MYF(0));
|
free_root(&warn_root, MYF(0));
|
||||||
free_root(&transaction.mem_root,MYF(0));
|
free_root(&transaction.mem_root, MYF(0));
|
||||||
mysys_var=0; // Safety (shouldn't be needed)
|
mysys_var= 0; // Safety (shouldn't be needed)
|
||||||
pthread_mutex_destroy(&LOCK_delete);
|
pthread_mutex_destroy(&LOCK_delete);
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
dbug_sentry = THD_SENTRY_GONE;
|
dbug_sentry= THD_SENTRY_GONE;
|
||||||
#endif
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -1277,23 +1277,17 @@ Statement::Statement(THD *thd)
|
|||||||
query_id(0), /* initialized later */
|
query_id(0), /* initialized later */
|
||||||
set_query_id(1),
|
set_query_id(1),
|
||||||
allow_sum_func(0), /* initialized later */
|
allow_sum_func(0), /* initialized later */
|
||||||
command(COM_SLEEP), /* reset in THD counstructor and mysql_parse */
|
command(COM_SLEEP), /* initialized later */
|
||||||
lex(&main_lex),
|
lex(&main_lex),
|
||||||
query(0),
|
query(0), /* these two are set */
|
||||||
query_length(0),
|
query_length(0), /* in alloc_query() */
|
||||||
free_list(0) /* reset in THD constructor */
|
free_list(0)
|
||||||
{
|
{
|
||||||
init_sql_alloc(&mem_root,
|
init_sql_alloc(&mem_root,
|
||||||
thd->variables.query_alloc_block_size,
|
thd->variables.query_alloc_block_size,
|
||||||
thd->variables.query_prealloc_size);
|
thd->variables.query_prealloc_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
This constructor is called when statement is a subobject of THD:
|
|
||||||
Some variables are initialized in THD::init due to locking problems
|
|
||||||
This statement object will be used to hold state of currently active
|
|
||||||
statement.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Statement::Statement()
|
Statement::Statement()
|
||||||
:id(0),
|
:id(0),
|
||||||
@ -1329,9 +1323,11 @@ get_statement_id_as_hash_key(const byte *record, uint *key_length,
|
|||||||
|
|
||||||
C_MODE_END
|
C_MODE_END
|
||||||
|
|
||||||
|
|
||||||
Statement_map::Statement_map()
|
Statement_map::Statement_map()
|
||||||
{
|
{
|
||||||
enum { START_HASH_SIZE = 16 };
|
enum { START_HASH_SIZE = 16 };
|
||||||
hash_init(&st_hash, default_charset_info, START_HASH_SIZE, 0, 0,
|
hash_init(&st_hash, default_charset_info, START_HASH_SIZE, 0, 0,
|
||||||
get_statement_id_as_hash_key, (hash_free_key) 0, MYF(0));
|
get_statement_id_as_hash_key, (hash_free_key) 0, MYF(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,22 +454,22 @@ public:
|
|||||||
LEX main_lex;
|
LEX main_lex;
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
Uniquely identifies each statement object in scope of thread.
|
Uniquely identifies each statement object in thread scope; change during
|
||||||
Can't be const at the moment because of substitute() method
|
statement lifetime.
|
||||||
*/
|
*/
|
||||||
/* const */ ulong id;
|
ulong id;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Id of current query. Statement can be reused to execute several queries
|
Id of current query. Statement can be reused to execute several queries.
|
||||||
query_id is global in context of the whole MySQL server.
|
query_id is global in context of the whole MySQL server.
|
||||||
ID is automatically generated from mutex-protected counter.
|
Id is automatically generated from mutex-protected counter.
|
||||||
It's used in handler code for various purposes: to check which columns
|
It's used in handler code for various purposes: to check which columns
|
||||||
from table are necessary for this select, to check if it's necessary to
|
from table are necessary for this select, to check if it's necessary to
|
||||||
update auto-updatable fields (like auto_increment and timestamp).
|
update auto-updatable fields (like auto_increment and timestamp).
|
||||||
*/
|
*/
|
||||||
ulong query_id;
|
ulong query_id;
|
||||||
/*
|
/*
|
||||||
- if set_query_id=1, we set field->query_id for all fields. In that case
|
- if set_query_id == 1, we set field->query_id for all fields. In that case
|
||||||
field list can not contain duplicates.
|
field list can not contain duplicates.
|
||||||
*/
|
*/
|
||||||
bool set_query_id;
|
bool set_query_id;
|
||||||
@ -487,8 +487,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool allow_sum_func;
|
bool allow_sum_func;
|
||||||
/*
|
/*
|
||||||
Type of current query: COM_PREPARE, COM_QUERY, etc. Set from
|
Type of current query: COM_PREPARE, COM_QUERY, etc. Set from the
|
||||||
first byte of the packet in do_command()
|
first byte of the incoming packet in do_command()
|
||||||
*/
|
*/
|
||||||
enum enum_server_command command;
|
enum enum_server_command command;
|
||||||
|
|
||||||
@ -508,6 +508,10 @@ public:
|
|||||||
MEM_ROOT mem_root;
|
MEM_ROOT mem_root;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/*
|
||||||
|
This constructor is called when statement is a subobject of THD:
|
||||||
|
some variables are initialized in THD::init due to locking problems
|
||||||
|
*/
|
||||||
Statement();
|
Statement();
|
||||||
public:
|
public:
|
||||||
Statement(THD *thd);
|
Statement(THD *thd);
|
||||||
@ -529,7 +533,7 @@ public:
|
|||||||
{
|
{
|
||||||
return my_hash_insert(&st_hash, (byte *) statement);
|
return my_hash_insert(&st_hash, (byte *) statement);
|
||||||
}
|
}
|
||||||
Statement *seek(ulonglong id)
|
Statement *seek(ulong id)
|
||||||
{
|
{
|
||||||
return (Statement *) hash_search(&st_hash, (byte *) &id, sizeof(id));
|
return (Statement *) hash_search(&st_hash, (byte *) &id, sizeof(id));
|
||||||
}
|
}
|
||||||
@ -685,6 +689,12 @@ public:
|
|||||||
USER_CONN *user_connect;
|
USER_CONN *user_connect;
|
||||||
CHARSET_INFO *db_charset;
|
CHARSET_INFO *db_charset;
|
||||||
List<TABLE> temporary_tables_should_be_free; // list of temporary tables
|
List<TABLE> temporary_tables_should_be_free; // list of temporary tables
|
||||||
|
/*
|
||||||
|
FIXME: this, and some other variables like 'count_cuted_fields'
|
||||||
|
maybe should be statement/cursor local, that is, moved to Statement
|
||||||
|
class. With current implementation warnings produced in each prepared
|
||||||
|
statement/ cursor settle here.
|
||||||
|
*/
|
||||||
List <MYSQL_ERROR> warn_list;
|
List <MYSQL_ERROR> warn_list;
|
||||||
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
||||||
uint total_warn_count;
|
uint total_warn_count;
|
||||||
|
Reference in New Issue
Block a user