mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merging
This commit is contained in:
@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_acl.h"
|
||||
#include <m_ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <thr_alarm.h>
|
||||
@ -281,6 +280,9 @@ void THD::init(void)
|
||||
variables.date_format);
|
||||
variables.datetime_format= date_time_format_copy((THD*) 0,
|
||||
variables.datetime_format);
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
variables.ndb_use_transactions= 1;
|
||||
#endif
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
server_status= SERVER_STATUS_AUTOCOMMIT;
|
||||
options= thd_startup_options;
|
||||
@ -306,7 +308,7 @@ void THD::init_for_queries()
|
||||
{
|
||||
ha_enable_transaction(this,TRUE);
|
||||
|
||||
reset_root_defaults(&mem_root, variables.query_alloc_block_size,
|
||||
reset_root_defaults(mem_root, variables.query_alloc_block_size,
|
||||
variables.query_prealloc_size);
|
||||
reset_root_defaults(&transaction.mem_root,
|
||||
variables.trans_alloc_block_size,
|
||||
@ -412,7 +414,7 @@ THD::~THD()
|
||||
dbug_sentry = THD_SENTRY_GONE;
|
||||
#endif
|
||||
/* Reset stmt_backup.mem_root to not double-free memory from thd.mem_root */
|
||||
clear_alloc_root(&stmt_backup.mem_root);
|
||||
clear_alloc_root(&stmt_backup.main_mem_root);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -509,13 +511,14 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
|
||||
{
|
||||
DBUG_ENTER("convert_string");
|
||||
size_s new_length= to_cs->mbmaxlen * from_length;
|
||||
uint dummy_errors;
|
||||
if (!(to->str= alloc(new_length+1)))
|
||||
{
|
||||
to->length= 0; // Safety fix
|
||||
DBUG_RETURN(1); // EOM
|
||||
}
|
||||
to->length= copy_and_convert((char*) to->str, new_length, to_cs,
|
||||
from, from_length, from_cs);
|
||||
from, from_length, from_cs, &dummy_errors);
|
||||
to->str[to->length]=0; // Safety
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -538,7 +541,8 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
|
||||
|
||||
bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
|
||||
{
|
||||
if (convert_buffer.copy(s->ptr(), s->length(), from_cs, to_cs))
|
||||
uint dummy_errors;
|
||||
if (convert_buffer.copy(s->ptr(), s->length(), from_cs, to_cs, &dummy_errors))
|
||||
return TRUE;
|
||||
/* If convert_buffer >> s copying is more efficient long term */
|
||||
if (convert_buffer.alloced_length() >= convert_buffer.length() * 2 ||
|
||||
@ -704,6 +708,8 @@ struct Item_change_record: public ilink
|
||||
Item *old_value;
|
||||
/* Placement new was hidden by `new' in ilink (TODO: check): */
|
||||
static void *operator new(size_t size, void *mem) { return mem; }
|
||||
static void operator delete(void *ptr, size_t size) {}
|
||||
static void operator delete(void *ptr, void *mem) { /* never called */ }
|
||||
};
|
||||
|
||||
|
||||
@ -958,7 +964,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
|
||||
return -1;
|
||||
}
|
||||
/* Create the file world readable */
|
||||
if ((file= my_create(path, 0666, O_WRONLY, MYF(MY_WME))) < 0)
|
||||
if ((file= my_create(path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
|
||||
return file;
|
||||
#ifdef HAVE_FCHMOD
|
||||
(void) fchmod(file, 0666); // Because of umask()
|
||||
@ -1237,12 +1243,21 @@ bool select_singlerow_subselect::send_data(List<Item> &items)
|
||||
}
|
||||
|
||||
|
||||
void select_max_min_finder_subselect::cleanup()
|
||||
{
|
||||
DBUG_ENTER("select_max_min_finder_subselect::cleanup");
|
||||
cache= 0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
bool select_max_min_finder_subselect::send_data(List<Item> &items)
|
||||
{
|
||||
DBUG_ENTER("select_max_min_finder_subselect::send_data");
|
||||
Item_singlerow_subselect *it= (Item_singlerow_subselect *)item;
|
||||
Item_maxmin_subselect *it= (Item_maxmin_subselect *)item;
|
||||
List_iterator_fast<Item> li(items);
|
||||
Item *val_item= li++;
|
||||
it->register_value();
|
||||
if (it->assigned())
|
||||
{
|
||||
cache->store(val_item);
|
||||
@ -1393,10 +1408,10 @@ void select_dumpvar::cleanup()
|
||||
for memory root initialization.
|
||||
*/
|
||||
Item_arena::Item_arena(THD* thd)
|
||||
:free_list(0),
|
||||
state(INITIALIZED)
|
||||
:free_list(0), mem_root(&main_mem_root),
|
||||
state(INITIALIZED)
|
||||
{
|
||||
init_sql_alloc(&mem_root,
|
||||
init_sql_alloc(&main_mem_root,
|
||||
thd->variables.query_alloc_block_size,
|
||||
thd->variables.query_prealloc_size);
|
||||
}
|
||||
@ -1419,11 +1434,11 @@ Item_arena::Item_arena(THD* thd)
|
||||
statements.
|
||||
*/
|
||||
Item_arena::Item_arena(bool init_mem_root)
|
||||
:free_list(0),
|
||||
:free_list(0), mem_root(&main_mem_root),
|
||||
state(CONVENTIONAL_EXECUTION)
|
||||
{
|
||||
if (init_mem_root)
|
||||
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
|
||||
init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1517,13 +1532,16 @@ void THD::end_statement()
|
||||
|
||||
void Item_arena::set_n_backup_item_arena(Item_arena *set, Item_arena *backup)
|
||||
{
|
||||
DBUG_ENTER("Item_arena::set_n_backup_item_arena");
|
||||
backup->set_item_arena(this);
|
||||
set_item_arena(set);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup)
|
||||
{
|
||||
DBUG_ENTER("Item_arena::restore_backup_item_arena");
|
||||
set->set_item_arena(this);
|
||||
set_item_arena(backup);
|
||||
#ifdef NOT_NEEDED_NOW
|
||||
@ -1536,18 +1554,19 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup)
|
||||
*/
|
||||
clear_alloc_root(&backup->mem_root);
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
void Item_arena::set_item_arena(Item_arena *set)
|
||||
{
|
||||
mem_root= set->mem_root;
|
||||
mem_root= set->mem_root;
|
||||
free_list= set->free_list;
|
||||
state= set->state;
|
||||
}
|
||||
|
||||
Statement::~Statement()
|
||||
{
|
||||
free_root(&mem_root, MYF(0));
|
||||
free_root(&main_mem_root, MYF(0));
|
||||
}
|
||||
|
||||
C_MODE_START
|
||||
|
Reference in New Issue
Block a user