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
6afebb31
Commit
6afebb31
authored
Jan 28, 2003
by
jani@hynda.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in --auto-repair.
parent
1e2e4f23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
6 deletions
+36
-6
client/mysqlcheck.c
client/mysqlcheck.c
+36
-6
No files found.
client/mysqlcheck.c
View file @
6afebb31
...
...
@@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "2.4.
2
"
#define CHECK_VERSION "2.4.
3
"
#include "client_priv.h"
#include <m_ctype.h>
...
...
@@ -156,6 +156,7 @@ static void dbDisconnect(char *host);
static
void
DBerror
(
MYSQL
*
mysql
,
const
char
*
when
);
static
void
safe_exit
(
int
error
);
static
void
print_result
();
static
char
*
fix_table_name
(
char
*
dest
,
char
*
src
);
int
what_to_do
=
0
;
static
void
print_version
(
void
)
...
...
@@ -370,7 +371,8 @@ static int process_selected_tables(char *db, char **table_names, int tables)
for
(
end
=
table_names_comma_sep
+
1
;
tables
>
0
;
tables
--
,
table_names
++
)
{
end
=
strxmov
(
end
,
" `"
,
*
table_names
,
"`,"
,
NullS
);
end
=
fix_table_name
(
end
,
*
table_names
);
*
end
++=
','
;
}
*--
end
=
0
;
handle_request_for_tables
(
table_names_comma_sep
+
1
,
tot_length
-
1
);
...
...
@@ -383,6 +385,22 @@ static int process_selected_tables(char *db, char **table_names, int tables)
}
/* process_selected_tables */
static
char
*
fix_table_name
(
char
*
dest
,
char
*
src
)
{
char
*
db_sep
;
*
dest
++=
'`'
;
if
((
db_sep
=
strchr
(
src
,
'.'
)))
{
dest
=
strmake
(
dest
,
src
,
(
uint
)
(
db_sep
-
src
));
dest
=
strmov
(
dest
,
"`.`"
);
src
=
db_sep
+
1
;
}
dest
=
strxmov
(
dest
,
src
,
"`"
,
NullS
);
return
dest
;
}
static
int
process_all_tables_in_db
(
char
*
database
)
{
MYSQL_RES
*
res
;
...
...
@@ -417,7 +435,8 @@ static int process_all_tables_in_db(char *database)
}
for
(
end
=
tables
+
1
;
(
row
=
mysql_fetch_row
(
res
))
;)
{
end
=
strxmov
(
end
,
" `"
,
row
[
0
],
"`,"
,
NullS
);
end
=
fix_table_name
(
end
,
row
[
0
]);
*
end
++=
','
;
}
*--
end
=
0
;
if
(
tot_length
)
...
...
@@ -448,6 +467,7 @@ static int use_db(char *database)
static
int
handle_request_for_tables
(
char
*
tables
,
uint
length
)
{
char
*
query
,
*
end
,
options
[
100
],
message
[
100
];
uint
query_length
=
0
;
const
char
*
op
=
0
;
options
[
0
]
=
0
;
...
...
@@ -478,11 +498,21 @@ static int handle_request_for_tables(char *tables, uint length)
if
(
!
(
query
=
(
char
*
)
my_malloc
((
sizeof
(
char
)
*
(
length
+
110
)),
MYF
(
MY_WME
))))
return
1
;
if
(
opt_all_in_1
)
{
/* No backticks here as we added them before */
sprintf
(
query
,
"%s TABLE %s %s"
,
op
,
tables
,
options
);
query_length
=
my_sprintf
(
query
,
(
query
,
"%s TABLE %s %s"
,
op
,
tables
,
options
));
}
else
sprintf
(
query
,
"%s TABLE `%s` %s"
,
op
,
tables
,
options
);
if
(
mysql_query
(
sock
,
query
))
{
char
*
ptr
;
ptr
=
strmov
(
strmov
(
query
,
op
),
" TABLE "
);
ptr
=
fix_table_name
(
ptr
,
tables
);
ptr
=
strxmov
(
ptr
,
" "
,
options
,
NullS
);
query_length
=
(
uint
)
(
ptr
-
query
);
}
if
(
mysql_real_query
(
sock
,
query
,
query_length
))
{
sprintf
(
message
,
"when executing '%s TABLE ... %s'"
,
op
,
options
);
DBerror
(
sock
,
message
);
...
...
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