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
d80451c8
Commit
d80451c8
authored
Jul 07, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-merge fixes
test SHOW OPEN TABLES
parent
27561841
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
9 deletions
+61
-9
mysql-test/r/show_check.result
mysql-test/r/show_check.result
+3
-0
mysql-test/t/show_check.test
mysql-test/t/show_check.test
+7
-0
sql/mysql_priv.h
sql/mysql_priv.h
+4
-2
sql/sql_base.cc
sql/sql_base.cc
+42
-3
sql/sql_parse.cc
sql/sql_parse.cc
+5
-4
No files found.
mysql-test/r/show_check.result
View file @
d80451c8
...
@@ -90,3 +90,6 @@ t1 CREATE TABLE `t1` (
...
@@ -90,3 +90,6 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
PRIMARY KEY (`a`)
) TYPE=MyISAM
) TYPE=MyISAM
Open_tables_in_test Comment
Open_tables_in_test Comment
t1 cached=1, in_use=0
mysql-test/t/show_check.test
View file @
d80451c8
...
@@ -72,3 +72,10 @@ drop table t1;
...
@@ -72,3 +72,10 @@ drop table t1;
create
table
t1
(
a
int
not
null
,
primary
key
(
a
));
create
table
t1
(
a
int
not
null
,
primary
key
(
a
));
show
create
table
t1
;
show
create
table
t1
;
drop
table
t1
;
drop
table
t1
;
flush
tables
;
show
open
tables
;
create
table
t1
(
n
int
);
insert
into
t1
values
(
1
);
show
open
tables
;
drop
table
t1
;
sql/mysql_priv.h
View file @
d80451c8
...
@@ -45,6 +45,7 @@ char *sql_strmake(const char *str,uint len);
...
@@ -45,6 +45,7 @@ char *sql_strmake(const char *str,uint len);
gptr
sql_memdup
(
const
void
*
ptr
,
unsigned
size
);
gptr
sql_memdup
(
const
void
*
ptr
,
unsigned
size
);
void
sql_element_free
(
void
*
ptr
);
void
sql_element_free
(
void
*
ptr
);
void
kill_one_thread
(
THD
*
thd
,
ulong
id
);
void
kill_one_thread
(
THD
*
thd
,
ulong
id
);
char
*
query_table_status
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
...
@@ -373,7 +374,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
...
@@ -373,7 +374,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
/* sql_list.c */
/* sql_list.c */
int
mysqld_show_dbs
(
THD
*
thd
,
const
char
*
wild
);
int
mysqld_show_dbs
(
THD
*
thd
,
const
char
*
wild
);
int
mysqld_show_open_tables
(
THD
*
thd
,
const
char
*
wild
);
int
mysqld_show_open_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
wild
);
int
mysqld_show_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
wild
);
int
mysqld_show_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
wild
);
int
mysqld_extend_show_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
wild
);
int
mysqld_extend_show_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
wild
);
int
mysqld_show_fields
(
THD
*
thd
,
TABLE_LIST
*
table
,
const
char
*
wild
,
int
mysqld_show_fields
(
THD
*
thd
,
TABLE_LIST
*
table
,
const
char
*
wild
,
...
@@ -450,7 +451,8 @@ bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
...
@@ -450,7 +451,8 @@ bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
void
copy_field_from_tmp_record
(
Field
*
field
,
int
offset
);
void
copy_field_from_tmp_record
(
Field
*
field
,
int
offset
);
int
fill_record
(
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
);
int
fill_record
(
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
);
int
fill_record
(
Field
**
field
,
List
<
Item
>
&
values
);
int
fill_record
(
Field
**
field
,
List
<
Item
>
&
values
);
OPEN_TABLE_LIST
*
list_open_tables
(
THD
*
thd
,
const
char
*
wild
);
int
list_open_tables
(
THD
*
thd
,
List
<
char
>
*
tables
,
const
char
*
db
,
const
char
*
wild
);
/* sql_calc.cc */
/* sql_calc.cc */
bool
eval_const_cond
(
COND
*
cond
);
bool
eval_const_cond
(
COND
*
cond
);
...
...
sql/sql_base.cc
View file @
d80451c8
...
@@ -34,8 +34,6 @@ HASH open_cache; /* Used by mysql_test */
...
@@ -34,8 +34,6 @@ HASH open_cache; /* Used by mysql_test */
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
const
char
*
db
,
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
const
char
*
db
,
const
char
*
name
,
const
char
*
alias
,
bool
locked
);
const
char
*
name
,
const
char
*
alias
,
bool
locked
);
static
bool
insert_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
const
char
*
db_name
,
const
char
*
table_name
,
List_iterator
<
Item
>
*
it
);
static
void
free_cache_entry
(
TABLE
*
entry
);
static
void
free_cache_entry
(
TABLE
*
entry
);
static
void
mysql_rm_tmp_tables
(
void
);
static
void
mysql_rm_tmp_tables
(
void
);
static
key_map
get_key_map_from_key_list
(
TABLE
*
table
,
static
key_map
get_key_map_from_key_list
(
TABLE
*
table
,
...
@@ -407,6 +405,47 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
...
@@ -407,6 +405,47 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
DBUG_RETURN
(
result
);
DBUG_RETURN
(
result
);
}
}
/* move one table to free list */
bool
close_thread_table
(
THD
*
thd
,
TABLE
**
table_ptr
)
{
DBUG_ENTER
(
"close_thread_table"
);
bool
found_old_table
=
0
;
TABLE
*
table
=*
table_ptr
;
*
table_ptr
=
table
->
next
;
if
(
table
->
version
!=
refresh_version
||
thd
->
version
!=
refresh_version
||
!
table
->
db_stat
)
{
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
table
));
found_old_table
=
1
;
}
else
{
if
(
table
->
flush_version
!=
flush_version
)
{
table
->
flush_version
=
flush_version
;
table
->
file
->
extra
(
HA_EXTRA_FLUSH
);
}
else
{
// Free memory and reset for next loop
table
->
file
->
extra
(
HA_EXTRA_RESET
);
}
table
->
in_use
=
0
;
if
(
unused_tables
)
{
table
->
next
=
unused_tables
;
/* Link in last */
table
->
prev
=
unused_tables
->
prev
;
unused_tables
->
prev
=
table
;
table
->
prev
->
next
=
table
;
}
else
unused_tables
=
table
->
next
=
table
->
prev
=
table
;
}
DBUG_RETURN
(
found_old_table
);
}
/* Put all tables used by thread in free list */
/* Put all tables used by thread in free list */
...
@@ -1832,7 +1871,7 @@ static key_map get_key_map_from_key_list(TABLE *table,
...
@@ -1832,7 +1871,7 @@ static key_map get_key_map_from_key_list(TABLE *table,
** Returns pointer to last inserted field if ok
** Returns pointer to last inserted field if ok
****************************************************************************/
****************************************************************************/
static
bool
bool
insert_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
const
char
*
db_name
,
insert_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
const
char
*
db_name
,
const
char
*
table_name
,
List_iterator
<
Item
>
*
it
)
const
char
*
table_name
,
List_iterator
<
Item
>
*
it
)
{
{
...
...
sql/sql_parse.cc
View file @
d80451c8
...
@@ -1819,6 +1819,7 @@ mysql_execute_command(void)
...
@@ -1819,6 +1819,7 @@ mysql_execute_command(void)
}
}
#endif
#endif
case
SQLCOM_SHOW_TABLES
:
case
SQLCOM_SHOW_TABLES
:
case
SQLCOM_SHOW_OPEN_TABLES
:
/* FALL THROUGH */
/* FALL THROUGH */
#ifdef DONT_ALLOW_SHOW_COMMANDS
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error
(
&
thd
->
net
,
ER_NOT_ALLOWED_COMMAND
);
/* purecov: inspected */
send_error
(
&
thd
->
net
,
ER_NOT_ALLOWED_COMMAND
);
/* purecov: inspected */
...
@@ -1840,7 +1841,10 @@ mysql_execute_command(void)
...
@@ -1840,7 +1841,10 @@ mysql_execute_command(void)
if
(
check_access
(
thd
,
SELECT_ACL
,
db
,
&
thd
->
col_access
))
if
(
check_access
(
thd
,
SELECT_ACL
,
db
,
&
thd
->
col_access
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
/* grant is checked in mysqld_show_tables */
/* grant is checked in mysqld_show_tables */
if
(
select_lex
->
options
&
SELECT_DESCRIBE
)
if
(
lex
->
sql_command
==
SQLCOM_SHOW_OPEN_TABLES
)
res
=
mysqld_show_open_tables
(
thd
,
db
,
(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
else
if
(
select_lex
->
options
&
SELECT_DESCRIBE
)
res
=
mysqld_extend_show_tables
(
thd
,
db
,
res
=
mysqld_extend_show_tables
(
thd
,
db
,
(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
else
else
...
@@ -1849,9 +1853,6 @@ mysql_execute_command(void)
...
@@ -1849,9 +1853,6 @@ mysql_execute_command(void)
break
;
break
;
}
}
#endif
#endif
case
SQLCOM_SHOW_OPEN_TABLES
:
res
=
mysqld_show_open_tables
(
thd
,(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
break
;
case
SQLCOM_SHOW_FIELDS
:
case
SQLCOM_SHOW_FIELDS
:
#ifdef DONT_ALLOW_SHOW_COMMANDS
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error
(
&
thd
->
net
,
ER_NOT_ALLOWED_COMMAND
);
/* purecov: inspected */
send_error
(
&
thd
->
net
,
ER_NOT_ALLOWED_COMMAND
);
/* purecov: inspected */
...
...
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