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
000d89b5
Commit
000d89b5
authored
Nov 23, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix values printed by mysqldump for empty blob fields when
--hex-blob is used. (Bug #13318)
parent
829a4831
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
6 deletions
+79
-6
client/mysqldump.c
client/mysqldump.c
+7
-6
mysql-test/r/mysqldump.result
mysql-test/r/mysqldump.result
+63
-0
mysql-test/t/mysqldump.test
mysql-test/t/mysqldump.test
+9
-0
No files found.
client/mysqldump.c
View file @
000d89b5
...
...
@@ -1768,6 +1768,8 @@ static void dumpTable(uint numFields, char *table)
for
(
i
=
0
;
i
<
mysql_num_fields
(
res
);
i
++
)
{
int
is_blob
;
ulong
length
=
lengths
[
i
];
if
(
!
(
field
=
mysql_fetch_field
(
res
)))
{
my_snprintf
(
query
,
QUERY_LENGTH
,
...
...
@@ -1792,7 +1794,6 @@ static void dumpTable(uint numFields, char *table)
field
->
type
==
FIELD_TYPE_TINY_BLOB
))
?
1
:
0
;
if
(
extended_insert
)
{
ulong
length
=
lengths
[
i
];
if
(
i
==
0
)
dynstr_set
(
&
extended_row
,
"("
);
else
...
...
@@ -1882,19 +1883,19 @@ static void dumpTable(uint numFields, char *table)
{
print_xml_tag1
(
md_result_file
,
"
\t\t
"
,
"field name="
,
field
->
name
,
""
);
print_quoted_xml
(
md_result_file
,
row
[
i
],
length
s
[
i
]
);
print_quoted_xml
(
md_result_file
,
row
[
i
],
length
);
fputs
(
"</field>
\n
"
,
md_result_file
);
}
else
if
(
opt_hex_blob
&&
is_blob
)
else
if
(
opt_hex_blob
&&
is_blob
&&
length
)
{
/* sakaik got the idea to to provide blob's in hex notation. */
char
*
ptr
=
row
[
i
],
*
end
=
ptr
+
lengths
[
i
]
;
char
*
ptr
=
row
[
i
],
*
end
=
ptr
+
length
;
fputs
(
"0x"
,
md_result_file
);
for
(;
ptr
<
end
;
ptr
++
)
fprintf
(
md_result_file
,
"%02X"
,
*
((
uchar
*
)
ptr
));
}
else
unescape
(
md_result_file
,
row
[
i
],
length
s
[
i
]
);
unescape
(
md_result_file
,
row
[
i
],
length
);
}
else
{
...
...
mysql-test/r/mysqldump.result
View file @
000d89b5
...
...
@@ -1493,3 +1493,66 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
</database>
</mysqldump>
drop table t1, t2;
create table t1 (a binary(1), b blob);
insert into t1 values ('','');
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` binary(1) default NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES ('','');
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` binary(1) default NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES ('','');
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1;
mysql-test/t/mysqldump.test
View file @
000d89b5
...
...
@@ -635,4 +635,13 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
xml
--
no
-
create
-
info
test
drop
table
t1
,
t2
;
#
# Bug #13318: Bad result with empty field and --hex-blob
#
create
table
t1
(
a
binary
(
1
),
b
blob
);
insert
into
t1
values
(
''
,
''
);
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
skip
-
extended
-
insert
--
hex
-
blob
test
t1
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
hex
-
blob
test
t1
drop
table
t1
;
# End of 4.1 tests
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