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
1d0777e2
Commit
1d0777e2
authored
Oct 29, 2000
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge serg@work:/home/bk/mysql
into serg.mysql.com:/usr/home/serg/Abk/mysql
parents
8178d563
07ce8436
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
213 additions
and
131 deletions
+213
-131
client/mysqldump.c
client/mysqldump.c
+213
-131
No files found.
client/mysqldump.c
View file @
1d0777e2
...
...
@@ -594,7 +594,88 @@ static uint getTableStructure(char *table, char* db)
if
(
verbose
)
fprintf
(
stderr
,
"# Retrieving table structure for table %s...
\n
"
,
table
);
sprintf
(
insert_pat
,
"SET OPTION SQL_QUOTE_SHOW_CREATE=%d"
,
opt_quoted
);
table_name
=
quote_name
(
table
,
table_buff
);
if
(
mysql_query
(
sock
,
insert_pat
))
{
/* using SHOW CREATE statement */
if
(
!
tFlag
)
{
/* Make an sql-file, if path was given iow. option -T was given */
char
buff
[
20
+
FN_REFLEN
];
sprintf
(
buff
,
"show create table %s"
,
table_name
);
if
(
mysql_query
(
sock
,
buff
))
{
fprintf
(
stderr
,
"%s: Can't get CREATE TABLE for table '%s' (%s)
\n
"
,
my_progname
,
table
,
mysql_error
(
sock
));
safe_exit
(
EX_MYSQLERR
);
DBUG_RETURN
(
0
);
}
if
(
path
)
{
char
filename
[
FN_REFLEN
],
tmp_path
[
FN_REFLEN
];
strmov
(
tmp_path
,
path
);
convert_dirname
(
tmp_path
);
sql_file
=
my_fopen
(
fn_format
(
filename
,
table
,
tmp_path
,
".sql"
,
4
),
O_WRONLY
,
MYF
(
MY_WME
));
if
(
!
sql_file
)
/* If file couldn't be opened */
{
safe_exit
(
EX_MYSQLERR
);
DBUG_RETURN
(
0
);
}
write_heder
(
sql_file
,
db
);
}
fprintf
(
sql_file
,
"
\n
#
\n
# Table structure for table '%s'
\n
#
\n\n
"
,
table
);
if
(
opt_drop
)
fprintf
(
sql_file
,
"DROP TABLE IF EXISTS %s;
\n
"
,
table_name
);
tableRes
=
mysql_store_result
(
sock
);
row
=
mysql_fetch_row
(
tableRes
);
fprintf
(
sql_file
,
"%s;
\n
"
,
row
[
1
]);
mysql_free_result
(
tableRes
);
}
sprintf
(
insert_pat
,
"show fields from %s"
,
table_name
);
if
(
mysql_query
(
sock
,
insert_pat
)
||
!
(
tableRes
=
mysql_store_result
(
sock
)))
{
fprintf
(
stderr
,
"%s: Can't get info about table: '%s'
\n
error: %s
\n
"
,
my_progname
,
table
,
mysql_error
(
sock
));
safe_exit
(
EX_MYSQLERR
);
DBUG_RETURN
(
0
);
}
if
(
cFlag
)
sprintf
(
insert_pat
,
"INSERT %sINTO %s ("
,
delayed
,
table_name
);
else
{
sprintf
(
insert_pat
,
"INSERT %sINTO %s VALUES "
,
delayed
,
table_name
);
if
(
!
extended_insert
)
strcat
(
insert_pat
,
"("
);
}
strpos
=
strend
(
insert_pat
);
while
((
row
=
mysql_fetch_row
(
tableRes
)))
{
ulong
*
lengths
=
mysql_fetch_lengths
(
tableRes
);
if
(
init
)
{
if
(
cFlag
)
strpos
=
strmov
(
strpos
,
", "
);
}
init
=
1
;
if
(
cFlag
)
strpos
=
strmov
(
strpos
,
quote_name
(
row
[
SHOW_FIELDNAME
],
name_buff
));
}
numFields
=
(
uint
)
mysql_num_rows
(
tableRes
);
mysql_free_result
(
tableRes
);
}
else
{
/* fprintf(stderr, "%s: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
my_progname, mysql_error(sock)); */
sprintf
(
insert_pat
,
"show fields from %s"
,
table_name
);
if
(
mysql_query
(
sock
,
insert_pat
)
||
!
(
tableRes
=
mysql_store_result
(
sock
)))
{
...
...
@@ -695,10 +776,10 @@ static uint getTableStructure(char *table, char* db)
if
(
atoi
(
row
[
3
])
==
1
)
{
keynr
++
;
#ifdef FORCE_PRIMARY_KEY
#ifdef FORCE_PRIMARY_KEY
if
(
atoi
(
row
[
1
])
==
0
&&
primary_key
==
INT_MAX
)
primary_key
=
keynr
;
#endif
#endif
if
(
!
strcmp
(
row
[
2
],
"PRIMARY"
))
{
primary_key
=
keynr
;
...
...
@@ -765,6 +846,7 @@ static uint getTableStructure(char *table, char* db)
}
fputs
(
";
\n
"
,
sql_file
);
}
}
if
(
cFlag
)
{
strpos
=
strmov
(
strpos
,
") VALUES "
);
...
...
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