summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc21
-rw-r--r--sql/item.h2
-rw-r--r--sql/log.cc10
-rw-r--r--sql/sql_insert.cc7
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_select.cc9
-rw-r--r--sql/sql_yacc.yy2
7 files changed, 37 insertions, 15 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 517309acd2b..099e6b977d6 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1143,8 +1143,27 @@ bool Item_param::convert_str_value(THD *thd)
return rc;
}
-/* End of Item_param related */
+void Item_param::print(String *str)
+{
+ if (state == NO_VALUE)
+ {
+ str->append('?');
+ }
+ else
+ {
+ char buffer[80];
+ String tmp(buffer, sizeof(buffer), &my_charset_bin);
+ const String *res;
+ res= query_val_str(&tmp);
+ str->append(*res);
+ }
+}
+
+
+/****************************************************************************
+ Item_copy_string
+****************************************************************************/
void Item_copy_string::copy()
{
diff --git a/sql/item.h b/sql/item.h
index 4030c0fc097..63463c6cc41 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -635,7 +635,7 @@ public:
*/
virtual table_map used_tables() const
{ return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; }
- void print(String *str) { str->append('?'); }
+ void print(String *str);
/* parameter never equal to other parameter of other item */
bool eq(const Item *item, bool binary_cmp) const { return 0; }
};
diff --git a/sql/log.cc b/sql/log.cc
index 5e15b2b170c..44c8ce59aaf 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -838,13 +838,13 @@ int MYSQL_LOG::purge_logs(const char *to_log,
while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) &&
!log_in_use(log_info.log_file_name))
{
- ulong tmp;
- LINT_INIT(tmp);
+ ulong file_size;
+ LINT_INIT(file_size);
if (decrease_log_space) //stat the file we want to delete
{
MY_STAT s;
if (my_stat(log_info.log_file_name,&s,MYF(0)))
- tmp= s.st_size;
+ file_size= s.st_size;
else
{
/*
@@ -852,7 +852,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
of space that deletion will free. In most cases,
deletion won't work either, so it's not a problem.
*/
- tmp= 0;
+ file_size= 0;
}
}
/*
@@ -861,7 +861,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
*/
DBUG_PRINT("info",("purging %s",log_info.log_file_name));
if (!my_delete(log_info.log_file_name, MYF(0)) && decrease_log_space)
- *decrease_log_space-= tmp;
+ *decrease_log_space-= file_size;
if (find_next_log(&log_info, 0) || exit_loop)
break;
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 754db176faa..b7940e2d9d0 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -86,14 +86,13 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
return -1;
}
- table_list->next_local= 0;
thd->dupp_field=0;
- save_next= table_list->next_local; // fields only from first table
-
thd->lex->select_lex.no_wrap_view_item= 1;
+ save_next= table_list->next_local; // fields only from first table
+ table_list->next_local= 0;
res= setup_fields(thd, 0, table_list, fields, 1, 0, 0);
- thd->lex->select_lex.no_wrap_view_item= 0;
table_list->next_local= save_next;
+ thd->lex->select_lex.no_wrap_view_item= 0;
if (res)
return -1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 36a240fa74e..98f1810adc3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -78,6 +78,7 @@ const char *command_name[]={
"Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user",
"Binlog Dump","Table Dump", "Connect Out", "Register Slave",
"Prepare", "Prepare Execute", "Long Data", "Close stmt",
+ "Reset stmt", "Set option", "Fetch",
"Error" // Last command number
};
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3e0ed0de96c..5bd7cb62667 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -543,6 +543,7 @@ JOIN::optimize()
if (cond_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
{ /* Impossible cond */
+ DBUG_PRINT("info", ("Impossible WHERE"));
zero_result_cause= "Impossible WHERE";
error= 0;
DBUG_RETURN(0);
@@ -560,20 +561,24 @@ JOIN::optimize()
{
if (res > 1)
{
+ DBUG_PRINT("error",("Error from opt_sum_query"));
DBUG_RETURN(1);
}
if (res < 0)
{
+ DBUG_PRINT("info",("No matching min/max row"));
zero_result_cause= "No matching min/max row";
error=0;
DBUG_RETURN(0);
}
+ DBUG_PRINT("info",("Select tables optimized away"));
zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved
}
}
if (!tables_list)
{
+ DBUG_PRINT("info",("No tables"));
error= 0;
DBUG_RETURN(0);
}
@@ -11641,7 +11646,6 @@ void st_table_list::print(THD *thd, String *str)
}
if (my_strcasecmp(table_alias_charset, cmp_name, alias))
{
- {
str->append(' ');
append_identifier(thd, str, alias, strlen(alias));
}
@@ -11649,7 +11653,6 @@ void st_table_list::print(THD *thd, String *str)
}
-
void st_select_lex::print(THD *thd, String *str)
{
if (!thd)
@@ -11657,7 +11660,7 @@ void st_select_lex::print(THD *thd, String *str)
str->append("select ", 7);
- //options
+ /* First add options */
if (options & SELECT_STRAIGHT_JOIN)
str->append("straight_join ", 14);
if ((thd->lex->lock_option == TL_READ_HIGH_PRIORITY) &&
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 172ec48fb18..ba3a36f2c34 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7553,7 +7553,7 @@ algorithm:
| ALGORITHM_SYM EQ MERGE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
| ALGORITHM_SYM EQ TEMPTABLE_SYM
- { Lex->create_view_algorithm= VIEW_ALGORITHM_TMEPTABLE; }
+ { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
;
check_option:
/* empty */ {}