Fix the coding style in a few new files.

This commit is contained in:
konstantin@mysql.com 2006-02-15 21:08:44 +03:00
parent 94e3b91d4e
commit 99030e3f43
3 changed files with 257 additions and 253 deletions

View File

@ -23,10 +23,10 @@
extern int yyparse(void *thd); extern int yyparse(void *thd);
/* /*
Init all member variables Init all member variables
SYNOPSIS SYNOPSIS
event_timed::init() event_timed::init()
*/ */
void void
@ -50,19 +50,19 @@ event_timed::init()
/* /*
Set a name of the event Set a name of the event
SYNOPSIS SYNOPSIS
event_timed::init_name() event_timed::init_name()
thd THD thd THD
spn the name extracted in the parser spn the name extracted in the parser
*/ */
void void
event_timed::init_name(THD *thd, sp_name *spn) event_timed::init_name(THD *thd, sp_name *spn)
{ {
DBUG_ENTER("event_timed::init_name"); DBUG_ENTER("event_timed::init_name");
uint n; /* Counter for nul trimming */ uint n; /* Counter for nul trimming */
/* During parsing, we must use thd->mem_root */ /* During parsing, we must use thd->mem_root */
MEM_ROOT *root= thd->mem_root; MEM_ROOT *root= thd->mem_root;
@ -94,11 +94,11 @@ event_timed::init_name(THD *thd, sp_name *spn)
/* /*
Set body of the event - what should be executed. Set body of the event - what should be executed.
SYNOPSIS SYNOPSIS
event_timed::init_body() event_timed::init_body()
thd THD thd THD
NOTE NOTE
The body is extracted by copying all data between the The body is extracted by copying all data between the
@ -126,17 +126,17 @@ event_timed::init_body(THD *thd)
/* /*
Set time for execution for one time events. Set time for execution for one time events.
SYNOPSIS SYNOPSIS
event_timed::init_execute_at() event_timed::init_execute_at()
expr when (datetime) expr when (datetime)
RETURNS RETURN VALUE
0 - OK 0 OK
EVEX_PARSE_ERROR - fix_fields failed EVEX_PARSE_ERROR fix_fields failed
EVEX_BAD_PARAMS - datetime is in the past EVEX_BAD_PARAMS datetime is in the past
ER_WRONG_VALUE - wrong value for execute at ER_WRONG_VALUE wrong value for execute at
*/ */
int int
@ -152,9 +152,9 @@ event_timed::init_execute_at(THD *thd, Item *expr)
if (expr->fix_fields(thd, &expr)) if (expr->fix_fields(thd, &expr))
DBUG_RETURN(EVEX_PARSE_ERROR); DBUG_RETURN(EVEX_PARSE_ERROR);
// let's check whether time is in the past /* Let's check whether time is in the past */
thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,
(my_time_t) thd->query_start()); (my_time_t) thd->query_start());
if ((not_used= expr->get_date(&ltime, TIME_NO_ZERO_DATE))) if ((not_used= expr->get_date(&ltime, TIME_NO_ZERO_DATE)))
@ -166,8 +166,8 @@ event_timed::init_execute_at(THD *thd, Item *expr)
/* /*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
CONVERT_TZ has similar problem CONVERT_TZ has similar problem.
*/ */
my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd,&ltime, &not_used)); my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd,&ltime, &not_used));
@ -178,17 +178,17 @@ event_timed::init_execute_at(THD *thd, Item *expr)
/* /*
Set time for execution for transient events. Set time for execution for transient events.
SYNOPSIS SYNOPSIS
event_timed::init_interval() event_timed::init_interval()
expr how much? expr how much?
new_interval what is the interval new_interval what is the interval
RETURNS RETURNS
0 - OK 0 OK
EVEX_PARSE_ERROR - fix_fields failed EVEX_PARSE_ERROR fix_fields failed
EVEX_BAD_PARAMS - Interval is not positive EVEX_BAD_PARAMS Interval is not positive
*/ */
int int
@ -230,7 +230,7 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
case INTERVAL_SECOND: case INTERVAL_SECOND:
expression= interval.second; expression= interval.second;
break; break;
case INTERVAL_YEAR_MONTH: // Allow YEAR-MONTH YYYYYMM case INTERVAL_YEAR_MONTH: // Allow YEAR-MONTH YYYYYMM
expression= interval.year* 12 + interval.month; expression= interval.year* 12 + interval.month;
break; break;
case INTERVAL_DAY_HOUR: case INTERVAL_DAY_HOUR:
@ -272,24 +272,24 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
/* /*
Set activation time. Set activation time.
SYNOPSIS SYNOPSIS
event_timed::init_starts() event_timed::init_starts()
expr how much? expr how much?
interval what is the interval interval what is the interval
NOTES NOTES
Note that activation time is not execution time. Note that activation time is not execution time.
EVERY 5 MINUTE STARTS "2004-12-12 10:00:00" means that EVERY 5 MINUTE STARTS "2004-12-12 10:00:00" means that
the event will be executed every 5 minutes but this will the event will be executed every 5 minutes but this will
start at the date shown above. Expressions are possible : start at the date shown above. Expressions are possible :
DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tommorow at DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tommorow at
same time. same time.
RETURNS RETURNS
0 - OK 0 OK
EVEX_PARSE_ERROR - fix_fields failed EVEX_PARSE_ERROR fix_fields failed
*/ */
int int
@ -306,9 +306,9 @@ event_timed::init_starts(THD *thd, Item *new_starts)
if ((not_used= new_starts->get_date(&ltime, TIME_NO_ZERO_DATE))) if ((not_used= new_starts->get_date(&ltime, TIME_NO_ZERO_DATE)))
DBUG_RETURN(EVEX_BAD_PARAMS); DBUG_RETURN(EVEX_BAD_PARAMS);
// let's check whether time is in the past /* Let's check whether time is in the past */
thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,
(my_time_t) thd->query_start()); (my_time_t) thd->query_start());
DBUG_PRINT("info",("now =%lld", TIME_to_ulonglong_datetime(&time_tmp))); DBUG_PRINT("info",("now =%lld", TIME_to_ulonglong_datetime(&time_tmp)));
DBUG_PRINT("info",("starts=%lld", TIME_to_ulonglong_datetime(&ltime))); DBUG_PRINT("info",("starts=%lld", TIME_to_ulonglong_datetime(&ltime)));
@ -317,8 +317,8 @@ event_timed::init_starts(THD *thd, Item *new_starts)
DBUG_RETURN(EVEX_BAD_PARAMS); DBUG_RETURN(EVEX_BAD_PARAMS);
/* /*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx This may result in a 1970-01-01 date if ltime is > 2037-xx-xx
CONVERT_TZ has similar problem CONVERT_TZ has similar problem
*/ */
my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd, &ltime, &not_used)); my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd, &ltime, &not_used));
@ -328,25 +328,25 @@ event_timed::init_starts(THD *thd, Item *new_starts)
/* /*
Set deactivation time. Set deactivation time.
SYNOPSIS SYNOPSIS
event_timed::init_ends() event_timed::init_ends()
thd THD thd THD
new_ends when? new_ends when?
NOTES NOTES
Note that activation time is not execution time. Note that activation time is not execution time.
EVERY 5 MINUTE ENDS "2004-12-12 10:00:00" means that EVERY 5 MINUTE ENDS "2004-12-12 10:00:00" means that
the event will be executed every 5 minutes but this will the event will be executed every 5 minutes but this will
end at the date shown above. Expressions are possible : end at the date shown above. Expressions are possible :
DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tommorow at DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tommorow at
same time. same time.
RETURNS RETURNS
0 - OK 0 OK
EVEX_PARSE_ERROR - fix_fields failed EVEX_PARSE_ERROR fix_fields failed
EVEX_BAD_PARAMS - ENDS before STARTS EVEX_BAD_PARAMS ENDS before STARTS
*/ */
int int
@ -361,13 +361,13 @@ event_timed::init_ends(THD *thd, Item *new_ends)
if (new_ends->fix_fields(thd, &new_ends)) if (new_ends->fix_fields(thd, &new_ends))
DBUG_RETURN(EVEX_PARSE_ERROR); DBUG_RETURN(EVEX_PARSE_ERROR);
// the field was already fixed in init_ends /* The field was already fixed in init_ends */
if ((not_used= new_ends->get_date(&ltime, TIME_NO_ZERO_DATE))) if ((not_used= new_ends->get_date(&ltime, TIME_NO_ZERO_DATE)))
DBUG_RETURN(EVEX_BAD_PARAMS); DBUG_RETURN(EVEX_BAD_PARAMS);
/* /*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
CONVERT_TZ has similar problem CONVERT_TZ has similar problem.
*/ */
my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd, &ltime, &not_used)); my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd, &ltime, &not_used));
@ -380,12 +380,12 @@ event_timed::init_ends(THD *thd, Item *new_ends)
/* /*
Sets comment. Sets comment.
SYNOPSIS SYNOPSIS
event_timed::init_comment() event_timed::init_comment()
thd THD - used for memory allocation thd THD - used for memory allocation
comment the string. comment the string.
*/ */
void void
@ -401,11 +401,10 @@ event_timed::init_comment(THD *thd, LEX_STRING *set_comment)
/* /*
Inits definer (definer_user and definer_host) during Inits definer (definer_user and definer_host) during parsing.
parsing.
SYNOPSIS SYNOPSIS
event_timed::init_definer() event_timed::init_definer()
*/ */
int int
@ -434,15 +433,15 @@ event_timed::init_definer(THD *thd)
/* /*
Loads an event from a row from mysql.event Loads an event from a row from mysql.event
SYNOPSIS SYNOPSIS
event_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table) event_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table)
REMARKS NOTES
This method is silent on errors and should behave like that. Callers This method is silent on errors and should behave like that. Callers
should handle throwing of error messages. The reason is that the class should handle throwing of error messages. The reason is that the class
should not know about how to deal with communication. should not know about how to deal with communication.
*/ */
int int
@ -511,7 +510,7 @@ event_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table)
/* /*
If res1 and res2 are true then both fields are empty. If res1 and res2 are true then both fields are empty.
Hence if EVEX_FIELD_EXECUTE_AT is empty there is an error. Hence if EVEX_FIELD_EXECUTE_AT is empty there is an error.
*/ */
if (res1 && res2 && !et->expression && table->field[EVEX_FIELD_EXECUTE_AT]-> if (res1 && res2 && !et->expression && table->field[EVEX_FIELD_EXECUTE_AT]->
get_date(&et->execute_at, TIME_NO_ZERO_DATE)) get_date(&et->execute_at, TIME_NO_ZERO_DATE))
@ -579,15 +578,14 @@ error:
/* /*
Computes the sum of a timestamp plus interval Computes the sum of a timestamp plus interval
SYNOPSIS SYNOPSIS
get_next_time(TIME *start, int interval_value, interval_type interval) get_next_time(TIME *start, int interval_value, interval_type interval)
next the sum
next - the sum start add interval_value to this time
start - add interval_value to this time i_value quantity of time type interval to add
i_value - quantity of time type interval to add i_type type of interval to add (SECOND, MINUTE, HOUR, WEEK ...)
i_type - type of interval to add (SECOND, MINUTE, HOUR, WEEK ...)
*/ */
static static
@ -648,14 +646,14 @@ bool get_next_time(TIME *next, TIME *start, int i_value, interval_type i_type)
/* /*
Computes next execution time. Computes next execution time.
SYNOPSIS SYNOPSIS
event_timed::compute_next_execution_time() event_timed::compute_next_execution_time()
REMARKS: NOTES
The time is set in execute_at, if no more executions the latter is set to The time is set in execute_at, if no more executions the latter is set to
0000-00-00. 0000-00-00.
*/ */
bool bool
@ -673,10 +671,10 @@ event_timed::compute_next_execution_time()
("Event %s is DISABLED", name.str)); ("Event %s is DISABLED", name.str));
goto ret; goto ret;
} }
//if one-time no need to do computation /* If one-time, no need to do computation */
if (!expression) if (!expression)
{ {
//let's check whether it was executed /* Let's check whether it was executed */
if (last_executed.year) if (last_executed.year)
{ {
DBUG_PRINT("compute_next_execution_time", DBUG_PRINT("compute_next_execution_time",
@ -712,10 +710,10 @@ event_timed::compute_next_execution_time()
last_executed.second); last_executed.second);
#endif #endif
//if time_now is after ends don't execute anymore /* If time_now is after ends don't execute anymore */
if (ends.year && (tmp= my_time_compare(&ends, &time_now)) == -1) if (ends.year && (tmp= my_time_compare(&ends, &time_now)) == -1)
{ {
// time_now is after ends. don't execute anymore /* time_now is after ends. don't execute anymore */
set_zero_time(&execute_at, MYSQL_TIMESTAMP_DATETIME); set_zero_time(&execute_at, MYSQL_TIMESTAMP_DATETIME);
if (on_completion == MYSQL_EVENT_ON_COMPLETION_DROP) if (on_completion == MYSQL_EVENT_ON_COMPLETION_DROP)
dropped= true; dropped= true;
@ -726,15 +724,15 @@ event_timed::compute_next_execution_time()
} }
/* /*
Here time_now is before or equals ends if the latter is set. Here time_now is before or equals ends if the latter is set.
Let's check whether time_now is before starts. Let's check whether time_now is before starts.
If so schedule for starts If so schedule for starts.
*/ */
if (starts.year && (tmp= my_time_compare(&time_now, &starts)) < 1) if (starts.year && (tmp= my_time_compare(&time_now, &starts)) < 1)
{ {
if (tmp == 0 && my_time_compare(&starts, &last_executed) == 0) if (tmp == 0 && my_time_compare(&starts, &last_executed) == 0)
{ {
/* /*
time_now = starts = last_executed time_now = starts = last_executed
do nothing or we will schedule for second time execution at starts. do nothing or we will schedule for second time execution at starts.
*/ */
@ -767,10 +765,10 @@ event_timed::compute_next_execution_time()
if (get_next_time(&next_exec, &last_executed, expression, interval)) if (get_next_time(&next_exec, &last_executed, expression, interval))
goto err; goto err;
// There was previous execution /* There was previous execution */
if (my_time_compare(&ends, &next_exec) == -1) if (my_time_compare(&ends, &next_exec) == -1)
{ {
// Next execution after ends. No more executions /* Next execution after ends. No more executions */
set_zero_time(&execute_at, MYSQL_TIMESTAMP_DATETIME); set_zero_time(&execute_at, MYSQL_TIMESTAMP_DATETIME);
if (on_completion == MYSQL_EVENT_ON_COMPLETION_DROP) if (on_completion == MYSQL_EVENT_ON_COMPLETION_DROP)
dropped= true; dropped= true;
@ -782,20 +780,24 @@ event_timed::compute_next_execution_time()
} }
else if (!starts.year && !ends.year) else if (!starts.year && !ends.year)
{ {
// both starts and m_ends are not set, se we schedule for the next /*
// based on last_executed Both starts and m_ends are not set, so we schedule for the next
based on last_executed.
*/
if (last_executed.year) if (last_executed.year)
{ {
if (get_next_time(&execute_at, &last_executed, expression, interval)) if (get_next_time(&execute_at, &last_executed, expression, interval))
goto err; goto err;
} }
else else
//last_executed not set. Schedule the event for now {
/* last_executed not set. Schedule the event for now */
execute_at= time_now; execute_at= time_now;
}
} }
else else
{ {
//either starts or m_ends is set /* Either starts or m_ends is set */
if (starts.year) if (starts.year)
{ {
/* /*
@ -854,9 +856,9 @@ err:
Set the internal last_executed TIME struct to now. NOW is the Set the internal last_executed TIME struct to now. NOW is the
time according to thd->query_start(), so the THD's clock. time according to thd->query_start(), so the THD's clock.
Synopsis SYNOPSIS
event_timed::drop() event_timed::drop()
thd - thread context thd thread context
*/ */
void void
@ -878,16 +880,16 @@ event_timed::mark_last_executed(THD *thd)
/* /*
Drops the event Drops the event
Synopsis SYNOPSIS
event_timed::drop() event_timed::drop()
thd - thread context thd thread context
RETURNS : RETURN VALUE
0 - OK 0 OK
-1 - Cannot open mysql.event -1 Cannot open mysql.event
-2 - Cannot find the event in mysql.event (already deleted?) -2 Cannot find the event in mysql.event (already deleted?)
others - return code from SE in case deletion of the event row others return code from SE in case deletion of the event row
failed. failed.
*/ */
@ -905,17 +907,17 @@ event_timed::drop(THD *thd)
/* /*
Saves status and last_executed_at to the disk if changed. Saves status and last_executed_at to the disk if changed.
Synopsis SYNOPSIS
event_timed::drop() event_timed::drop()
thd - thread context thd - thread context
Returns : RETURN VALUE
0 - OK 0 OK
SP_OPEN_TABLE_FAILED - Error while opening mysql.event for writing SP_OPEN_TABLE_FAILED Error while opening mysql.event for writing
EVEX_WRITE_ROW_FAILED - On error to write to disk EVEX_WRITE_ROW_FAILED On error to write to disk
others - return code from SE in case deletion of the event row others return code from SE in case deletion of the event
failed. row failed.
*/ */
bool bool
@ -930,7 +932,7 @@ event_timed::update_fields(THD *thd)
DBUG_PRINT("enter", ("name: %*s", name.length, name.str)); DBUG_PRINT("enter", ("name: %*s", name.length, name.str));
//no need to update if nothing has changed /* No need to update if nothing has changed */
if (!(status_changed || last_executed_changed)) if (!(status_changed || last_executed_changed))
goto done; goto done;
@ -947,7 +949,7 @@ event_timed::update_fields(THD *thd)
goto done; goto done;
store_record(table,record[1]); store_record(table,record[1]);
// Don't update create on row update. /* Don't update create on row update. */
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET; table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
if (last_executed_changed) if (last_executed_changed)
@ -978,13 +980,15 @@ done:
/* /*
Get SHOW CREATE EVENT as string Get SHOW CREATE EVENT as string
thd - Thread SYNOPSIS
buf - String*, should be already allocated. CREATE EVENT goes inside. event_timed::get_create_event(THD *thd, String *buf)
thd Thread
buf String*, should be already allocated. CREATE EVENT goes inside.
Returns: RETURN VALUE
0 - OK 0 OK
1 - Error (for now if mysql.event has been tampered and MICROSECONDS 1 Error (for now if mysql.event has been tampered and MICROSECONDS
interval or derivative has been put there. interval or derivative has been put there.
*/ */
int int
@ -1018,8 +1022,8 @@ event_timed::get_create_event(THD *thd, String *buf)
char dtime_buff[20*2+32];// +32 to make my_snprintf_{8bit|ucs2} happy char dtime_buff[20*2+32];// +32 to make my_snprintf_{8bit|ucs2} happy
buf->append(STRING_WITH_LEN("AT '")); buf->append(STRING_WITH_LEN("AT '"));
/* /*
pass the buffer and the second param tells fills the buffer and returns Pass the buffer and the second param tells fills the buffer and
the number of chars to copy returns the number of chars to copy.
*/ */
buf->append(dtime_buff, my_datetime_to_str(&execute_at, dtime_buff)); buf->append(dtime_buff, my_datetime_to_str(&execute_at, dtime_buff));
buf->append(STRING_WITH_LEN("'")); buf->append(STRING_WITH_LEN("'"));
@ -1048,18 +1052,17 @@ event_timed::get_create_event(THD *thd, String *buf)
/* /*
Executes the event (the underlying sp_head object); Executes the event (the underlying sp_head object);
SYNOPSIS SYNOPSIS
evex_fill_row() evex_fill_row()
thd THD thd THD
mem_root If != NULL use it to compile the event on it mem_root If != NULL use it to compile the event on it
Returns
0 - success
-100 - event in execution (parallel execution is impossible)
others - retcodes of sp_head::execute_procedure()
RETURNS
0 success
-100 event in execution (parallel execution is impossible)
others retcodes of sp_head::execute_procedure()
*/ */
int int
@ -1107,16 +1110,15 @@ done:
Compiles an event before it's execution. Compiles the anonymous Compiles an event before it's execution. Compiles the anonymous
sp_head object held by the event sp_head object held by the event
Synopsis SYNOPSIS
event_timed::compile() event_timed::compile()
thd - thread context, used for memory allocation mostly thd thread context, used for memory allocation mostly
mem_root - if != NULL then this memory root is used for allocs mem_root if != NULL then this memory root is used for allocs
instead of thd->mem_root instead of thd->mem_root
Returns RETURN VALUE
0 - Success 0 success
EVEX_COMPILE_ERROR - Error during compilation EVEX_COMPILE_ERROR error during compilation
*/ */
int int
@ -1150,7 +1152,7 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
thd->update_charset(); thd->update_charset();
DBUG_ENTER("event_timed::compile"); DBUG_ENTER("event_timed::compile");
// change the memory root for the execution time /* Change the memory root for the execution time */
if (mem_root) if (mem_root)
{ {
tmp_mem_root= thd->mem_root; tmp_mem_root= thd->mem_root;
@ -1174,8 +1176,10 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
{ {
DBUG_PRINT("error", ("error during compile or thd->is_fatal_error=%d", DBUG_PRINT("error", ("error during compile or thd->is_fatal_error=%d",
thd->is_fatal_error)); thd->is_fatal_error));
// Free lex associated resources /*
// QQ: Do we really need all this stuff here ? Free lex associated resources
QQ: Do we really need all this stuff here?
*/
sql_print_error("error during compile of %s.%s or thd->is_fatal_error=%d", sql_print_error("error during compile of %s.%s or thd->is_fatal_error=%d",
dbname.str, name.str, thd->is_fatal_error); dbname.str, name.str, thd->is_fatal_error);
if (lex.sphead) if (lex.sphead)
@ -1192,8 +1196,10 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
sphead= lex.et->sphead; sphead= lex.et->sphead;
sphead->m_db= dbname; sphead->m_db= dbname;
//copy also chistics since they will vanish otherwise we get 0x0 pointer /*
// Todo : Handle sql_mode !! Ccopy also chistics since they will vanish otherwise we get 0x0 pointer
TODO: Handle sql_mode!!
*/
sphead->set_definer(definer.str, definer.length); sphead->set_definer(definer.str, definer.length);
sphead->set_info(0, 0, &lex.sp_chistics, 0/*sql_mode*/); sphead->set_info(0, 0, &lex.sp_chistics, 0/*sql_mode*/);
sphead->optimize(); sphead->optimize();
@ -1214,9 +1220,7 @@ done:
thd->variables.collation_connection= old_collation_connection; thd->variables.collation_connection= old_collation_connection;
thd->update_charset(); thd->update_charset();
/* /* Change the memory root for the execution time. */
Change the memory root for the execution time.
*/
if (mem_root) if (mem_root)
thd->mem_root= tmp_mem_root; thd->mem_root= tmp_mem_root;