1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-recentcommmerge

into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1


client/mysqlcheck.c:
  Auto merged
configure.in:
  Auto merged
include/config-win.h:
  Auto merged
mysql-test/r/func_in.result:
  Auto merged
mysql-test/r/information_schema.result:
  Auto merged
mysql-test/t/func_in.test:
  Auto merged
mysql-test/t/information_schema.test:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
sql/sql_lex.h:
  SCCS merged
This commit is contained in:
unknown
2007-10-29 12:42:06 -04:00
368 changed files with 12510 additions and 12534 deletions

View File

@ -2269,10 +2269,12 @@ int make_table_list(THD *thd, SELECT_LEX *sel,
@param[in] table I_S table
@param[in, out] lookup_field_vals Struct which holds lookup values
@return void
@return
0 success
1 error, there can be no matching records for the condition
*/
void get_lookup_value(THD *thd, Item_func *item_func,
bool get_lookup_value(THD *thd, Item_func *item_func,
TABLE_LIST *table,
LOOKUP_FIELD_VALUES *lookup_field_vals)
{
@ -2305,13 +2307,17 @@ void get_lookup_value(THD *thd, Item_func *item_func,
idx_val= 0;
}
else
return;
return 0;
item_field= (Item_field*) item_func->arguments()[idx_field];
if (table->table != item_field->field->table)
return;
return 0;
tmp_str= item_func->arguments()[idx_val]->val_str(&str_buff);
/* impossible value */
if (!tmp_str)
return 1;
/* Lookup value is database name */
if (!cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
(uchar *) item_field->field_name,
@ -2330,7 +2336,7 @@ void get_lookup_value(THD *thd, Item_func *item_func,
tmp_str->length(), FALSE);
}
}
return;
return 0;
}
@ -2346,14 +2352,16 @@ void get_lookup_value(THD *thd, Item_func *item_func,
@param[in] table I_S table
@param[in, out] lookup_field_vals Struct which holds lookup values
@return void
@return
0 success
1 error, there can be no matching records for the condition
*/
void calc_lookup_values_from_cond(THD *thd, COND *cond, TABLE_LIST *table,
bool calc_lookup_values_from_cond(THD *thd, COND *cond, TABLE_LIST *table,
LOOKUP_FIELD_VALUES *lookup_field_vals)
{
if (!cond)
return;
return 0;
if (cond->type() == Item::COND_ITEM)
{
@ -2364,16 +2372,23 @@ void calc_lookup_values_from_cond(THD *thd, COND *cond, TABLE_LIST *table,
while ((item= li++))
{
if (item->type() == Item::FUNC_ITEM)
get_lookup_value(thd, (Item_func*)item, table, lookup_field_vals);
{
if (get_lookup_value(thd, (Item_func*)item, table, lookup_field_vals))
return 1;
}
else
calc_lookup_values_from_cond(thd, item, table, lookup_field_vals);
{
if (calc_lookup_values_from_cond(thd, item, table, lookup_field_vals))
return 1;
}
}
}
return;
return 0;
}
else if (cond->type() == Item::FUNC_ITEM)
get_lookup_value(thd, (Item_func*) cond, table, lookup_field_vals);
return;
else if (cond->type() == Item::FUNC_ITEM &&
get_lookup_value(thd, (Item_func*) cond, table, lookup_field_vals))
return 1;
return 0;
}
@ -2486,10 +2501,12 @@ static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
@param[in] tables I_S table
@param[in, out] lookup_field_values Struct which holds lookup values
@return void
@return
0 success
1 error, there can be no matching records for the condition
*/
void get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
LOOKUP_FIELD_VALUES *lookup_field_values)
{
LEX *lex= thd->lex;
@ -2503,7 +2520,7 @@ void get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
lookup_field_values->db_value.length= strlen(wild);
lookup_field_values->wild_db_value= 1;
}
break;
return 0;
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_TRIGGERS:
@ -2516,14 +2533,13 @@ void get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
lookup_field_values->table_value.length= strlen(wild);
lookup_field_values->wild_table_value= 1;
}
break;
return 0;
default:
/*
The "default" is for queries over I_S.
All previous cases handle SHOW commands.
*/
calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
break;
return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
}
}
@ -3113,7 +3129,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
}
schema_table_idx= get_schema_table_idx(schema_table);
get_lookup_field_values(thd, cond, tables, &lookup_field_vals);
if (get_lookup_field_values(thd, cond, tables, &lookup_field_vals))
{
error= 0;
goto err;
}
DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
lookup_field_vals.db_value.str,
lookup_field_vals.table_value.str));
@ -3328,7 +3348,8 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
#endif
DBUG_ENTER("fill_schema_shemata");
get_lookup_field_values(thd, cond, tables, &lookup_field_vals);
if (get_lookup_field_values(thd, cond, tables, &lookup_field_vals))
DBUG_RETURN(0);
DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
lookup_field_vals.db_value.str,
lookup_field_vals.table_value.str));
@ -3339,7 +3360,8 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
/*
If we have lookup db value we should check that the database exists
*/
if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value)
if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value &&
!with_i_schema)
{
char path[FN_REFLEN+16];
uint path_len;
@ -3486,6 +3508,10 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
(ptr == option_buff ? 0 :
(uint) (ptr-option_buff)-1), cs);
tmp_buff= (share->table_charset ?
share->table_charset->name : "default");
table->field[17]->store(tmp_buff, strlen(tmp_buff), cs);
if (share->comment.str)
table->field[20]->store(share->comment.str, share->comment.length, cs);
@ -3563,9 +3589,6 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
table->field[16]->set_notnull();
}
tmp_buff= (share->table_charset ?
share->table_charset->name : "default");
table->field[17]->store(tmp_buff, strlen(tmp_buff), cs);
if (file->ha_table_flags() & (ulong) HA_HAS_CHECKSUM)
{
table->field[18]->store((longlong) file->checksum(), TRUE);