summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc108
1 files changed, 57 insertions, 51 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 73a5b662fbd..53535a7a017 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -453,9 +453,9 @@ bool mysqld_show_authors(THD *thd)
Protocol *protocol= thd->protocol;
DBUG_ENTER("mysqld_show_authors");
- field_list.push_back(new Item_empty_string("Name",40));
- field_list.push_back(new Item_empty_string("Location",40));
- field_list.push_back(new Item_empty_string("Comment",512));
+ field_list.push_back(new Item_empty_string(thd, "Name", 40));
+ field_list.push_back(new Item_empty_string(thd, "Location", 40));
+ field_list.push_back(new Item_empty_string(thd, "Comment", 512));
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -487,9 +487,9 @@ bool mysqld_show_contributors(THD *thd)
Protocol *protocol= thd->protocol;
DBUG_ENTER("mysqld_show_contributors");
- field_list.push_back(new Item_empty_string("Name",40));
- field_list.push_back(new Item_empty_string("Location",40));
- field_list.push_back(new Item_empty_string("Comment", 512));
+ field_list.push_back(new Item_empty_string(thd, "Name", 40));
+ field_list.push_back(new Item_empty_string(thd, "Location", 40));
+ field_list.push_back(new Item_empty_string(thd, "Comment", 512));
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -564,9 +564,9 @@ bool mysqld_show_privileges(THD *thd)
Protocol *protocol= thd->protocol;
DBUG_ENTER("mysqld_show_privileges");
- field_list.push_back(new Item_empty_string("Privilege",10));
- field_list.push_back(new Item_empty_string("Context",15));
- field_list.push_back(new Item_empty_string("Comment",NAME_CHAR_LEN));
+ field_list.push_back(new Item_empty_string(thd, "Privilege", 10));
+ field_list.push_back(new Item_empty_string(thd, "Context", 15));
+ field_list.push_back(new Item_empty_string(thd, "Comment", NAME_CHAR_LEN));
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -1144,19 +1144,19 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (table_list->view)
{
- field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN));
- field_list.push_back(new Item_empty_string("Create View",
+ field_list.push_back(new Item_empty_string(thd, "View", NAME_CHAR_LEN));
+ field_list.push_back(new Item_empty_string(thd, "Create View",
MY_MAX(buffer.length(),1024)));
- field_list.push_back(new Item_empty_string("character_set_client",
+ field_list.push_back(new Item_empty_string(thd, "character_set_client",
MY_CS_NAME_SIZE));
- field_list.push_back(new Item_empty_string("collation_connection",
+ field_list.push_back(new Item_empty_string(thd, "collation_connection",
MY_CS_NAME_SIZE));
}
else
{
- field_list.push_back(new Item_empty_string("Table",NAME_CHAR_LEN));
+ field_list.push_back(new Item_empty_string(thd, "Table", NAME_CHAR_LEN));
// 1024 is for not to confuse old clients
- field_list.push_back(new Item_empty_string("Create Table",
+ field_list.push_back(new Item_empty_string(thd, "Create Table",
MY_MAX(buffer.length(),1024)));
}
@@ -1249,8 +1249,8 @@ bool mysqld_show_create_db(THD *thd, LEX_STRING *dbname,
load_db_opt_by_name(thd, dbname->str, &create);
}
List<Item> field_list;
- field_list.push_back(new Item_empty_string("Database",NAME_CHAR_LEN));
- field_list.push_back(new Item_empty_string("Create Database",1024));
+ field_list.push_back(new Item_empty_string(thd, "Database", NAME_CHAR_LEN));
+ field_list.push_back(new Item_empty_string(thd, "Create Database", 1024));
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -1313,11 +1313,11 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
!wild_case_compare(system_charset_info, field->field_name,wild))
{
if (table_list->view)
- field_list.push_back(new Item_ident_for_show(field,
+ field_list.push_back(new Item_ident_for_show(thd, field,
table_list->view_db.str,
table_list->view_name.str));
else
- field_list.push_back(new Item_field(field));
+ field_list.push_back(new Item_field(thd, field));
}
}
restore_record(table, s->default_values); // Get empty record
@@ -2343,22 +2343,26 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
Protocol *protocol= thd->protocol;
DBUG_ENTER("mysqld_list_processes");
- field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
- field_list.push_back(new Item_empty_string("User", USERNAME_CHAR_LENGTH));
- field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN));
- field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
+ field_list.push_back(new Item_int(thd, "Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
+ field_list.push_back(new Item_empty_string(thd, "User",
+ USERNAME_CHAR_LENGTH));
+ field_list.push_back(new Item_empty_string(thd, "Host",
+ LIST_PROCESS_HOST_LEN));
+ field_list.push_back(field=new Item_empty_string(thd, "db", NAME_CHAR_LEN));
field->maybe_null=1;
- field_list.push_back(new Item_empty_string("Command",16));
- field_list.push_back(field= new Item_return_int("Time",7, MYSQL_TYPE_LONG));
+ field_list.push_back(new Item_empty_string(thd, "Command", 16));
+ field_list.push_back(field= new Item_return_int(thd, "Time", 7,
+ MYSQL_TYPE_LONG));
field->unsigned_flag= 0;
- field_list.push_back(field=new Item_empty_string("State",30));
+ field_list.push_back(field=new Item_empty_string(thd, "State", 30));
field->maybe_null=1;
- field_list.push_back(field=new Item_empty_string("Info",max_query_length));
+ field_list.push_back(field=new Item_empty_string(thd, "Info",
+ max_query_length));
field->maybe_null=1;
if (!thd->variables.old_mode &&
!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
{
- field_list.push_back(field= new Item_float("Progress", 0.0, 3, 7));
+ field_list.push_back(field= new Item_float(thd, "Progress", 0.0, 3, 7));
field->maybe_null= 0;
}
if (protocol->send_result_set_metadata(&field_list,
@@ -3528,7 +3532,7 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
}
-COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
+COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table)
{
if (!cond)
return (COND*) 0;
@@ -3537,14 +3541,14 @@ COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{
/* Create new top level AND item */
- Item_cond_and *new_cond=new Item_cond_and;
+ Item_cond_and *new_cond=new Item_cond_and(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix= make_cond_for_info_schema(item, table);
+ Item *fix= make_cond_for_info_schema(thd, item, table);
if (fix)
new_cond->argument_list()->push_back(fix);
}
@@ -3560,14 +3564,14 @@ COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
}
else
{ // Or list
- Item_cond_or *new_cond=new Item_cond_or;
+ Item_cond_or *new_cond= new Item_cond_or(thd);
if (!new_cond)
return (COND*) 0;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item *item;
while ((item=li++))
{
- Item *fix=make_cond_for_info_schema(item, table);
+ Item *fix=make_cond_for_info_schema(thd, item, table);
if (!fix)
return (COND*) 0;
new_cond->argument_list()->push_back(fix);
@@ -7058,7 +7062,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
schema_table_idx == SCH_GLOBAL_VARIABLES)
scope= OPT_GLOBAL;
- COND *partial_cond= make_cond_for_info_schema(cond, tables);
+ COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, scope),
@@ -7100,7 +7104,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
tmp1= &thd->status_var;
}
- COND *partial_cond= make_cond_for_info_schema(cond, tables);
+ COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
// Evaluate and cache const subqueries now, before the mutex.
if (partial_cond)
partial_cond->val_int();
@@ -7323,7 +7327,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_INT24:
- if (!(item= new Item_return_int(fields_info->field_name,
+ if (!(item= new Item_return_int(thd, fields_info->field_name,
fields_info->field_length,
fields_info->field_type,
fields_info->value)))
@@ -7333,33 +7337,34 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
item->unsigned_flag= (fields_info->field_flags & MY_I_S_UNSIGNED);
break;
case MYSQL_TYPE_DATE:
- if (!(item=new Item_return_date_time(fields_info->field_name,
+ if (!(item=new Item_return_date_time(thd, fields_info->field_name,
strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIME:
- if (!(item=new Item_return_date_time(fields_info->field_name,
+ if (!(item=new Item_return_date_time(thd, fields_info->field_name,
strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
- if (!(item=new Item_return_date_time(fields_info->field_name,
+ if (!(item=new Item_return_date_time(thd, fields_info->field_name,
strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
- if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC,
- fields_info->field_length)) == NULL)
+ if ((item= new Item_float(thd, fields_info->field_name, 0.0,
+ NOT_FIXED_DEC,
+ fields_info->field_length)) == NULL)
DBUG_RETURN(NULL);
break;
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
- if (!(item= new Item_decimal((longlong) fields_info->value, false)))
+ if (!(item= new Item_decimal(thd, (longlong) fields_info->value, false)))
{
DBUG_RETURN(0);
}
@@ -7383,7 +7388,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
- if (!(item= new Item_blob(fields_info->field_name,
+ if (!(item= new Item_blob(thd, fields_info->field_name,
fields_info->field_length)))
{
DBUG_RETURN(0);
@@ -7393,7 +7398,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
/* Don't let unimplemented types pass through. Could be a grave error. */
DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING);
- if (!(item= new Item_empty_string("", fields_info->field_length, cs)))
+ if (!(item= new Item_empty_string(thd, "", fields_info->field_length, cs)))
{
DBUG_RETURN(0);
}
@@ -7815,7 +7820,7 @@ static bool optimize_for_get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond
if (plan->has_db_lookup_value() && plan->has_table_lookup_value())
plan->partial_cond= 0;
else
- plan->partial_cond= make_cond_for_info_schema(cond, tables);
+ plan->partial_cond= make_cond_for_info_schema(thd, cond, tables);
end:
DBUG_RETURN(0);
@@ -9152,8 +9157,9 @@ static bool show_create_trigger_impl(THD *thd,
/* Send header. */
- fields.push_back(new Item_empty_string("Trigger", NAME_LEN));
- fields.push_back(new Item_empty_string("sql_mode", trg_sql_mode_str.length));
+ fields.push_back(new Item_empty_string(thd, "Trigger", NAME_LEN));
+ fields.push_back(new Item_empty_string(thd, "sql_mode",
+ trg_sql_mode_str.length));
{
/*
@@ -9162,7 +9168,7 @@ static bool show_create_trigger_impl(THD *thd,
*/
Item_empty_string *stmt_fld=
- new Item_empty_string("SQL Original Statement",
+ new Item_empty_string(thd, "SQL Original Statement",
MY_MAX(trg_sql_original_stmt.length, 1024));
stmt_fld->maybe_null= TRUE;
@@ -9170,13 +9176,13 @@ static bool show_create_trigger_impl(THD *thd,
fields.push_back(stmt_fld);
}
- fields.push_back(new Item_empty_string("character_set_client",
+ fields.push_back(new Item_empty_string(thd, "character_set_client",
MY_CS_NAME_SIZE));
- fields.push_back(new Item_empty_string("collation_connection",
+ fields.push_back(new Item_empty_string(thd, "collation_connection",
MY_CS_NAME_SIZE));
- fields.push_back(new Item_empty_string("Database Collation",
+ fields.push_back(new Item_empty_string(thd, "Database Collation",
MY_CS_NAME_SIZE));
if (p->send_result_set_metadata(&fields, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))