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
90c9c726
Commit
90c9c726
authored
Aug 02, 2006
by
grog@eucla.lemis.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#13926: --order-by-primary fails if PKEY contains quote character.
Quote PKEY.
parent
8597ebae
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
4 deletions
+103
-4
client/mysqldump.c
client/mysqldump.c
+12
-4
mysql-test/r/mysqldump.result
mysql-test/r/mysqldump.result
+71
-0
mysql-test/t/mysqldump.test
mysql-test/t/mysqldump.test
+20
-0
No files found.
client/mysqldump.c
View file @
90c9c726
...
@@ -3245,6 +3245,8 @@ static char *primary_key_fields(const char *table_name)
...
@@ -3245,6 +3245,8 @@ static char *primary_key_fields(const char *table_name)
char
show_keys_buff
[
15
+
64
*
2
+
3
];
char
show_keys_buff
[
15
+
64
*
2
+
3
];
uint
result_length
=
0
;
uint
result_length
=
0
;
char
*
result
=
0
;
char
*
result
=
0
;
char
buff
[
NAME_LEN
*
2
+
3
];
char
*
quoted_field
;
my_snprintf
(
show_keys_buff
,
sizeof
(
show_keys_buff
),
my_snprintf
(
show_keys_buff
,
sizeof
(
show_keys_buff
),
"SHOW KEYS FROM %s"
,
table_name
);
"SHOW KEYS FROM %s"
,
table_name
);
...
@@ -3268,8 +3270,10 @@ static char *primary_key_fields(const char *table_name)
...
@@ -3268,8 +3270,10 @@ static char *primary_key_fields(const char *table_name)
{
{
/* Key is unique */
/* Key is unique */
do
do
result_length
+=
strlen
(
row
[
4
])
+
1
;
/* + 1 for ',' or \0 */
{
while
((
row
=
mysql_fetch_row
(
res
))
&&
atoi
(
row
[
3
])
>
1
);
quoted_field
=
quote_name
(
row
[
4
],
buff
,
0
);
result_length
+=
strlen
(
quoted_field
)
+
1
;
/* + 1 for ',' or \0 */
}
while
((
row
=
mysql_fetch_row
(
res
))
&&
atoi
(
row
[
3
])
>
1
);
}
}
/* Build the ORDER BY clause result */
/* Build the ORDER BY clause result */
...
@@ -3285,9 +3289,13 @@ static char *primary_key_fields(const char *table_name)
...
@@ -3285,9 +3289,13 @@ static char *primary_key_fields(const char *table_name)
}
}
mysql_data_seek
(
res
,
0
);
mysql_data_seek
(
res
,
0
);
row
=
mysql_fetch_row
(
res
);
row
=
mysql_fetch_row
(
res
);
end
=
strmov
(
result
,
row
[
4
]);
quoted_field
=
quote_name
(
row
[
4
],
buff
,
0
);
end
=
strmov
(
result
,
quoted_field
);
while
((
row
=
mysql_fetch_row
(
res
))
&&
atoi
(
row
[
3
])
>
1
)
while
((
row
=
mysql_fetch_row
(
res
))
&&
atoi
(
row
[
3
])
>
1
)
end
=
strxmov
(
end
,
","
,
row
[
4
],
NullS
);
{
quoted_field
=
quote_name
(
row
[
4
],
buff
,
0
);
end
=
strxmov
(
end
,
","
,
quoted_field
,
NullS
);
}
}
}
cleanup:
cleanup:
...
...
mysql-test/r/mysqldump.result
View file @
90c9c726
...
@@ -2867,3 +2867,74 @@ drop view nasishnasifu;
...
@@ -2867,3 +2867,74 @@ drop view nasishnasifu;
drop database mysqldump_views;
drop database mysqldump_views;
drop table mysqldump_tables.basetable;
drop table mysqldump_tables.basetable;
drop database mysqldump_tables;
drop database mysqldump_tables;
USE test;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a b" int(11) NOT NULL default '0',
"c""d" int(11) NOT NULL default '0',
"e`f" int(11) NOT NULL default '0',
PRIMARY KEY ("a b","c""d","e`f")
);
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
INSERT INTO "t1" VALUES (815,4711,2006);
/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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 b` int(11) NOT NULL default '0',
`c"d` int(11) NOT NULL default '0',
`e``f` int(11) NOT NULL default '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (815,4711,2006);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!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`;
End of 5.0 tests
mysql-test/t/mysqldump.test
View file @
90c9c726
...
@@ -1228,3 +1228,23 @@ drop view nasishnasifu;
...
@@ -1228,3 +1228,23 @@ drop view nasishnasifu;
drop
database
mysqldump_views
;
drop
database
mysqldump_views
;
drop
table
mysqldump_tables
.
basetable
;
drop
table
mysqldump_tables
.
basetable
;
drop
database
mysqldump_tables
;
drop
database
mysqldump_tables
;
USE
test
;
#
# BUG#13926: --order-by-primary fails if PKEY contains quote character
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
`t1`
;
CREATE
TABLE
`t1`
(
`a b`
INT
,
`c"d`
INT
,
`e``f`
INT
,
PRIMARY
KEY
(
`a b`
,
`c"d`
,
`e``f`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
insert
into
t1
values
(
0815
,
4711
,
2006
);
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
compatible
=
ansi
--
order
-
by
-
primary
test
t1
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
order
-
by
-
primary
test
t1
DROP
TABLE
`t1`
;
--
enable_warnings
--
echo
End
of
5.0
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