Below is the list of changes that have just been committed into a local
6.0 repository of davi. When davi does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-04-08 12:37:13-03:00, davi@stripped +1 -0
Formatting cleanup: removing tabs and trailing spaces
to conform to MySQL Internals Coding Guidelines.
sql/sp_head.cc@stripped, 2008-04-08 12:37:10-03:00, davi@stripped +77 -79
Formatting cleanup: removing tabs and trailing spaces
diff -Nrup a/sql/sp_head.cc b/sql/sp_head.cc
--- a/sql/sp_head.cc 2008-03-28 14:47:47 -03:00
+++ b/sql/sp_head.cc 2008-04-08 12:37:10 -03:00
@@ -109,10 +109,10 @@ sp_get_item_value(THD *thd, Item *item,
case STRING_RESULT:
{
String *result= item->val_str(str);
-
+
if (!result)
return NULL;
-
+
{
char buf_holder[STRING_BUFFER_USUAL_SIZE];
String buf(buf_holder, sizeof(buf_holder), result->charset());
@@ -346,7 +346,7 @@ sp_eval_expr(THD *thd, Field *result_fie
Save original values and restore them after save.
*/
-
+
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
bool save_abort_on_warning= thd->abort_on_warning;
bool save_stmt_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
@@ -443,7 +443,7 @@ check_routine_name(LEX_STRING *ident)
{
if (!ident || !ident->str || !ident->str[0] ||
ident->str[ident->length-1] == ' ')
- {
+ {
my_error(ER_SP_WRONG_NAME, MYF(0), ident->str);
return TRUE;
}
@@ -475,7 +475,7 @@ sp_head::operator new(size_t size) throw
DBUG_RETURN(sp);
}
-void
+void
sp_head::operator delete(void *ptr, size_t size) throw()
{
DBUG_ENTER("sp_head::operator delete");
@@ -689,7 +689,7 @@ create_typelib(MEM_ROOT *mem_root, Creat
String *tmp= it++;
if (String::needs_conversion(tmp->length(), tmp->charset(),
- cs, &dummy))
+ cs, &dummy))
{
uint cnv_errs;
conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs);
@@ -721,7 +721,7 @@ sp_head::create(THD *thd)
{
DBUG_ENTER("sp_head::create");
DBUG_PRINT("info", ("type: %d name: %s params: %s body: %s",
- m_type, m_name.str, m_params.str, m_body.str));
+ m_type, m_name.str, m_params.str, m_body.str));
DBUG_RETURN(sp_create_routine(thd, m_type, this));
}
@@ -804,7 +804,7 @@ sp_head::create_result_field(uint field_
if (field)
field->init(table);
-
+
DBUG_RETURN(field);
}
@@ -833,7 +833,7 @@ int cmp_splocal_locations(Item_splocal *
Statements that have is_update_query(stmt) == FALSE (e.g. SELECTs) are not
written into binary log. Instead we catch function calls the statement
makes and write it into binary log separately (see #3).
-
+
2. PROCEDURE calls
CALL statements are not written into binary log. Instead
@@ -846,8 +846,8 @@ int cmp_splocal_locations(Item_splocal *
This substitution is done in subst_spvars().
3. FUNCTION calls
-
- In sp_head::execute_function(), we check
+
+ In sp_head::execute_function(), we check
* If this function invocation is done from a statement that is written
into the binary log.
* If there were any attempts to write events to the binary log during
@@ -855,28 +855,28 @@ int cmp_splocal_locations(Item_splocal *
If the answers are No and Yes, we write the function call into the binary
log as "SELECT spfunc(<param1value>, <param2value>, ...)"
-
-
+
+
4. Miscellaneous issues.
-
- 4.1 User variables.
+
+ 4.1 User variables.
When we call mysql_bin_log.write() for an SP statement, thd->user_var_events
- must hold set<{var_name, value}> pairs for all user variables used during
+ must hold set<{var_name, value}> pairs for all user variables used during
the statement execution.
This set is produced by tracking user variable reads during statement
- execution.
+ execution.
For SPs, this has the following implications:
- 1) thd->user_var_events may contain events from several SP statements and
- needs to be valid after exection of these statements was finished. In
+ 1) thd->user_var_events may contain events from several SP statements and
+ needs to be valid after exection of these statements was finished. In
order to achieve that, we
* Allocate user_var_events array elements on appropriate mem_root (grep
for user_var_events_alloc).
* Use is_query_in_union() to determine if user_var_event is created.
-
+
2) We need to empty thd->user_var_events after we have wrote a function
- call. This is currently done by making
+ call. This is currently done by making
reset_dynamic(&thd->user_var_events);
calls in several different places. (TODO cosider moving this into
mysql_bin_log.write() function)
@@ -895,7 +895,7 @@ int cmp_splocal_locations(Item_splocal *
Replace thd->query{_length} with a string that one can write to
the binlog.
- The binlog-suitable string is produced by replacing references to SP local
+ The binlog-suitable string is produced by replacing references to SP local
variables with NAME_CONST('sp_var_name', value) calls.
@param thd Current thread.
@@ -932,18 +932,18 @@ subst_spvars(THD *thd, sp_instr *instr,
}
if (!sp_vars_uses.elements())
DBUG_RETURN(FALSE);
-
+
/* Sort SP var refs by their occurences in the query */
sp_vars_uses.sort(cmp_splocal_locations);
- /*
+ /*
Construct a statement string where SP local var refs are replaced
with "NAME_CONST(name, value)"
*/
qbuf.length(0);
cur= query_str->str;
prev_pos= res= 0;
- for (Item_splocal **splocal= sp_vars_uses.front();
+ for (Item_splocal **splocal= sp_vars_uses.front();
splocal < sp_vars_uses.back(); splocal++)
{
Item *val;
@@ -952,11 +952,11 @@ subst_spvars(THD *thd, sp_instr *instr,
String str_value_holder(str_buffer, sizeof(str_buffer),
&my_charset_latin1);
String *str_value;
-
+
/* append the text between sp ref occurences */
res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos);
prev_pos= (*splocal)->pos_in_query + (*splocal)->len_in_query;
-
+
/* append the spvar substitute */
res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('"));
res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length);
@@ -1030,7 +1030,7 @@ void sp_head::recursion_level_error(THD
Execute the routine. The main instruction jump loop is there.
Assume the parameters already set.
@todo
- - Will write this SP statement into binlog separately
+ - Will write this SP statement into binlog separately
(TODO: consider changing the condition to "not inside event union")
@retval
@@ -1173,7 +1173,7 @@ sp_head::execute(THD *thd)
uint hip; // Handler ip
#if defined(ENABLED_PROFILING)
- /*
+ /*
Treat each "instr" of a routine as discrete unit that could be profiled.
Profiling only records information for segments of code that set the
source of the query, and almost all kinds of instructions in s-p do not.
@@ -1196,7 +1196,7 @@ sp_head::execute(THD *thd)
/* Don't change NOW() in FUNCTION or TRIGGER */
if (!thd->in_sub_stmt)
thd->set_time(); // Make current_time() et al work
-
+
/*
We have to set thd->stmt_arena before executing the instruction
to store in the instruction free_list all new items, created
@@ -1204,20 +1204,20 @@ sp_head::execute(THD *thd)
items made during other permanent subquery transformations).
*/
thd->stmt_arena= i;
-
- /*
- Will write this SP statement into binlog separately
+
+ /*
+ Will write this SP statement into binlog separately
(TODO: consider changing the condition to "not inside event union")
*/
if (thd->prelocked_mode == NON_PRELOCKED)
thd->user_var_events_alloc= thd->mem_root;
-
+
err_status= i->execute(thd, &ip);
if (i->free_list)
cleanup_items(i->free_list);
-
- /*
+
+ /*
If we've set thd->user_var_events_alloc to mem_root of this SP
statement, clean all the events allocated in it.
*/
@@ -1229,7 +1229,7 @@ sp_head::execute(THD *thd)
/* we should cleanup free_list and memroot, used by instruction */
thd->cleanup_after_query();
- free_root(&execute_mem_root, MYF(0));
+ free_root(&execute_mem_root, MYF(0));
/*
Check if an exception has occurred and a handler has been found
@@ -1244,22 +1244,22 @@ sp_head::execute(THD *thd)
switch (ctx->found_handler(&hip, &hf)) {
case SP_HANDLER_NONE:
- break;
+ break;
case SP_HANDLER_CONTINUE:
thd->restore_active_arena(&execute_arena, &backup_arena);
thd->set_n_backup_active_arena(&execute_arena, &backup_arena);
ctx->push_hstack(i->get_cont_dest());
- // Fall through
+ /* Fall through */
default:
- ip= hip;
- err_status= FALSE;
- ctx->clear_handler();
- ctx->enter_handler(hip);
+ ip= hip;
+ err_status= FALSE;
+ ctx->clear_handler();
+ ctx->enter_handler(hip);
thd->clear_error();
thd->is_fatal_error= 0;
- thd->killed= THD::NOT_KILLED;
+ thd->killed= THD::NOT_KILLED;
thd->mysys_var->abort= 0;
- continue;
+ continue;
}
}
} while (!err_status && !thd->killed && !thd->is_fatal_error);
@@ -1828,7 +1828,7 @@ sp_head::execute_procedure(THD *thd, Lis
delete octx; /* Delete octx if it was init() that failed. */
DBUG_RETURN(TRUE);
}
-
+
#ifndef DBUG_OFF
octx->sp= 0;
#endif
@@ -1903,9 +1903,9 @@ sp_head::execute_procedure(THD *thd, Lis
}
}
- /*
- Okay, got values for all arguments. Close tables that might be used by
- arguments evaluation. If arguments evaluation required prelocking mode,
+ /*
+ Okay, got values for all arguments. Close tables that might be used by
+ arguments evaluation. If arguments evaluation required prelocking mode,
we'll leave it here.
*/
if (!thd->in_sub_stmt)
@@ -2212,7 +2212,7 @@ sp_head::do_cont_backpatch()
void
sp_head::set_info(longlong created, longlong modified,
- st_sp_chistics *chistics, ulong sql_mode)
+ st_sp_chistics *chistics, ulong sql_mode)
{
m_created= created;
m_modified= modified;
@@ -2222,8 +2222,8 @@ sp_head::set_info(longlong created, long
m_chistics->comment.str= 0;
else
m_chistics->comment.str= strmake_root(mem_root,
- m_chistics->comment.str,
- m_chistics->comment.length);
+ m_chistics->comment.str,
+ m_chistics->comment.length);
m_sql_mode= sql_mode;
}
@@ -2421,8 +2421,6 @@ sp_head::show_create_routine(THD *thd, i
}
-
-
/**
Add instruction to SP.
@@ -2480,12 +2478,13 @@ void sp_head::optimize()
else
{
if (src != dst)
- { // Move the instruction and update prev. jumps
- sp_instr *ibp;
- List_iterator_fast<sp_instr> li(bp);
+ {
+ /* Move the instruction and update prev. jumps */
+ sp_instr *ibp;
+ List_iterator_fast<sp_instr> li(bp);
- set_dynamic(&m_instr, (uchar*)&i, dst);
- while ((ibp= li++))
+ set_dynamic(&m_instr, (uchar*)&i, dst);
+ while ((ibp= li++))
{
sp_instr_opt_meta *im= static_cast<sp_instr_opt_meta *>(ibp);
im->set_destination(src, dst);
@@ -2573,14 +2572,14 @@ sp_head::show_routine_code(THD *thd)
field_list.push_back(new Item_uint("Pos", 9));
// 1024 is for not to confuse old clients
field_list.push_back(new Item_empty_string("Instruction",
- max(buffer.length(), 1024)));
+ max(buffer.length(), 1024)));
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF))
DBUG_RETURN(1);
for (ip= 0; (i = get_instr(ip)) ; ip++)
{
- /*
+ /*
Consistency check. If these are different something went wrong
during optimization.
*/
@@ -2643,7 +2642,7 @@ sp_lex_keeper::reset_lex_and_exec_core(T
int res= 0;
DBUG_ENTER("reset_lex_and_exec_core");
- /*
+ /*
The flag is saved at the entry to the following substatement.
It's reset further in the common code part.
It's merged with the saved parent's value at the exit of this func.
@@ -2800,8 +2799,7 @@ sp_instr_stmt::execute(THD *thd, uint *n
if (unlikely((thd->options & OPTION_LOG_OFF)==0))
general_log_write(thd, COM_QUERY, thd->query, thd->query_length);
- if (query_cache_send_result_to_client(thd,
- thd->query, thd->query_length) <= 0)
+ if (query_cache_send_result_to_client(thd, thd->query, thd->query_length) <= 0)
{
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
@@ -2897,7 +2895,7 @@ sp_instr_set::exec_core(THD *thd, uint *
/* If this also failed, let's abort. */
sp_rcontext *spcont= thd->spcont;
-
+
thd->spcont= NULL; /* Avoid handlers */
my_error(ER_OUT_OF_RESOURCES, MYF(0));
spcont->clear_handler();
@@ -3305,7 +3303,7 @@ uint
sp_instr_hreturn::opt_mark(sp_head *sp, List<sp_instr> *leads)
{
marked= 1;
-
+
if (m_dest)
{
/*
@@ -3313,7 +3311,7 @@ sp_instr_hreturn::opt_mark(sp_head *sp,
*/
return m_dest;
}
-
+
/*
This is a CONTINUE handler; next instruction step will come from
the handler stack and not from opt_mark.
@@ -3630,14 +3628,14 @@ sp_instr_set_case_expr::exec_core(THD *t
*/
Item *null_item= new Item_null();
-
+
if (!null_item ||
thd->spcont->set_case_expr(thd, m_case_expr_id, &null_item))
{
/* If this also failed, we have to abort. */
sp_rcontext *spcont= thd->spcont;
-
+
thd->spcont= NULL; /* Avoid handlers */
my_error(ER_OUT_OF_RESOURCES, MYF(0));
spcont->clear_handler();
@@ -3810,13 +3808,13 @@ sp_head::merge_table_list(THD *thd, TABL
}
else
{
- if (!(tab= (SP_TABLE *)thd->calloc(sizeof(SP_TABLE))))
- return FALSE;
- if (lex_for_tmp_check->sql_command == SQLCOM_CREATE_TABLE &&
- lex_for_tmp_check->query_tables == table &&
- lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
+ if (!(tab= (SP_TABLE *)thd->calloc(sizeof(SP_TABLE))))
+ return FALSE;
+ if (lex_for_tmp_check->sql_command == SQLCOM_CREATE_TABLE &&
+ lex_for_tmp_check->query_tables == table &&
+ lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
{
- tab->temp= TRUE;
+ tab->temp= TRUE;
tab->qname.length= tlen - alen - 1;
}
else
@@ -3831,7 +3829,7 @@ sp_head::merge_table_list(THD *thd, TABL
tab->lock_transactional= table->lock_transactional;
tab->lock_count= tab->query_lock_count= 1;
tab->trg_event_map= table->trg_event_map;
- my_hash_insert(&m_sptabs, (uchar *)tab);
+ my_hash_insert(&m_sptabs, (uchar *)tab);
}
}
return TRUE;
@@ -3936,8 +3934,8 @@ sp_head::add_used_tables_to_table_list(T
TABLE_LIST *
sp_add_to_query_tables(THD *thd, LEX *lex,
- const char *db, const char *name,
- thr_lock_type locktype)
+ const char *db, const char *name,
+ thr_lock_type locktype)
{
TABLE_LIST *table;
@@ -3953,7 +3951,7 @@ sp_add_to_query_tables(THD *thd, LEX *le
table->lock_transactional= 1; /* allow transactional locks */
table->select_lex= lex->current_select;
table->cacheable_table= 1;
-
+
lex->add_to_query_tables(table);
return table;
}
| Thread |
|---|
| • bk commit into 6.0 tree (davi:1.2623) | Davi Arnaut | 8 Apr |