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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7fdc8c07
Commit
7fdc8c07
authored
Mar 25, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge lgrimmer@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/suse80/my/mysql-4.1
parents
f874d678
3cded4c9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
21 deletions
+79
-21
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+3
-0
sql/sql_show.cc
sql/sql_show.cc
+71
-19
sql/sql_string.cc
sql/sql_string.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-0
No files found.
sql/mysql_priv.h
View file @
7fdc8c07
...
...
@@ -528,6 +528,7 @@ int mysqld_show_variables(THD *thd,const char *wild);
int
mysqld_show
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
,
enum
enum_var_type
value_type
);
int
mysqld_show_charsets
(
THD
*
thd
,
const
char
*
wild
);
int
mysqld_show_collations
(
THD
*
thd
,
const
char
*
wild
);
int
mysqld_show_table_types
(
THD
*
thd
);
int
mysqld_show_privileges
(
THD
*
thd
);
int
mysqld_show_column_types
(
THD
*
thd
);
...
...
sql/sql_lex.h
View file @
7fdc8c07
...
...
@@ -52,7 +52,7 @@ enum enum_sql_command {
SQLCOM_SHOW_INNODB_STATUS
,
SQLCOM_SHOW_PROCESSLIST
,
SQLCOM_SHOW_MASTER_STAT
,
SQLCOM_SHOW_SLAVE_STAT
,
SQLCOM_SHOW_GRANTS
,
SQLCOM_SHOW_CREATE
,
SQLCOM_SHOW_CHARSETS
,
SQLCOM_SHOW_CREATE_DB
,
SQLCOM_SHOW_C
OLLATIONS
,
SQLCOM_SHOW_C
REATE_DB
,
SQLCOM_LOAD
,
SQLCOM_SET_OPTION
,
SQLCOM_LOCK_TABLES
,
SQLCOM_UNLOCK_TABLES
,
SQLCOM_GRANT
,
...
...
sql/sql_parse.cc
View file @
7fdc8c07
...
...
@@ -2566,6 +2566,9 @@ mysql_execute_command(THD *thd)
case
SQLCOM_SHOW_CHARSETS
:
res
=
mysqld_show_charsets
(
thd
,(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
break
;
case
SQLCOM_SHOW_COLLATIONS
:
res
=
mysqld_show_collations
(
thd
,(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
));
break
;
case
SQLCOM_SHOW_FIELDS
:
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error
(
thd
,
ER_NOT_ALLOWED_COMMAND
);
/* purecov: inspected */
...
...
sql/sql_show.cc
View file @
7fdc8c07
...
...
@@ -1414,7 +1414,22 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
Status functions
*****************************************************************************/
int
mysqld_show_charsets
(
THD
*
thd
,
const
char
*
wild
)
static
bool
write_collation
(
Protocol
*
protocol
,
CHARSET_INFO
*
cs
)
{
char
flags
[
4
];
protocol
->
prepare_for_resend
();
protocol
->
store
(
cs
->
csname
,
system_charset_info
);
protocol
->
store
(
cs
->
name
,
system_charset_info
);
protocol
->
store_short
((
longlong
)
cs
->
number
);
flags
[
0
]
=
'\0'
;
if
(
cs
->
state
&
MY_CS_PRIMARY
)
strcat
(
flags
,
"def"
);
protocol
->
store
(
flags
,
system_charset_info
);
protocol
->
store_short
((
longlong
)
cs
->
strxfrm_multiply
);
return
protocol
->
write
();
}
int
mysqld_show_collations
(
THD
*
thd
,
const
char
*
wild
)
{
char
buff
[
8192
];
String
packet2
(
buff
,
sizeof
(
buff
),
thd
->
charset
());
...
...
@@ -1425,32 +1440,69 @@ int mysqld_show_charsets(THD *thd, const char *wild)
DBUG_ENTER
(
"mysqld_show_charsets"
);
field_list
.
push_back
(
new
Item_empty_string
(
"C
S_Name
"
,
30
));
field_list
.
push_back
(
new
Item_empty_string
(
"C
OL_Name
"
,
30
));
field_list
.
push_back
(
new
Item_empty_string
(
"C
harset
"
,
30
));
field_list
.
push_back
(
new
Item_empty_string
(
"C
ollation
"
,
30
));
field_list
.
push_back
(
new
Item_return_int
(
"Id"
,
11
,
FIELD_TYPE_SHORT
));
field_list
.
push_back
(
new
Item_empty_string
(
"Flags"
,
30
));
field_list
.
push_back
(
new
Item_return_int
(
"strx_maxlen"
,
3
,
FIELD_TYPE_TINY
));
field_list
.
push_back
(
new
Item_return_int
(
"mb_maxlen"
,
3
,
FIELD_TYPE_TINY
));
field_list
.
push_back
(
new
Item_return_int
(
"strx_maxlen"
,
3
,
FIELD_TYPE_SHORT
));
if
(
protocol
->
send_fields
(
&
field_list
,
1
))
DBUG_RETURN
(
1
);
for
(
cs
=
all_charsets
;
cs
<
all_charsets
+
255
;
cs
++
)
for
(
cs
=
all_charsets
;
cs
<
all_charsets
+
255
;
cs
++
)
{
CHARSET_INFO
**
cl
;
for
(
cl
=
all_charsets
;
cl
<
all_charsets
+
255
;
cl
++
)
{
if
(
!
cs
[
0
]
||
!
cl
[
0
]
||
!
my_charset_same
(
cs
[
0
],
cl
[
0
])
||
!
(
cs
[
0
]
->
state
&
MY_CS_PRIMARY
))
continue
;
if
(
cs
[
0
]
&&
!
(
wild
&&
wild
[
0
]
&&
wild_case_compare
(
system_charset_info
,
c
s
[
0
]
->
name
,
wild
)))
wild_case_compare
(
system_charset_info
,
c
l
[
0
]
->
name
,
wild
)))
{
if
(
write_collation
(
protocol
,
cl
[
0
]))
goto
err
;
}
}
}
send_eof
(
thd
);
DBUG_RETURN
(
0
);
err:
DBUG_RETURN
(
1
);
}
static
bool
write_charset
(
Protocol
*
protocol
,
CHARSET_INFO
*
cs
)
{
protocol
->
prepare_for_resend
();
protocol
->
store
(
cs
[
0
]
->
csname
,
system_charset_info
);
protocol
->
store
(
cs
[
0
]
->
name
,
system_charset_info
);
protocol
->
store_short
((
longlong
)
cs
[
0
]
->
number
);
flags
[
0
]
=
'\0'
;
if
(
cs
[
0
]
->
state
&
MY_CS_PRIMARY
)
strcat
(
flags
,
"pri"
);
protocol
->
store
(
flags
,
system_charset_info
);
protocol
->
store_tiny
((
longlong
)
cs
[
0
]
->
strxfrm_multiply
);
protocol
->
store_tiny
((
longlong
)
cs
[
0
]
->
mbmaxlen
);
if
(
protocol
->
write
())
protocol
->
store
(
cs
->
csname
,
system_charset_info
);
protocol
->
store
(
cs
->
name
,
system_charset_info
);
protocol
->
store_short
((
longlong
)
cs
->
mbmaxlen
);
return
protocol
->
write
();
}
int
mysqld_show_charsets
(
THD
*
thd
,
const
char
*
wild
)
{
char
buff
[
8192
];
String
packet2
(
buff
,
sizeof
(
buff
),
thd
->
charset
());
List
<
Item
>
field_list
;
CHARSET_INFO
**
cs
;
Protocol
*
protocol
=
thd
->
protocol
;
char
flags
[
64
];
DBUG_ENTER
(
"mysqld_show_charsets"
);
field_list
.
push_back
(
new
Item_empty_string
(
"Charset"
,
30
));
field_list
.
push_back
(
new
Item_empty_string
(
"Default collation"
,
60
));
field_list
.
push_back
(
new
Item_return_int
(
"Maxlen"
,
3
,
FIELD_TYPE_SHORT
));
if
(
protocol
->
send_fields
(
&
field_list
,
1
))
DBUG_RETURN
(
1
);
for
(
cs
=
all_charsets
;
cs
<
all_charsets
+
255
;
cs
++
)
{
if
(
cs
[
0
]
&&
(
cs
[
0
]
->
state
&
MY_CS_PRIMARY
)
&&
!
(
wild
&&
wild
[
0
]
&&
wild_case_compare
(
system_charset_info
,
cs
[
0
]
->
name
,
wild
)))
{
if
(
write_charset
(
protocol
,
cs
[
0
]))
goto
err
;
}
}
...
...
sql/sql_string.cc
View file @
7fdc8c07
...
...
@@ -30,7 +30,7 @@
CHARSET_INFO
*
system_charset_info
=
&
my_charset_utf8
;
CHARSET_INFO
*
files_charset_info
=
&
my_charset_utf8
;
CHARSET_INFO
*
national_charset_info
=
&
my_charset_
utf8
;
CHARSET_INFO
*
national_charset_info
=
&
my_charset_
latin1
;
extern
gptr
sql_alloc
(
unsigned
size
);
extern
void
sql_element_free
(
void
*
ptr
);
...
...
sql/sql_yacc.yy
View file @
7fdc8c07
...
...
@@ -3578,6 +3578,8 @@ show_param:
}
| charset wild
{ Lex->sql_command= SQLCOM_SHOW_CHARSETS; }
| COLLATION_SYM wild
{ Lex->sql_command= SQLCOM_SHOW_COLLATIONS; }
| LOGS_SYM
{ Lex->sql_command= SQLCOM_SHOW_LOGS; }
| GRANTS FOR_SYM user
...
...
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