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
1154dace
Commit
1154dace
authored
Dec 18, 2000
by
tim@cane.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
8dc9ddf9
70d4d0ba
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
248 additions
and
92 deletions
+248
-92
.bzrignore
.bzrignore
+1
-0
BUILD/FINISH.sh
BUILD/FINISH.sh
+8
-0
BUILD/SETUP.sh
BUILD/SETUP.sh
+43
-0
BUILD/compile-alpha
BUILD/compile-alpha
+8
-6
BUILD/compile-pentium
BUILD/compile-pentium
+8
-7
BUILD/compile-pentium-debug
BUILD/compile-pentium-debug
+6
-18
BUILD/compile-pentium-debug-no-bdb
BUILD/compile-pentium-debug-no-bdb
+6
-16
BUILD/compile-pentium-gcov
BUILD/compile-pentium-gcov
+6
-15
BUILD/compile-pentium-myodbc
BUILD/compile-pentium-myodbc
+10
-4
BUILD/compile-solaris-sparc
BUILD/compile-solaris-sparc
+8
-8
BUILD/compile-solaris-sparc-purify
BUILD/compile-solaris-sparc-purify
+7
-11
Docs/manual.texi
Docs/manual.texi
+5
-1
sql/gen_lex_hash.cc
sql/gen_lex_hash.cc
+1
-1
sql/lex.h
sql/lex.h
+1
-0
sql/mysql_priv.h
sql/mysql_priv.h
+3
-0
sql/sql_base.cc
sql/sql_base.cc
+68
-0
sql/sql_lex.h
sql/sql_lex.h
+2
-1
sql/sql_parse.cc
sql/sql_parse.cc
+7
-2
sql/sql_show.cc
sql/sql_show.cc
+43
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+7
-0
No files found.
.bzrignore
View file @
1154dace
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
.gdb_history
.gdb_history
.libs
.libs
.o
.o
db-*.*.*
BitKeeper/etc/config
BitKeeper/etc/config
BitKeeper/etc/csets
BitKeeper/etc/csets
BitKeeper/etc/csets-in
BitKeeper/etc/csets-in
...
...
BUILD/FINISH.sh
0 → 100644
View file @
1154dace
cflags
=
"
$c_warnings
$extra_flags
"
cxxflags
=
"
$cxx_warnings
$base_cxxflags
$extra_flags
"
configure
=
"./configure
$base_configs
$extra_configs
"
CFLAGS
=
"
$cflags
"
CXX
=
gcc
CXXFLAGS
=
"
$cxxflags
"
eval
"
$configure
"
test
"
$make
"
=
no
||
$make
$AM_MAKEFLAGS
test
-z
"
$strip
"
||
strip mysqld
BUILD/SETUP.sh
0 → 100644
View file @
1154dace
if
!
test
-f
sql/mysqld.cc
;
then
echo
"You must run this script from the MySQL top-level directory"
exit
1
fi
set
-e
# exit on error
AM_MAKEFLAGS
=
"-j4"
# XXX: auto-make uses this variable - export it???
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
# The following warning flag will give too many warnings:
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
# __attribute()__ doesn't work with gnu C++)
global_warnings
=
"-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wuninitialized -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings"
c_warnings
=
"
$global_warnings
-Wunused"
cxx_warnings
=
"
$global_warnings
-Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
alpha_cflags
=
"-mcpu=ev6 -Wa,-mev6"
# not used yet
pentium_cflags
=
"-mpentiumpro"
sparc_cflags
=
""
fast_cflags
=
"-O6 -fomit-frame-pointer"
debug_cflags
=
"-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2"
base_cxxflags
=
"-felide-constructors -fno-exceptions -fno-rtti"
base_configs
=
"--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --disable-shared"
alpha_configs
=
""
# not used yet
pentium_configs
=
""
sparc_configs
=
""
debug_configs
=
"--with-debug"
if
gmake
--version
>
/dev/null 2>&1
;
then
make
=
gmake
else
make
=
make
fi
$make
-k
clean
||
true
/bin/rm
-f
*
/.deps/
*
.P config.cache
aclocal
;
autoheader
;
aclocal
;
automake
;
autoconf
BUILD/compile-alpha
View file @
1154dace
make -k clean
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f config.cache
aclocal; autoheader; aclocal; automake; autoconf
CFLAGS="-O6 -fomit-frame-pointer -mcpu=ev6 -Wa,-mev6" CXX=gcc CXXFLAGS="-O6 -mcpu=ev6 -Wa,-mev6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex
path
=
`
dirname
$0
`
make
.
"
$path
/SETUP.sh"
extra_flags
=
"
$alpha_cflags
$fast_cflags
"
extra_configs
=
"
$alpha_configs
"
.
"
$path
/FINISH.sh"
BUILD/compile-pentium
View file @
1154dace
AM_MAKEFLAGS="-j 2"
#! /bin/sh
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --enable-thread-safe-client "$@"
extra_flags
=
"
$pentium_cflags
$fast_cflags
"
make -j 2
extra_configs
=
"
$pentium_configs
"
strip sql/mysqld
strip
=
yes
.
"
$path
/FINISH.sh"
BUILD/compile-pentium-debug
View file @
1154dace
AM_MAKEFLAGS="-j 2"
#! /bin/sh
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
extra_flags
=
"
$pentium_cflags
$debug_cflags
"
# The following warning flag will give too many warnings:
extra_configs
=
"
$pentium_configs
$debug_configs
"
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
# __attribute()__ doesn't work with gnu C++)
GLOBAL_WARNINGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wuninitialized -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings"
.
"
$path
/FINISH.sh"
C_WARNINGS="$GLOBAL_WARNINGS -Wunused"
CC_WARNINGS="$GLOBAL_WARNINGS -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
CFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro $C_WARNINGS" CXX=gcc \
CXXFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full \
--with-berkeley-db=/usr/local/BerkeleyDB
make -j 2
BUILD/compile-pentium-debug-no-bdb
View file @
1154dace
make -k clean
#! /bin/sh
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
extra_flags
=
"
$pentium_cflags
$debug_cflags
"
# The following warning flag will give too many warnings:
extra_configs
=
"
$pentium_configs
$debug_configs
--without-berkeley-db"
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
# __attribute()__ doesn't work with gnu C++)
GLOBAL_WARNINGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wuninitialized -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings"
.
"
$path
/FINISH.sh"
C_WARNINGS="$GLOBAL_WARNINGS -Wunused"
CC_WARNINGS="$GLOBAL_WARNINGS -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
CFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro $C_WARNINGS" CXX=gcc \
CXXFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full
make
BUILD/compile-pentium-gcov
View file @
1154dace
AM_MAKEFLAGS="-j 2"
#! /bin/sh
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
extra_flags
=
"
$pentium_cflags
-O2 -fprofile-arcs -ftest-coverage"
# The following warning flag will give too many warnings:
extra_configs
=
"
$pentium_configs
$debug_configs
"
# -Wshadow -Wunused (The later isn't usable in C++ as
# __attribute()__ doesn't work with gnu C++)
GLOBAL_WARNINGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wuninitialized -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings"
C_WARNINGS="$GLOBAL_WARNINGS -Wunused"
CC_WARNINGS="$GLOBAL_WARNINGS -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
CFLAGS="-O2 -mpentiumpro -fprofile-arcs -ftest-coverage $C_WARNINGS" CXX=gcc CXXFLAGS="-O2 -mpentiumpro -fprofile-arcs -ftest-coverage -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full
make -j 2
.
"
$path
/FINISH.sh"
BUILD/compile-pentium-myodbc
View file @
1154dace
make -k clean
#! /bin/sh
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-extra-charsets=complex --without-server
extra_flags
=
"
$pentium_cflags
$fast_cflags
"
extra_configs
=
"
$pentium_configs
--without-server"
make
=
no
strip
=
yes
.
"
$path
/FINISH.sh"
BUILD/compile-solaris-sparc
View file @
1154dace
gmake -k clean
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f config.cache
aclocal; autoheader; aclocal; automake; autoconf
CFLAGS="-O6 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -f
path
=
`
dirname
$0
`
elide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/m
.
"
$path
/SETUP.sh"
ysql --with-extra-charsets=complex
gmake
extra_flags
=
"
$sparc_cflags
$fast_cflags
"
extra_configs
=
"
$sparc_configs
"
.
"
$path
/FINISH.sh"
BUILD/compile-solaris-sparc-purify
View file @
1154dace
gmake -k clean
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f config.cache
aclocal; autoheader; aclocal; automake; autoconf
GLOBAL_WARNINGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wuninitialized -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings"
path
=
`
dirname
$0
`
C_WARNINGS="$GLOBAL_WARNINGS -Wunused"
.
"
$path
/SETUP.sh"
CC_WARNINGS="$GLOBAL_WARNINGS -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
CFLAGS="-DHAVE_PURIFY -O2 $C_WARNINGS" CXX=gcc \
extra_flags
=
"
$sparc_cflags
-DHAVE_PURIFY -O2"
CXXFLAGS="-DHAVE_PURIFY -O2 -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \
extra_configs
=
"
$sparc_configs
--with-debug=full"
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-debug=full
gmake
.
"
$path
/FINISH.sh"
Docs/manual.texi
View file @
1154dace
...
@@ -19894,7 +19894,7 @@ commands to examine and kill threads.
...
@@ -19894,7 +19894,7 @@ commands to examine and kill threads.
@example
@example
SHOW DATABASES [LIKE wild]
SHOW DATABASES [LIKE wild]
or SHOW TABLES [FROM db_name] [LIKE wild]
or SHOW
[OPEN]
TABLES [FROM db_name] [LIKE wild]
or SHOW COLUMNS FROM tbl_name [FROM db_name] [LIKE wild]
or SHOW COLUMNS FROM tbl_name [FROM db_name] [LIKE wild]
or SHOW INDEX FROM tbl_name [FROM db_name]
or SHOW INDEX FROM tbl_name [FROM db_name]
or SHOW TABLE STATUS [FROM db_name] [LIKE wild]
or SHOW TABLE STATUS [FROM db_name] [LIKE wild]
...
@@ -19950,6 +19950,10 @@ get this list using the @code{mysqlshow db_name} command.
...
@@ -19950,6 +19950,10 @@ get this list using the @code{mysqlshow db_name} command.
will not show up in the output from @code{SHOW TABLES} or @code{mysqlshow
will not show up in the output from @code{SHOW TABLES} or @code{mysqlshow
db_name}.
db_name}.
@code{SHOW OPEN TABLES} lists the tables that are currently open in
the table cache. @xref{Table cache}. The @code{Comment} field tells
how many times the table is @code{cached} and @code{in_use}.
@code{SHOW COLUMNS} lists the columns in a given table. If the column
@code{SHOW COLUMNS} lists the columns in a given table. If the column
types are different than you expect them to be based on a @code{CREATE
types are different than you expect them to be based on a @code{CREATE
TABLE} statement, note that @strong{MySQL} sometimes changes column
TABLE} statement, note that @strong{MySQL} sometimes changes column
sql/gen_lex_hash.cc
View file @
1154dace
...
@@ -472,7 +472,7 @@ int main(int argc,char **argv)
...
@@ -472,7 +472,7 @@ int main(int argc,char **argv)
int
error
;
int
error
;
MY_INIT
(
argv
[
0
]);
MY_INIT
(
argv
[
0
]);
start_value
=
2610463L
;
best_t1
=
8358376L
;
best_t2
=
860646L
;
best_type
=
2
;
/* mode=4111 add=8
func_type: 0 */
start_value
=
5206280L
;
best_t1
=
590774L
;
best_t2
=
5977654L
;
best_type
=
1
;
/* mode=6229 add=2
func_type: 0 */
if
(
get_options
(
argc
,(
char
**
)
argv
))
if
(
get_options
(
argc
,(
char
**
)
argv
))
exit
(
1
);
exit
(
1
);
...
...
sql/lex.h
View file @
1154dace
...
@@ -223,6 +223,7 @@ static SYMBOL symbols[] = {
...
@@ -223,6 +223,7 @@ static SYMBOL symbols[] = {
{
"NOT"
,
SYM
(
NOT
),
0
,
0
},
{
"NOT"
,
SYM
(
NOT
),
0
,
0
},
{
"NULL"
,
SYM
(
NULL_SYM
),
0
,
0
},
{
"NULL"
,
SYM
(
NULL_SYM
),
0
,
0
},
{
"ON"
,
SYM
(
ON
),
0
,
0
},
{
"ON"
,
SYM
(
ON
),
0
,
0
},
{
"OPEN"
,
SYM
(
OPEN_SYM
),
0
,
0
},
{
"OPTIMIZE"
,
SYM
(
OPTIMIZE
),
0
,
0
},
{
"OPTIMIZE"
,
SYM
(
OPTIMIZE
),
0
,
0
},
{
"OPTION"
,
SYM
(
OPTION
),
0
,
0
},
{
"OPTION"
,
SYM
(
OPTION
),
0
,
0
},
{
"OPTIONALLY"
,
SYM
(
OPTIONALLY
),
0
,
0
},
{
"OPTIONALLY"
,
SYM
(
OPTIONALLY
),
0
,
0
},
...
...
sql/mysql_priv.h
View file @
1154dace
...
@@ -354,6 +354,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
...
@@ -354,6 +354,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
*
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
);
...
@@ -418,6 +419,8 @@ bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
...
@@ -418,6 +419,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
);
int
list_open_tables
(
THD
*
thd
,
List
<
char
>
*
files
,
const
char
*
db
,
const
char
*
wild
);
char
*
query_table_status
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
/* sql_calc.cc */
/* sql_calc.cc */
bool
eval_const_cond
(
COND
*
cond
);
bool
eval_const_cond
(
COND
*
cond
);
...
...
sql/sql_base.cc
View file @
1154dace
...
@@ -112,6 +112,74 @@ static void check_unused(void)
...
@@ -112,6 +112,74 @@ static void check_unused(void)
#define check_unused()
#define check_unused()
#endif
#endif
int
list_open_tables
(
THD
*
thd
,
List
<
char
>
*
tables
,
const
char
*
db
,
const
char
*
wild
)
{
int
result
=
0
;
uint
col_access
=
thd
->
col_access
;
TABLE_LIST
table_list
;
DBUG_ENTER
(
"list_open_tables"
);
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
bzero
((
char
*
)
&
table_list
,
sizeof
(
table_list
));
for
(
uint
idx
=
0
;
result
==
0
&&
idx
<
open_cache
.
records
;
idx
++
)
{
TABLE
*
entry
=
(
TABLE
*
)
hash_element
(
&
open_cache
,
idx
);
if
((
!
entry
->
real_name
)
||
strcmp
(
entry
->
table_cache_key
,
db
))
continue
;
if
(
wild
&&
wild
[
0
]
&&
wild_compare
(
entry
->
real_name
,
wild
))
continue
;
if
(
db
&&
!
(
col_access
&
TABLE_ACLS
))
{
table_list
.
db
=
(
char
*
)
db
;
table_list
.
real_name
=
entry
->
real_name
;
/*real name*/
table_list
.
grant
.
privilege
=
col_access
;
if
(
check_grant
(
thd
,
TABLE_ACLS
,
&
table_list
,
1
))
continue
;
}
/* need to check if he have't already listed it */
List_iterator
<
char
>
it
(
*
tables
);
char
*
table_name
;
int
check
=
0
;
while
(
check
==
0
&&
(
table_name
=
it
++
))
{
if
(
!
strcmp
(
table_name
,
entry
->
real_name
))
check
++
;
}
if
(
check
)
continue
;
if
(
tables
->
push_back
(
thd
->
strdup
(
entry
->
real_name
)))
{
result
=
-
1
;
}
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
DBUG_RETURN
(
result
);
}
char
*
query_table_status
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
)
{
int
cached
=
0
,
in_use
=
0
;
char
info
[
256
];
for
(
uint
idx
=
0
;
idx
<
open_cache
.
records
;
idx
++
)
{
TABLE
*
entry
=
(
TABLE
*
)
hash_element
(
&
open_cache
,
idx
);
if
(
strcmp
(
entry
->
table_cache_key
,
db
)
||
strcmp
(
entry
->
real_name
,
table_name
))
continue
;
cached
++
;
if
(
entry
->
in_use
)
in_use
++
;
}
sprintf
(
info
,
"cached=%d, in_use=%d"
,
cached
,
in_use
);
return
thd
->
strdup
(
info
);
}
/******************************************************************************
/******************************************************************************
...
...
sql/sql_lex.h
View file @
1154dace
...
@@ -52,7 +52,8 @@ enum enum_sql_command {
...
@@ -52,7 +52,8 @@ enum enum_sql_command {
SQLCOM_ROLLBACK
,
SQLCOM_COMMIT
,
SQLCOM_SLAVE_START
,
SQLCOM_SLAVE_STOP
,
SQLCOM_ROLLBACK
,
SQLCOM_COMMIT
,
SQLCOM_SLAVE_START
,
SQLCOM_SLAVE_STOP
,
SQLCOM_BEGIN
,
SQLCOM_LOAD_MASTER_TABLE
,
SQLCOM_CHANGE_MASTER
,
SQLCOM_BEGIN
,
SQLCOM_LOAD_MASTER_TABLE
,
SQLCOM_CHANGE_MASTER
,
SQLCOM_RENAME_TABLE
,
SQLCOM_BACKUP_TABLE
,
SQLCOM_RESTORE_TABLE
,
SQLCOM_RENAME_TABLE
,
SQLCOM_BACKUP_TABLE
,
SQLCOM_RESTORE_TABLE
,
SQLCOM_RESET
,
SQLCOM_PURGE
,
SQLCOM_SHOW_BINLOGS
SQLCOM_RESET
,
SQLCOM_PURGE
,
SQLCOM_SHOW_BINLOGS
,
SQLCOM_SHOW_OPEN_TABLES
};
};
enum
lex_states
{
STATE_START
,
STATE_CHAR
,
STATE_IDENT
,
enum
lex_states
{
STATE_START
,
STATE_CHAR
,
STATE_IDENT
,
...
...
sql/sql_parse.cc
View file @
1154dace
...
@@ -1488,6 +1488,8 @@ mysql_execute_command(void)
...
@@ -1488,6 +1488,8 @@ mysql_execute_command(void)
}
}
#endif
#endif
case
SQLCOM_SHOW_TABLES
:
case
SQLCOM_SHOW_TABLES
:
/* FALL THROUGH */
case
SQLCOM_SHOW_OPEN_TABLES
:
#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 */
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -1508,8 +1510,11 @@ mysql_execute_command(void)
...
@@ -1508,8 +1510,11 @@ 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
(
lex
->
options
&
SELECT_DESCRIBE
)
if
(
lex
->
sql_command
==
SQLCOM_SHOW_OPEN_TABLES
)
res
=
mysqld_extend_show_tables
(
thd
,
db
,
res
=
mysqld_show_open_tables
(
thd
,
db
,
(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
else
if
(
lex
->
options
&
SELECT_DESCRIBE
)
res
=
mysqld_extend_show_tables
(
thd
,
db
,
(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
else
else
res
=
mysqld_show_tables
(
thd
,
db
,
res
=
mysqld_show_tables
(
thd
,
db
,
...
...
sql/sql_show.cc
View file @
1154dace
...
@@ -86,6 +86,47 @@ mysqld_show_dbs(THD *thd,const char *wild)
...
@@ -86,6 +86,47 @@ mysqld_show_dbs(THD *thd,const char *wild)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
/***************************************************************************
** List all open tables in a database
***************************************************************************/
int
mysqld_show_open_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
wild
)
{
Item_string
*
field
=
new
Item_string
(
""
,
0
);
List
<
Item
>
field_list
;
char
*
end
,
*
table_name
;
List
<
char
>
tables
;
DBUG_ENTER
(
"mysqld_show_open_tables"
);
field
->
name
=
(
char
*
)
thd
->
alloc
(
20
+
(
uint
)
strlen
(
db
)
+
(
wild
?
(
uint
)
strlen
(
wild
)
+
4
:
0
));
end
=
strxmov
(
field
->
name
,
"Open_tables_in_"
,
db
,
NullS
);
if
(
wild
&&
wild
[
0
])
strxmov
(
end
,
" ("
,
wild
,
")"
,
NullS
);
field
->
max_length
=
NAME_LEN
;
field_list
.
push_back
(
field
);
field_list
.
push_back
(
new
Item_empty_string
(
"Comment"
,
80
));
if
(
send_fields
(
thd
,
field_list
,
1
))
DBUG_RETURN
(
1
);
if
(
list_open_tables
(
thd
,
&
tables
,
db
,
wild
))
DBUG_RETURN
(
-
1
);
List_iterator
<
char
>
it
(
tables
);
while
((
table_name
=
it
++
))
{
thd
->
packet
.
length
(
0
);
net_store_data
(
&
thd
->
packet
,
table_name
);
net_store_data
(
&
thd
->
packet
,
query_table_status
(
thd
,
db
,
table_name
));
if
(
my_net_write
(
&
thd
->
net
,(
char
*
)
thd
->
packet
.
ptr
(),
thd
->
packet
.
length
()))
DBUG_RETURN
(
-
1
);
}
send_eof
(
&
thd
->
net
);
DBUG_RETURN
(
0
);
}
/***************************************************************************
/***************************************************************************
** List all tables in a database (fast version)
** List all tables in a database (fast version)
** A table is a .frm file in the current databasedir
** A table is a .frm file in the current databasedir
...
@@ -161,9 +202,9 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
...
@@ -161,9 +202,9 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
}
}
else
else
{
{
// Return only .frm files which
is
n't temp files.
// Return only .frm files which
are
n't temp files.
if
(
my_strcasecmp
(
ext
=
fn_ext
(
file
->
name
),
reg_ext
)
||
if
(
my_strcasecmp
(
ext
=
fn_ext
(
file
->
name
),
reg_ext
)
||
is_prefix
(
file
->
name
,
tmp_file_prefix
))
// Mysql temp table
is_prefix
(
file
->
name
,
tmp_file_prefix
))
continue
;
continue
;
*
ext
=
0
;
*
ext
=
0
;
if
(
wild
&&
wild
[
0
]
&&
wild_compare
(
file
->
name
,
wild
))
if
(
wild
&&
wild
[
0
]
&&
wild_compare
(
file
->
name
,
wild
))
...
...
sql/sql_yacc.yy
View file @
1154dace
...
@@ -216,6 +216,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -216,6 +216,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NULL_SYM
%token NULL_SYM
%token NUM
%token NUM
%token ON
%token ON
%token OPEN_SYM
%token OPTION
%token OPTION
%token OPTIONALLY
%token OPTIONALLY
%token OR
%token OR
...
@@ -2151,6 +2152,11 @@ show_param:
...
@@ -2151,6 +2152,11 @@ show_param:
Lex->options|= SELECT_DESCRIBE;
Lex->options|= SELECT_DESCRIBE;
Lex->db= $3;
Lex->db= $3;
}
}
| OPEN_SYM TABLES opt_db wild
{ Lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
Lex->db= $3;
Lex->options=0;
}
| COLUMNS FROM table_ident opt_db wild
| COLUMNS FROM table_ident opt_db wild
{
{
Lex->sql_command= SQLCOM_SHOW_FIELDS;
Lex->sql_command= SQLCOM_SHOW_FIELDS;
...
@@ -2513,6 +2519,7 @@ keyword:
...
@@ -2513,6 +2519,7 @@ keyword:
| NATIONAL_SYM {}
| NATIONAL_SYM {}
| NCHAR_SYM {}
| NCHAR_SYM {}
| NO_SYM {}
| NO_SYM {}
| OPEN_SYM {}
| PACK_KEYS_SYM {}
| PACK_KEYS_SYM {}
| PASSWORD {}
| PASSWORD {}
| PROCESS {}
| PROCESS {}
...
...
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