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
2d714129
Commit
2d714129
authored
Feb 17, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
merging
parents
ca417a74
36a0a13d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
5 deletions
+136
-5
client/client_priv.h
client/client_priv.h
+2
-1
client/mysqlcheck.c
client/mysqlcheck.c
+60
-4
mysql-test/r/upgrade.result
mysql-test/r/upgrade.result
+43
-0
mysql-test/t/disabled.def
mysql-test/t/disabled.def
+3
-0
mysql-test/t/upgrade.test
mysql-test/t/upgrade.test
+28
-0
No files found.
client/client_priv.h
View file @
2d714129
...
...
@@ -59,5 +59,6 @@ enum options_client
OPT_MYSQL_PRESERVE_SCHEMA
,
OPT_IGNORE_TABLE
,
OPT_INSERT_IGNORE
,
OPT_SHOW_WARNINGS
,
OPT_DROP_DATABASE
,
OPT_TZ_UTC
,
OPT_AUTO_CLOSE
,
OPT_CREATE_SLAP_SCHEMA
,
OPT_MYSQL_REPLACE_INTO
,
OPT_BASE64_OUTPUT
,
OPT_SERVER_ID
OPT_MYSQL_REPLACE_INTO
,
OPT_BASE64_OUTPUT
,
OPT_SERVER_ID
,
OPT_FIX_TABLE_NAMES
,
OPT_FIX_DB_NAMES
};
client/mysqlcheck.c
View file @
2d714129
...
...
@@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress
=
0
,
opt_databases
=
0
,
opt_fast
=
0
,
opt_medium_check
=
0
,
opt_quick
=
0
,
opt_all_in_1
=
0
,
opt_silent
=
0
,
opt_auto_repair
=
0
,
ignore_errors
=
0
,
tty_password
=
0
,
opt_frm
=
0
,
opt_upgrade
=
0
;
tty_password
=
0
,
opt_frm
=
0
,
opt_fix_table_names
=
0
,
opt_fix_db_names
=
0
,
opt_upgrade
=
0
;
static
uint
verbose
=
0
,
opt_mysql_port
=
0
;
static
my_string
opt_mysql_unix_port
=
0
;
static
char
*
opt_password
=
0
,
*
current_user
=
0
,
...
...
@@ -48,7 +49,7 @@ static char *shared_memory_base_name=0;
static
uint
opt_protocol
=
0
;
static
CHARSET_INFO
*
charset_info
=
&
my_charset_latin1
;
enum
operations
{
DO_CHECK
,
DO_REPAIR
,
DO_ANALYZE
,
DO_OPTIMIZE
};
enum
operations
{
DO_CHECK
,
DO_REPAIR
,
DO_ANALYZE
,
DO_OPTIMIZE
,
DO_UPGRADE
};
static
struct
my_option
my_long_options
[]
=
{
...
...
@@ -101,6 +102,12 @@ static struct my_option my_long_options[] =
{
"fast"
,
'F'
,
"Check only tables that haven't been closed properly."
,
(
gptr
*
)
&
opt_fast
,
(
gptr
*
)
&
opt_fast
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"fix-db-names"
,
OPT_FIX_DB_NAMES
,
"Fix database names."
,
(
gptr
*
)
&
opt_fix_db_names
,
(
gptr
*
)
&
opt_fix_db_names
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"fix-table-names"
,
OPT_FIX_TABLE_NAMES
,
"Fix table names."
,
(
gptr
*
)
&
opt_fix_table_names
,
(
gptr
*
)
&
opt_fix_table_names
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"force"
,
'f'
,
"Continue even if we get an sql-error."
,
(
gptr
*
)
&
ignore_errors
,
(
gptr
*
)
&
ignore_errors
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
...
@@ -174,6 +181,7 @@ static int process_all_databases();
static
int
process_databases
(
char
**
db_names
);
static
int
process_selected_tables
(
char
*
db
,
char
**
table_names
,
int
tables
);
static
int
process_all_tables_in_db
(
char
*
database
);
static
int
process_one_db
(
char
*
database
);
static
int
use_db
(
char
*
database
);
static
int
handle_request_for_tables
(
char
*
tables
,
uint
length
);
static
int
dbConnect
(
char
*
host
,
char
*
user
,
char
*
passwd
);
...
...
@@ -254,6 +262,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case
'o'
:
what_to_do
=
DO_OPTIMIZE
;
break
;
case
OPT_FIX_DB_NAMES
:
what_to_do
=
DO_UPGRADE
;
default_charset
=
(
char
*
)
"utf8"
;
opt_databases
=
1
;
break
;
case
OPT_FIX_TABLE_NAMES
:
what_to_do
=
DO_UPGRADE
;
default_charset
=
(
char
*
)
"utf8"
;
break
;
case
'p'
:
if
(
argument
)
{
...
...
@@ -376,7 +393,7 @@ static int process_all_databases()
}
while
((
row
=
mysql_fetch_row
(
tableres
)))
{
if
(
process_
all_tables_in
_db
(
row
[
0
]))
if
(
process_
one
_db
(
row
[
0
]))
result
=
1
;
}
return
result
;
...
...
@@ -389,7 +406,7 @@ static int process_databases(char **db_names)
int
result
=
0
;
for
(
;
*
db_names
;
db_names
++
)
{
if
(
process_
all_tables_in
_db
(
*
db_names
))
if
(
process_
one
_db
(
*
db_names
))
result
=
1
;
}
return
result
;
...
...
@@ -502,6 +519,43 @@ static int process_all_tables_in_db(char *database)
}
/* process_all_tables_in_db */
static
int
fix_object_name
(
const
char
*
obj
,
const
char
*
name
)
{
char
qbuf
[
100
+
NAME_LEN
*
4
];
int
rc
=
0
;
if
(
strncmp
(
name
,
"#mysql50#"
,
9
))
return
1
;
sprintf
(
qbuf
,
"RENAME %s `%s` TO `%s`"
,
obj
,
name
,
name
+
9
);
if
(
mysql_query
(
sock
,
qbuf
))
{
fprintf
(
stderr
,
"Failed to %s
\n
"
,
qbuf
);
fprintf
(
stderr
,
"Error: %s
\n
"
,
mysql_error
(
sock
));
rc
=
1
;
}
if
(
verbose
)
printf
(
"%-50s %s
\n
"
,
name
,
rc
?
"FAILED"
:
"OK"
);
return
rc
;
}
static
int
process_one_db
(
char
*
database
)
{
if
(
what_to_do
==
DO_UPGRADE
)
{
int
rc
=
0
;
if
(
opt_fix_db_names
&&
!
strncmp
(
database
,
"#mysql50#"
,
9
))
{
rc
=
fix_object_name
(
"DATABASE"
,
database
);
database
+=
9
;
}
if
(
rc
||
!
opt_fix_table_names
)
return
rc
;
}
return
process_all_tables_in_db
(
database
);
}
static
int
use_db
(
char
*
database
)
{
if
(
mysql_get_server_version
(
sock
)
>=
50003
&&
...
...
@@ -546,6 +600,8 @@ static int handle_request_for_tables(char *tables, uint length)
case
DO_OPTIMIZE
:
op
=
"OPTIMIZE"
;
break
;
case
DO_UPGRADE
:
return
fix_object_name
(
"TABLE"
,
tables
);
}
if
(
!
(
query
=
(
char
*
)
my_malloc
((
sizeof
(
char
)
*
(
length
+
110
)),
MYF
(
MY_WME
))))
...
...
mysql-test/r/upgrade.result
0 → 100644
View file @
2d714129
drop database if exists `testdb1`;
drop database if exists `testdb-1`;
drop database if exists `#mysql50#testdb-1`;
create database `testdb1`;
create database `#mysql50#testdb-1`;
create table `testdb1`.`t1` (a int);
create table `testdb1`.`#mysql50#t-1` (a int);
create table `#mysql50#testdb-1`.`t1` (a int);
create table `#mysql50#testdb-1`.`#mysql50#t-1` (a int);
show create database `testdb1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
ERROR 42000: Unknown database 'testdb-1'
show create database `#mysql50#testdb-1`;
Database Create Database
#mysql50#testdb-1 CREATE DATABASE `#mysql50#testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show tables in `testdb1`;
Tables_in_testdb1
#mysql50#t-1
t1
show tables in `#mysql50#testdb-1`;
Tables_in_#mysql50#testdb-1
#mysql50#t-1
t1
show create database `testdb1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
Database Create Database
testdb-1 CREATE DATABASE `testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `#mysql50#testdb-1`;
ERROR 42000: Unknown database '#mysql50#testdb-1'
show tables in `testdb1`;
Tables_in_testdb1
t1
t-1
show tables in `testdb-1`;
Tables_in_testdb-1
t1
t-1
drop database `testdb1`;
drop database `testdb-1`;
mysql-test/t/disabled.def
View file @
2d714129
...
...
@@ -43,3 +43,6 @@ rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886
sp-goto : GOTO is currently is disabled - will be fixed in the future
subselect : Bug#15706 (ps mode) [PATCH PENDING]
rpl_ndb_blob : Bug #17505
rpl_ndb_blob2 : Bug #17505
rpl_ndb_log : results are not deterministic
mysql-test/t/upgrade.test
0 → 100644
View file @
2d714129
--
disable_warnings
drop
database
if
exists
`testdb1`
;
drop
database
if
exists
`testdb-1`
;
drop
database
if
exists
`#mysql50#testdb-1`
;
--
enable_warnings
create
database
`testdb1`
;
create
database
`#mysql50#testdb-1`
;
create
table
`testdb1`
.
`t1`
(
a
int
);
create
table
`testdb1`
.
`#mysql50#t-1`
(
a
int
);
create
table
`#mysql50#testdb-1`
.
`t1`
(
a
int
);
create
table
`#mysql50#testdb-1`
.
`#mysql50#t-1`
(
a
int
);
show
create
database
`testdb1`
;
--
error
1049
show
create
database
`testdb-1`
;
show
create
database
`#mysql50#testdb-1`
;
show
tables
in
`testdb1`
;
show
tables
in
`#mysql50#testdb-1`
;
--
exec
$MYSQL_CHECK
--
all
-
databases
--
fix
-
db
-
names
--
fix
-
table
-
names
show
create
database
`testdb1`
;
show
create
database
`testdb-1`
;
--
error
1049
show
create
database
`#mysql50#testdb-1`
;
show
tables
in
`testdb1`
;
show
tables
in
`testdb-1`
;
drop
database
`testdb1`
;
drop
database
`testdb-1`
;
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