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
66b37d31
Commit
66b37d31
authored
Oct 30, 2009
by
Mikael Ronstrom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensuring character set constants are safe, first step fix
parent
40496deb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
14 deletions
+68
-14
mysql-test/r/partition_column.result
mysql-test/r/partition_column.result
+11
-11
sql/sql_partition.cc
sql/sql_partition.cc
+57
-3
No files found.
mysql-test/r/partition_column.result
View file @
66b37d31
...
@@ -34,8 +34,8 @@ t1 CREATE TABLE `t1` (
...
@@ -34,8 +34,8 @@ t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST COLUMNS(a)
/*!50100 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (_ucs2
' '
) ENGINE = MyISAM,
(PARTITION p0 VALUES IN (_ucs2
0x2020
) ENGINE = MyISAM,
PARTITION p1 VALUES IN (_ucs2'') ENGINE = MyISAM) */
PARTITION p1 VALUES IN (_ucs2
'') ENGINE = MyISAM) */
insert into t1 values ('');
insert into t1 values ('');
insert into t1 values (_ucs2 0x2020);
insert into t1 values (_ucs2 0x2020);
drop table t1;
drop table t1;
...
@@ -77,9 +77,9 @@ t1 CREATE TABLE `t1` (
...
@@ -77,9 +77,9 @@ t1 CREATE TABLE `t1` (
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c,d)
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c,d)
SUBPARTITION BY HASH (to_seconds(d))
SUBPARTITION BY HASH (to_seconds(d))
SUBPARTITIONS 4
SUBPARTITIONS 4
(PARTITION p0 VALUES LESS THAN (1,_latin1
'0'
,MAXVALUE,'1900-01-01') ENGINE = MyISAM,
(PARTITION p0 VALUES LESS THAN (1,_latin1
0x30
,MAXVALUE,'1900-01-01') ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,_latin1
'a'
,MAXVALUE,'1999-01-01') ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,_latin1
0x61
,MAXVALUE,'1999-01-01') ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (1,_latin1
'a'
,MAXVALUE,MAXVALUE) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (1,_latin1
0x61
,MAXVALUE,MAXVALUE) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) */
PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) */
drop table t1;
drop table t1;
create table t1 (a int, b int)
create table t1 (a int, b int)
...
@@ -298,10 +298,10 @@ t1 CREATE TABLE `t1` (
...
@@ -298,10 +298,10 @@ t1 CREATE TABLE `t1` (
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
SUBPARTITION BY KEY (c,d)
SUBPARTITION BY KEY (c,d)
SUBPARTITIONS 3
SUBPARTITIONS 3
(PARTITION p0 VALUES LESS THAN (1,_latin1
'abc',_latin1'abc'
) ENGINE = MyISAM,
(PARTITION p0 VALUES LESS THAN (1,_latin1
0x616263,_latin1 0x616263
) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (2,_latin1
'abc',_latin1'abc'
) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (2,_latin1
0x616263,_latin1 0x616263
) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (3,_latin1
'abc',_latin1'abc'
) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (3,_latin1
0x616263,_latin1 0x616263
) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (4,_latin1
'abc',_latin1'abc'
) ENGINE = MyISAM) */
PARTITION p3 VALUES LESS THAN (4,_latin1
0x616263,_latin1 0x616263
) ENGINE = MyISAM) */
insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3);
insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3);
insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3);
insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3);
insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3);
insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3);
...
@@ -329,8 +329,8 @@ t1 CREATE TABLE `t1` (
...
@@ -329,8 +329,8 @@ t1 CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
(PARTITION p0 VALUES LESS THAN (1,_latin1
'A'
,1) ENGINE = MyISAM,
(PARTITION p0 VALUES LESS THAN (1,_latin1
0x41
,1) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,_latin1
'B'
,1) ENGINE = MyISAM) */
PARTITION p1 VALUES LESS THAN (1,_latin1
0x42
,1) ENGINE = MyISAM) */
insert into t1 values (1, 'A', 1);
insert into t1 values (1, 'A', 1);
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
id select_type table partitions type possible_keys key key_len ref rows Extra
...
...
sql/sql_partition.cc
View file @
66b37d31
...
@@ -1818,6 +1818,46 @@ static int add_write(File fptr, const char *buf, uint len)
...
@@ -1818,6 +1818,46 @@ static int add_write(File fptr, const char *buf, uint len)
return
1
;
return
1
;
}
}
static
int
add_string
(
File
fptr
,
const
char
*
string
);
static
int
write_hex_char
(
File
fptr
,
uint
number
)
{
char
buf
[
2
];
char
c
=
'0'
;
/* Write number between 0 and 15 as 0-9,A-F */
if
(
number
<
10
)
c
+=
number
;
else
{
c
=
'A'
;
c
+=
(
number
-
10
);
}
buf
[
0
]
=
c
;
buf
[
1
]
=
0
;
return
add_string
(
fptr
,
(
const
char
*
)
buf
);
}
static
int
add_hex_string_object
(
File
fptr
,
String
*
string
)
{
uint
len
=
string
->
length
();
uint
i
;
const
char
*
ptr
=
string
->
ptr
();
char
c
;
int
err
;
uint
low
,
high
;
err
=
add_string
(
fptr
,
"0x"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
c
=
*
ptr
;
ptr
++
;
high
=
c
>>
4
;
low
=
c
&
15
;
err
+=
write_hex_char
(
fptr
,
high
);
err
+=
write_hex_char
(
fptr
,
low
);
}
return
err
;
}
static
int
add_string_object
(
File
fptr
,
String
*
string
)
static
int
add_string_object
(
File
fptr
,
String
*
string
)
{
{
return
add_write
(
fptr
,
string
->
ptr
(),
string
->
length
());
return
add_write
(
fptr
,
string
->
ptr
(),
string
->
length
());
...
@@ -2209,13 +2249,27 @@ static int add_column_list_values(File fptr, partition_info *part_info,
...
@@ -2209,13 +2249,27 @@ static int add_column_list_values(File fptr, partition_info *part_info,
{
{
err
+=
add_string
(
fptr
,
"_"
);
err
+=
add_string
(
fptr
,
"_"
);
err
+=
add_string
(
fptr
,
field_cs
->
csname
);
err
+=
add_string
(
fptr
,
field_cs
->
csname
);
err
+=
add_space
(
fptr
);
if
(
res
->
length
())
{
err
+=
add_hex_string_object
(
fptr
,
res
);
}
}
else
{
err
+=
add_string
(
fptr
,
"'"
);
err
+=
add_string
(
fptr
,
"'"
);
}
}
else
{
err
+=
add_string
(
fptr
,
"'"
);
err
+=
add_string
(
fptr
,
"'"
);
err
+=
add_string_object
(
fptr
,
res
);
err
+=
add_string_object
(
fptr
,
res
);
err
+=
add_string
(
fptr
,
"'"
);
err
+=
add_string
(
fptr
,
"'"
);
}
}
}
}
}
}
}
if
(
i
!=
(
num_elements
-
1
))
if
(
i
!=
(
num_elements
-
1
))
err
+=
add_string
(
fptr
,
comma_str
);
err
+=
add_string
(
fptr
,
comma_str
);
}
}
...
...
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