Commit 939b1365 authored by unknown's avatar unknown

Merge jlindstrom@bk-internal.mysql.com:/home/bk/mysql-5.0

into hundin.mysql.fi:/home/jan/mysql-5.0
parents b4bfd1a2 71f2f3a2
......@@ -869,8 +869,7 @@ static int get_options(int *argc, char ***argv)
static char *parse_text_line(char *pos)
{
int i, nr;
char *row;
row= pos;
char *row= pos;
DBUG_ENTER("parse_text_line");
while (*pos)
......
......@@ -156,14 +156,14 @@ drop tables testtets.t4, testtets.t1, t2, t3;
drop database testtets;
select * from information_schema.CHARACTER_SETS
where CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
SHOW CHARACTER SET LIKE 'latin1%';
Charset Description Default collation Maxlen
latin1 ISO 8859-1 West European latin1_swedish_ci 1
SHOW CHARACTER SET * LIKE 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
SHOW CHARACTER SET WHERE CHARACTER_SET_NAME like 'latin1%';
Charset Description Default collation Maxlen
latin1 ISO 8859-1 West European latin1_swedish_ci 1
......@@ -171,8 +171,8 @@ SHOW CHARACTER SET CHARACTER_SET_NAME WHERE CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME
latin1
SHOW CHARACTER SET * WHERE CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
select * from information_schema.COLLATIONS
where COLLATION_NAME like 'latin1%';
COLLATION_NAME CHARSET ID DEFAULT COMPILED SORTLEN
......@@ -252,6 +252,11 @@ begin
select * from t1;
select * from t2;
end|
select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines;
parameter_style sql_data_access dtd_identifier
SQL CONTAINS SQL NULL
SQL CONTAINS SQL int
show procedure status;
Db Name Type Definer Modified Created Security_type Comment
test sel2 PROCEDURE root@localhost # # DEFINER
......@@ -385,11 +390,11 @@ NULL test key_1 test t1 UNIQUE
NULL test key_2 test t1 UNIQUE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
NULL test PRIMARY NULL test t1 a 1 NULL NULL NULL NULL
NULL test constraint_1 NULL test t1 a 1 NULL NULL NULL NULL
NULL test key_1 NULL test t1 a 1 NULL NULL NULL NULL
NULL test key_2 NULL test t1 a 1 NULL NULL NULL NULL
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 a 1 NULL
NULL test constraint_1 NULL test t1 a 1 NULL
NULL test key_1 NULL test t1 a 1 NULL
NULL test key_2 NULL test t1 a 1 NULL
select table_name from information_schema.TABLES where table_schema like "test%";
table_name
t1
......@@ -410,9 +415,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
select * from information_schema.views;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE
NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` WITH CASCADED CHECK OPTION YES
NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` WITH LOCAL CHECK OPTION YES
NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` WITH CASCADED CHECK OPTION YES
NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES
NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES
NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES
grant select (a) on test.t1 to joe@localhost with grant option;
select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
......@@ -466,8 +471,8 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2252
set names latin2;
......@@ -475,23 +480,23 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2252
set names latin1;
create table t1 select * from information_schema.CHARACTER_SETS
where CHARACTER_SET_NAME like "latin1";
select * from t1;
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
alter table t1 default character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
......@@ -554,7 +559,7 @@ TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
......
......@@ -11,9 +11,9 @@ NULL test t2_ibfk_1 test t2 FOREIGN KEY
NULL test t2_ibfk_2 test t2 FOREIGN KEY
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
NULL test PRIMARY NULL test t1 id 1 NULL NULL NULL NULL
NULL test PRIMARY NULL test t2 id 1 NULL NULL NULL NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1 test t1 id
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1 test t1 id
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 id 1 NULL
NULL test PRIMARY NULL test t2 id 1 NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1
drop table t2, t1;
......@@ -92,6 +92,12 @@ begin
end|
delimiter ;|
#
# Bug#7222 information_schema: errors in "routines"
#
select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines;
--replace_column 5 # 6 #
show procedure status;
--replace_column 5 # 6 #
......
......@@ -2551,10 +2551,10 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond)
{
restore_record(table, default_values);
table->field[0]->store(tmp_cs->csname, strlen(tmp_cs->csname), scs);
table->field[1]->store(tmp_cs->comment ? tmp_cs->comment : "",
table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
table->field[2]->store(tmp_cs->comment ? tmp_cs->comment : "",
strlen(tmp_cs->comment ? tmp_cs->comment : ""),
scs);
table->field[2]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
table->field[3]->store((longlong) tmp_cs->mbmaxlen);
table->file->write_row(table->record[0]);
}
......@@ -2661,20 +2661,25 @@ void store_schema_proc(THD *thd, TABLE *table,
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[2], &tmp_string);
table->field[4]->store(tmp_string.ptr(), tmp_string.length(), cs);
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[9], &tmp_string);
table->field[5]->store(tmp_string.ptr(), tmp_string.length(), cs);
if (proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION)
{
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[9], &tmp_string);
table->field[5]->store(tmp_string.ptr(), tmp_string.length(), cs);
table->field[5]->set_notnull();
}
table->field[6]->store("SQL", 3, cs);
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[10], &tmp_string);
table->field[7]->store(tmp_string.ptr(), tmp_string.length(), cs);
table->field[8]->store("SQL", 3, cs);
table->field[10]->store("SQL", 3, cs);
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[6], &tmp_string);
table->field[11]->store(tmp_string.ptr(), tmp_string.length(), cs);
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[5], &tmp_string);
table->field[12]->store(tmp_string.ptr(), tmp_string.length(), cs);
if (proc_table->field[5]->val_int() == SP_CONTAINS_SQL)
{
table->field[12]->store("CONTAINS SQL", 12 , cs);
}
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[7], &tmp_string);
table->field[14]->store(tmp_string.ptr(), tmp_string.length(), cs);
......@@ -2824,9 +2829,9 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
if (tables->with_check != VIEW_CHECK_NONE)
{
if (tables->with_check == VIEW_CHECK_LOCAL)
table->field[4]->store("WITH LOCAL CHECK OPTION", 23, cs);
table->field[4]->store("LOCAL", 5, cs);
else
table->field[4]->store("WITH CASCADED CHECK OPTION", 26, cs);
table->field[4]->store("CASCADED", 8, cs);
}
else
table->field[4]->store("NONE", 4, cs);
......@@ -2857,12 +2862,12 @@ void store_constraints(TABLE *table, const char*db, const char *tname,
}
static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
static int get_schema_constraints_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
const char *base_name,
const char *file_name)
{
DBUG_ENTER("get_schema_constarints_record");
DBUG_ENTER("get_schema_constraints_record");
if (!res && !tables->view)
{
List<FOREIGN_KEY_INFO> f_key_list;
......@@ -2974,14 +2979,6 @@ static int get_schema_key_column_usage_record(THD *thd,
(longlong) f_idx);
table->field[8]->store((longlong) f_idx);
table->field[8]->set_notnull();
table->field[9]->store(f_key_info->referenced_db->str,
f_key_info->referenced_db->length, cs);
table->field[9]->set_notnull();
table->field[10]->store(f_key_info->referenced_table->str,
f_key_info->referenced_table->length, cs);
table->field[10]->set_notnull();
table->field[11]->store(r_info->str, r_info->length, cs);
table->field[11]->set_notnull();
table->file->write_row(table->record[0]);
}
}
......@@ -3219,6 +3216,28 @@ int make_columns_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
}
int make_character_sets_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
int fields_arr[]= {0, 2, 1, 3, -1};
int *field_num= fields_arr;
ST_FIELD_INFO *field_info;
for (; *field_num >= 0; field_num++)
{
field_info= &schema_table->fields_info[*field_num];
Item_field *field= new Item_field(NullS, NullS, field_info->field_name);
if (field)
{
field->set_name(field_info->old_name,
strlen(field_info->old_name),
system_charset_info);
if (add_item_to_list(thd, field))
return 1;
}
}
return 0;
}
int make_proc_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
int fields_arr[]= {2, 3, 4, 19, 16, 15, 14, 18, -1};
......@@ -3442,8 +3461,8 @@ ST_FIELD_INFO columns_fields_info[]=
ST_FIELD_INFO charsets_fields_info[]=
{
{"CHARACTER_SET_NAME", 30, MYSQL_TYPE_STRING, 0, 0, "Charset"},
{"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description"},
{"DEFAULT_COLLATE_NAME", 60, MYSQL_TYPE_STRING, 0, 0, "Default collation"},
{"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description"},
{"MAXLEN", 3 ,MYSQL_TYPE_LONG, 0, 0, "Maxlen"},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
......@@ -3476,12 +3495,12 @@ ST_FIELD_INFO proc_fields_info[]=
{"ROUTINE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Db"},
{"ROUTINE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"},
{"ROUTINE_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type"},
{"DTD_IDENTIFIER", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"ROUTINE_BODY", 3, MYSQL_TYPE_STRING, 0, 0, 0},
{"DTD_IDENTIFIER", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"ROUTINE_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0},
{"ROUTINE_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
{"EXTERNAL_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"EXTERNAL_LANGUAGE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"PARAMETER_STYLE", 3, MYSQL_TYPE_STRING, 0, 0, 0},
{"PARAMETER_STYLE", 8, MYSQL_TYPE_STRING, 0, 0, 0},
{"IS_DETERMINISTIC", 3, MYSQL_TYPE_STRING, 0, 0, 0},
{"SQL_DATA_ACCESS", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"SQL_PATH", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
......@@ -3522,7 +3541,7 @@ ST_FIELD_INFO view_fields_info[]=
{"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"VIEW_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
{"CHECK_OPTION", 30, MYSQL_TYPE_STRING, 0, 0, 0},
{"CHECK_OPTION", 8, MYSQL_TYPE_STRING, 0, 0, 0},
{"IS_UPDATABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
......@@ -3597,9 +3616,6 @@ ST_FIELD_INFO key_column_usage_fields_info[]=
{"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"ORDINAL_POSITION", 10 ,MYSQL_TYPE_LONG, 0, 0, 0},
{"POSITION_IN_UNIQUE_CONSTRAINT", 10 ,MYSQL_TYPE_LONG, 0, 1, 0},
{"REFERENCED_TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"REFERENCED_COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
......@@ -3627,7 +3643,7 @@ ST_SCHEMA_TABLE schema_tables[]=
{"COLUMNS", columns_fields_info, create_schema_table,
get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2},
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
fill_schema_charsets, make_old_format, 0, -1, -1},
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1},
{"COLLATIONS", collation_fields_info, create_schema_table,
fill_schema_collation, make_old_format, 0, -1, -1},
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
......@@ -3647,7 +3663,7 @@ ST_SCHEMA_TABLE schema_tables[]=
{"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
fill_schema_column_privileges, 0, 0, -1, -1},
{"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table,
get_all_tables, 0, get_schema_constarints_record, 3, 4},
get_all_tables, 0, get_schema_constraints_record, 3, 4},
{"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
get_all_tables, 0, get_schema_key_column_usage_record, 4, 5},
{"TABLE_NAMES", table_names_fields_info, create_schema_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment