| 9587 | */ |
| 9588 | |
| 9589 | int make_schema_select(THD *thd, SELECT_LEX *sel, |
| 9590 | ST_SCHEMA_TABLE *schema_table) |
| 9591 | { |
| 9592 | LEX_CSTRING db, table; |
| 9593 | DBUG_ENTER("make_schema_select"); |
| 9594 | DBUG_PRINT("enter", ("mysql_schema_select: %s", schema_table->table_name.str)); |
| 9595 | /* |
| 9596 | We have to make non const db_name & table_name |
| 9597 | because of lower_case_table_names |
| 9598 | */ |
| 9599 | if (!thd->make_lex_string(&db, INFORMATION_SCHEMA_NAME.str, |
| 9600 | INFORMATION_SCHEMA_NAME.length)) |
| 9601 | DBUG_RETURN(1); |
| 9602 | |
| 9603 | if (!thd->make_lex_string(&table, schema_table->table_name.str, |
| 9604 | schema_table->table_name.length)) |
| 9605 | DBUG_RETURN(1); |
| 9606 | |
| 9607 | if (schema_table->old_format(thd, schema_table)) |
| 9608 | DBUG_RETURN(1); |
| 9609 | |
| 9610 | if (!sel->add_table_to_list(thd, new Table_ident(thd, &db, &table, 0), |
| 9611 | 0, 0, TL_READ, MDL_SHARED_READ)) |
| 9612 | DBUG_RETURN(1); |
| 9613 | |
| 9614 | sel->table_list.first->schema_table_reformed= 1; |
| 9615 | DBUG_RETURN(0); |
| 9616 | } |
| 9617 | |
| 9618 | |
| 9619 | /* |
no test coverage detected