Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
efaeb069
Commit
efaeb069
authored
May 10, 2005
by
gluh@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/gluh/MySQL/Devel/mysql-5.0
parents
e7c02801
75b7fef4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
22 deletions
+96
-22
mysql-test/r/information_schema_db.result
mysql-test/r/information_schema_db.result
+28
-0
mysql-test/t/information_schema_db.test
mysql-test/t/information_schema_db.test
+9
-0
sql/sql_show.cc
sql/sql_show.cc
+59
-22
No files found.
mysql-test/r/information_schema_db.result
0 → 100644
View file @
efaeb069
use INFORMATION_SCHEMA;
show tables;
Tables_in_INFORMATION_SCHEMA
SCHEMATA
TABLES
COLUMNS
CHARACTER_SETS
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
ROUTINES
STATISTICS
VIEWS
USER_PRIVILEGES
SCHEMA_PRIVILEGES
TABLE_PRIVILEGES
COLUMN_PRIVILEGES
TABLE_CONSTRAINTS
KEY_COLUMN_USAGE
show tables from INFORMATION_SCHEMA like 'T%';
Tables_in_INFORMATION_SCHEMA (T%)
TABLES
TABLE_PRIVILEGES
TABLE_CONSTRAINTS
create database `inf%`;
use `inf%`;
show tables;
Tables_in_inf%
drop database `inf%`;
mysql-test/t/information_schema_db.test
0 → 100644
View file @
efaeb069
--
source
include
/
testdb_only
.
inc
use
INFORMATION_SCHEMA
;
show
tables
;
show
tables
from
INFORMATION_SCHEMA
like
'T%'
;
create
database
`inf%`
;
use
`inf%`
;
show
tables
;
drop
database
`inf%`
;
sql/sql_show.cc
View file @
efaeb069
...
...
@@ -1779,32 +1779,77 @@ enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
/*
Add 'information_schema' name to db_names
list
Create db names list. Information schema name always is first in
list
SYNOPSIS
schema_db_add
()
make_db_list
()
thd thread handler
files list of db names
wild wild string
idx_field_vals idx_field_vals->db_name contains db name or
wild string
with_i_schema returns 1 if we added 'IS' name to list
otherwise returns 0
is_wild_value if value is 1 then idx_field_vals->db_name is
wild string otherwise it's db name;
RETURN
1 error
0 success
*/
int
schema_db_add
(
THD
*
thd
,
List
<
char
>
*
files
,
const
char
*
wild
,
bool
*
with_i_schema
)
int
make_db_list
(
THD
*
thd
,
List
<
char
>
*
files
,
INDEX_FIELD_VALUES
*
idx_field_vals
,
bool
*
with_i_schema
,
bool
is_wild_value
)
{
LEX
*
lex
=
thd
->
lex
;
*
with_i_schema
=
0
;
if
(
!
wild
||
!
wild_compare
(
information_schema_name
.
str
,
wild
,
0
))
get_index_field_values
(
lex
,
idx_field_vals
);
if
(
is_wild_value
)
{
*
with_i_schema
=
1
;
if
(
files
->
push_back
(
thd
->
strdup
(
information_schema_name
.
str
)))
return
1
;
/*
This part of code is only for SHOW DATABASES command.
idx_field_vals->db_value can be 0 when we don't use
LIKE clause (see also get_index_field_values() function)
*/
if
(
!
idx_field_vals
->
db_value
||
!
wild_case_compare
(
system_charset_info
,
information_schema_name
.
str
,
idx_field_vals
->
db_value
))
{
*
with_i_schema
=
1
;
if
(
files
->
push_back
(
thd
->
strdup
(
information_schema_name
.
str
)))
return
1
;
}
return
mysql_find_files
(
thd
,
files
,
NullS
,
mysql_data_home
,
idx_field_vals
->
db_value
,
1
);
}
return
0
;
/*
This part of code is for SHOW TABLES, SHOW TABLE STATUS commands.
idx_field_vals->db_value can't be 0 (see get_index_field_values()
function). lex->orig_sql_command can be not equal to SQLCOM_END
only in case of executing of SHOW commands.
*/
if
(
lex
->
orig_sql_command
!=
SQLCOM_END
)
{
if
(
!
my_strcasecmp
(
system_charset_info
,
information_schema_name
.
str
,
idx_field_vals
->
db_value
))
{
*
with_i_schema
=
1
;
return
files
->
push_back
(
thd
->
strdup
(
information_schema_name
.
str
));
}
return
files
->
push_back
(
thd
->
strdup
(
idx_field_vals
->
db_value
));
}
/*
Create list of existing databases. It is used in case
of select from information schema table
*/
if
(
files
->
push_back
(
thd
->
strdup
(
information_schema_name
.
str
)))
return
1
;
*
with_i_schema
=
1
;
return
mysql_find_files
(
thd
,
files
,
NullS
,
mysql_data_home
,
NullS
,
1
);
}
...
...
@@ -1882,14 +1927,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if
(
schema_table_idx
==
SCH_TABLES
)
lock_type
=
TL_READ
;
get_index_field_values
(
lex
,
&
idx_field_vals
);
/* information schema name always is first in list */
if
(
schema_db_add
(
thd
,
&
bases
,
idx_field_vals
.
db_value
,
&
with_i_schema
))
goto
err
;
if
(
m
ysql_find_files
(
thd
,
&
bases
,
NullS
,
mysql_data_home
,
idx_field_vals
.
db_value
,
1
))
if
(
m
ake_db_list
(
thd
,
&
bases
,
&
idx_field_vals
,
&
with_i_schema
,
0
))
goto
err
;
partial_cond
=
make_cond_for_info_schema
(
cond
,
tables
);
...
...
@@ -2025,13 +2065,10 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
TABLE
*
table
=
tables
->
table
;
DBUG_ENTER
(
"fill_schema_shemata"
);
get_index_field_values
(
thd
->
lex
,
&
idx_field_vals
);
/* information schema name always is first in list */
if
(
schema_db_add
(
thd
,
&
files
,
idx_field_vals
.
db_value
,
&
with_i_schema
))
DBUG_RETURN
(
1
);
if
(
mysql_find_files
(
thd
,
&
files
,
NullS
,
mysql_data_home
,
idx_field_vals
.
db_value
,
1
))
if
(
make_db_list
(
thd
,
&
files
,
&
idx_field_vals
,
&
with_i_schema
,
1
))
DBUG_RETURN
(
1
);
List_iterator_fast
<
char
>
it
(
files
);
while
((
file_name
=
it
++
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment