1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Print value of Item_param if it has a value (when debugging)

This commit is contained in:
monty@mysql.com
2004-09-04 15:02:57 +03:00
parent 46ff90738b
commit 32594c9989
9 changed files with 40 additions and 16 deletions

View File

@ -2384,7 +2384,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
char buff[4 /* size of stmt id */ + char buff[4 /* size of stmt id */ +
5 /* execution flags */]; 5 /* execution flags */];
DBUG_ENTER("execute"); DBUG_ENTER("execute");
DBUG_PRINT("enter",("packet: %s, length :%d",packet ? packet :" ", length)); DBUG_DUMP("packet", packet, length);
mysql->last_used_con= mysql; mysql->last_used_con= mysql;
int4store(buff, stmt->stmt_id); /* Send stmt id to server */ int4store(buff, stmt->stmt_id); /* Send stmt id to server */

View File

@ -1143,8 +1143,27 @@ bool Item_param::convert_str_value(THD *thd)
return rc; 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() void Item_copy_string::copy()
{ {

View File

@ -635,7 +635,7 @@ public:
*/ */
virtual table_map used_tables() const virtual table_map used_tables() const
{ return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; } { 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 */ /* parameter never equal to other parameter of other item */
bool eq(const Item *item, bool binary_cmp) const { return 0; } bool eq(const Item *item, bool binary_cmp) const { return 0; }
}; };

View File

@ -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)) && while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) &&
!log_in_use(log_info.log_file_name)) !log_in_use(log_info.log_file_name))
{ {
ulong tmp; ulong file_size;
LINT_INIT(tmp); LINT_INIT(file_size);
if (decrease_log_space) //stat the file we want to delete if (decrease_log_space) //stat the file we want to delete
{ {
MY_STAT s; MY_STAT s;
if (my_stat(log_info.log_file_name,&s,MYF(0))) if (my_stat(log_info.log_file_name,&s,MYF(0)))
tmp= s.st_size; file_size= s.st_size;
else else
{ {
/* /*
@ -852,7 +852,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
of space that deletion will free. In most cases, of space that deletion will free. In most cases,
deletion won't work either, so it's not a problem. 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)); DBUG_PRINT("info",("purging %s",log_info.log_file_name));
if (!my_delete(log_info.log_file_name, MYF(0)) && decrease_log_space) 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) if (find_next_log(&log_info, 0) || exit_loop)
break; break;
} }

View File

@ -86,14 +86,13 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
return -1; return -1;
} }
table_list->next_local= 0;
thd->dupp_field=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; 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); 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; table_list->next_local= save_next;
thd->lex->select_lex.no_wrap_view_item= 0;
if (res) if (res)
return -1; return -1;

View File

@ -78,6 +78,7 @@ const char *command_name[]={
"Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user", "Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user",
"Binlog Dump","Table Dump", "Connect Out", "Register Slave", "Binlog Dump","Table Dump", "Connect Out", "Register Slave",
"Prepare", "Prepare Execute", "Long Data", "Close stmt", "Prepare", "Prepare Execute", "Long Data", "Close stmt",
"Reset stmt", "Set option", "Fetch",
"Error" // Last command number "Error" // Last command number
}; };

View File

@ -543,6 +543,7 @@ JOIN::optimize()
if (cond_value == Item::COND_FALSE || if (cond_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS))) (!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
{ /* Impossible cond */ { /* Impossible cond */
DBUG_PRINT("info", ("Impossible WHERE"));
zero_result_cause= "Impossible WHERE"; zero_result_cause= "Impossible WHERE";
error= 0; error= 0;
DBUG_RETURN(0); DBUG_RETURN(0);
@ -560,20 +561,24 @@ JOIN::optimize()
{ {
if (res > 1) if (res > 1)
{ {
DBUG_PRINT("error",("Error from opt_sum_query"));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (res < 0) if (res < 0)
{ {
DBUG_PRINT("info",("No matching min/max row"));
zero_result_cause= "No matching min/max row"; zero_result_cause= "No matching min/max row";
error=0; error=0;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
DBUG_PRINT("info",("Select tables optimized away"));
zero_result_cause= "Select tables optimized away"; zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved tables_list= 0; // All tables resolved
} }
} }
if (!tables_list) if (!tables_list)
{ {
DBUG_PRINT("info",("No tables"));
error= 0; error= 0;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -11640,7 +11645,6 @@ void st_table_list::print(THD *thd, String *str)
cmp_name= real_name; cmp_name= real_name;
} }
if (my_strcasecmp(table_alias_charset, cmp_name, alias)) if (my_strcasecmp(table_alias_charset, cmp_name, alias))
{
{ {
str->append(' '); str->append(' ');
append_identifier(thd, str, alias, strlen(alias)); 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) void st_select_lex::print(THD *thd, String *str)
{ {
if (!thd) if (!thd)
@ -11657,7 +11660,7 @@ void st_select_lex::print(THD *thd, String *str)
str->append("select ", 7); str->append("select ", 7);
//options /* First add options */
if (options & SELECT_STRAIGHT_JOIN) if (options & SELECT_STRAIGHT_JOIN)
str->append("straight_join ", 14); str->append("straight_join ", 14);
if ((thd->lex->lock_option == TL_READ_HIGH_PRIORITY) && if ((thd->lex->lock_option == TL_READ_HIGH_PRIORITY) &&

View File

@ -7553,7 +7553,7 @@ algorithm:
| ALGORITHM_SYM EQ MERGE_SYM | ALGORITHM_SYM EQ MERGE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; } { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
| ALGORITHM_SYM EQ TEMPTABLE_SYM | ALGORITHM_SYM EQ TEMPTABLE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_TMEPTABLE; } { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
; ;
check_option: check_option:
/* empty */ {} /* empty */ {}

View File

@ -5508,6 +5508,7 @@ static void test_subselect()
MYSQL_STMT *stmt; MYSQL_STMT *stmt;
int rc, id; int rc, id;
MYSQL_BIND bind[1]; MYSQL_BIND bind[1];
DBUG_ENTER("test_subselect");
myheader("test_subselect"); myheader("test_subselect");
@ -5609,6 +5610,7 @@ static void test_subselect()
assert(rc == MYSQL_NO_DATA); assert(rc == MYSQL_NO_DATA);
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
DBUG_VOID_RETURN;
} }