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
ae2b73a5
Commit
ae2b73a5
authored
May 07, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-4.0
into a80-186-24-72.elisa-laajakaista.fi:/home/my/bk/mysql-4.0
parents
6c9dc830
b20399d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
16 deletions
+48
-16
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
client/mysqldump.c
client/mysqldump.c
+47
-16
No files found.
BitKeeper/etc/logging_ok
View file @
ae2b73a5
...
...
@@ -39,6 +39,7 @@ hf@deer.mysql.r18.ru
hf@genie.(none)
igor@hundin.mysql.fi
igor@rurik.mysql.com
jani@a80-186-24-72.elisa-laajakaista.fi
jani@dsl-jkl1657.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
...
...
client/mysqldump.c
View file @
ae2b73a5
...
...
@@ -36,7 +36,7 @@
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
*/
#define DUMP_VERSION "9.1
0
"
#define DUMP_VERSION "9.1
1
"
#include <my_global.h>
#include <my_sys.h>
...
...
@@ -938,18 +938,32 @@ static char *field_escape(char *to,const char *from,uint length)
}
/* field_escape */
static
char
*
alloc_query_str
(
ulong
size
)
{
char
*
query
;
if
(
!
(
query
=
(
char
*
)
my_malloc
(
size
,
MYF
(
MY_WME
))))
{
ignore_errors
=
0
;
/* Fatal error */
safe_exit
(
EX_MYSQLERR
);
/* Force exit */
}
return
query
;
}
/*
** dumpTable saves database contents as a series of INSERT statements.
*/
static
void
dumpTable
(
uint
numFields
,
char
*
table
)
{
char
query
[
QUERY_LENGTH
],
*
end
,
buff
[
256
],
table_buff
[
NAME_LEN
+
3
];
char
query
_buf
[
QUERY_LENGTH
],
*
end
,
buff
[
256
],
table_buff
[
NAME_LEN
+
3
];
char
*
result_table
,
table_buff2
[
NAME_LEN
*
2
+
3
],
*
opt_quoted_table
;
char
*
query
=
query_buf
;
MYSQL_RES
*
res
;
MYSQL_FIELD
*
field
;
MYSQL_ROW
row
;
ulong
rownr
,
row_break
,
total_length
,
init_length
;
const
char
*
table_type
;
int
error
=
0
;
result_table
=
quote_name
(
table
,
table_buff
,
1
);
opt_quoted_table
=
quote_name
(
table
,
table_buff2
,
0
);
...
...
@@ -995,8 +1009,11 @@ static void dumpTable(uint numFields, char *table)
sprintf
(
buff
,
" FROM %s"
,
result_table
);
end
=
strmov
(
end
,
buff
);
if
(
where
)
end
=
strxmov
(
end
,
" WHERE "
,
where
,
NullS
);
if
(
mysql_query
(
sock
,
query
))
{
query
=
alloc_query_str
((
ulong
)
(
strlen
(
where
)
+
(
end
-
query
)
+
10
));
end
=
strxmov
(
query
,
query_buf
,
" WHERE "
,
where
,
NullS
);
}
if
(
mysql_real_query
(
sock
,
query
,
(
uint
)
(
end
-
query
)))
{
DBerror
(
sock
,
"when executing 'SELECT INTO OUTFILE'"
);
return
;
...
...
@@ -1013,14 +1030,16 @@ static void dumpTable(uint numFields, char *table)
{
if
(
!
opt_xml
&&
opt_comments
)
fprintf
(
md_result_file
,
"-- WHERE: %s
\n
"
,
where
);
strxmov
(
strend
(
query
),
" WHERE "
,
where
,
NullS
);
query
=
alloc_query_str
((
ulong
)
(
strlen
(
where
)
+
strlen
(
query
)
+
10
));
strxmov
(
query
,
query_buf
,
" WHERE "
,
where
,
NullS
);
}
if
(
!
opt_xml
)
fputs
(
"
\n
"
,
md_result_file
);
if
(
mysql_query
(
sock
,
query
))
{
DBerror
(
sock
,
"when retrieving data from server"
);
return
;
error
=
EX_CONSCHECK
;
goto
err
;
}
if
(
quick
)
res
=
mysql_use_result
(
sock
);
...
...
@@ -1029,7 +1048,8 @@ static void dumpTable(uint numFields, char *table)
if
(
!
res
)
{
DBerror
(
sock
,
"when retrieving data from server"
);
return
;
error
=
EX_CONSCHECK
;
goto
err
;
}
if
(
verbose
)
fprintf
(
stderr
,
"-- Retrieving rows...
\n
"
);
...
...
@@ -1037,8 +1057,8 @@ static void dumpTable(uint numFields, char *table)
{
fprintf
(
stderr
,
"%s: Error in field count for table: %s ! Aborting.
\n
"
,
my_progname
,
result_table
);
safe_exit
(
EX_CONSCHECK
)
;
return
;
error
=
EX_CONSCHECK
;
goto
err
;
}
if
(
opt_disable_keys
)
...
...
@@ -1076,8 +1096,8 @@ static void dumpTable(uint numFields, char *table)
sprintf
(
query
,
"%s: Not enough fields from table %s! Aborting.
\n
"
,
my_progname
,
result_table
);
fputs
(
query
,
stderr
);
safe_exit
(
EX_CONSCHECK
)
;
return
;
error
=
EX_CONSCHECK
;
goto
err
;
}
if
(
extended_insert
)
{
...
...
@@ -1096,7 +1116,8 @@ static void dumpTable(uint numFields, char *table)
if
(
dynstr_realloc
(
&
extended_row
,
length
*
2
+
2
))
{
fputs
(
"Aborting dump (out of memory)"
,
stderr
);
safe_exit
(
EX_EOM
);
error
=
EX_EOM
;
goto
err
;
}
dynstr_append
(
&
extended_row
,
"
\'
"
);
extended_row
.
length
+=
...
...
@@ -1131,7 +1152,8 @@ static void dumpTable(uint numFields, char *table)
else
if
(
dynstr_append
(
&
extended_row
,
"NULL"
))
{
fputs
(
"Aborting dump (out of memory)"
,
stderr
);
safe_exit
(
EX_EOM
);
error
=
EX_EOM
;
goto
err
;
}
}
else
...
...
@@ -1229,8 +1251,8 @@ static void dumpTable(uint numFields, char *table)
result_table
,
rownr
);
fputs
(
query
,
stderr
);
safe_exit
(
EX_CONSCHECK
)
;
return
;
error
=
EX_CONSCHECK
;
goto
err
;
}
if
(
opt_lock
)
fputs
(
"UNLOCK TABLES;
\n
"
,
md_result_file
);
...
...
@@ -1240,7 +1262,16 @@ static void dumpTable(uint numFields, char *table)
if
(
opt_autocommit
)
fprintf
(
md_result_file
,
"commit;
\n
"
);
mysql_free_result
(
res
);
}
if
(
query
!=
query_buf
)
my_free
(
query
,
MYF
(
MY_ALLOW_ZERO_PTR
));
}
return
;
err:
if
(
query
!=
query_buf
)
my_free
(
query
,
MYF
(
MY_ALLOW_ZERO_PTR
));
safe_exit
(
error
);
return
;
}
/* dumpTable */
...
...
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