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
a0d3a351
Commit
a0d3a351
authored
Oct 11, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-20790 CSV table with INET6 can be created and inserted into, but cannot be read from
parent
5d6d28f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
1 deletion
+132
-1
plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result
plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result
+70
-0
plugin/type_inet/mysql-test/type_inet/type_inet6_csv.test
plugin/type_inet/mysql-test/type_inet/type_inet6_csv.test
+51
-0
storage/csv/ha_tina.cc
storage/csv/ha_tina.cc
+11
-1
No files found.
plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result
0 → 100644
View file @
a0d3a351
#
# Start of 10.5 tests
#
#
# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
#
SET default_storage_engine=CSV;
CREATE TABLE t1 (a INET6 NOT NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` inet6 NOT NULL
) ENGINE=CSV DEFAULT CHARSET=latin1
FOR i IN 0..255
DO
INSERT INTO t1 VALUES (CONCAT('::', HEX(i)));
END FOR
$$
SELECT * FROM t1 WHERE a='::ff';
a
::ff
SELECT * FROM t1 WHERE a>='::fe' ORDER BY a;
a
::fe
::ff
SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0') ORDER BY a;
a
::80
::a0
::f0
SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81' ORDER BY a;
a
::80
::81
SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
a
::ff
UPDATE t1 SET a=CONCAT('ffff', a) WHERE a LIKE '::a%';
SELECT * FROM t1 WHERE a LIKE 'ffff::%' ORDER BY a;
a
ffff::a
ffff::a0
ffff::a1
ffff::a2
ffff::a3
ffff::a4
ffff::a5
ffff::a6
ffff::a7
ffff::a8
ffff::a9
ffff::aa
ffff::ab
ffff::ac
ffff::ad
ffff::ae
ffff::af
DROP TABLE t1;
#
# MDEV-20790 CSV table with INET6 can be created and inserted into, but cannot be read from
#
CREATE TABLE t1 (a INET6 NOT NULL) ENGINE=CSV;
INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
SELECT * FROM t1;
a
2001:db8::ff00:42:8329
DROP TABLE t1;
#
# End of 10.5 tests
#
plugin/type_inet/mysql-test/type_inet/type_inet6_csv.test
0 → 100644
View file @
a0d3a351
--
source
include
/
have_csv
.
inc
--
echo
#
--
echo
# Start of 10.5 tests
--
echo
#
--
echo
#
--
echo
# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
--
echo
#
SET
default_storage_engine
=
CSV
;
CREATE
TABLE
t1
(
a
INET6
NOT
NULL
);
SHOW
CREATE
TABLE
t1
;
DELIMITER
$$
;
FOR
i
IN
0.
.
255
DO
INSERT
INTO
t1
VALUES
(
CONCAT
(
'::'
,
HEX
(
i
)));
END
FOR
$$
DELIMITER
;
$$
SELECT
*
FROM
t1
WHERE
a
=
'::ff'
;
SELECT
*
FROM
t1
WHERE
a
>=
'::fe'
ORDER
BY
a
;
SELECT
*
FROM
t1
WHERE
a
IN
(
'::80'
,
'::a0'
,
'::f0'
)
ORDER
BY
a
;
SELECT
*
FROM
t1
WHERE
a
BETWEEN
'::80'
AND
'::81'
ORDER
BY
a
;
SELECT
*
FROM
t1
WHERE
a
=
CAST
(
'::ff'
AS
INET6
);
UPDATE
t1
SET
a
=
CONCAT
(
'ffff'
,
a
)
WHERE
a
LIKE
'::a%'
;
SELECT
*
FROM
t1
WHERE
a
LIKE
'ffff::%'
ORDER
BY
a
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-20790 CSV table with INET6 can be created and inserted into, but cannot be read from
--
echo
#
CREATE
TABLE
t1
(
a
INET6
NOT
NULL
)
ENGINE
=
CSV
;
INSERT
INTO
t1
VALUES
(
'2001:db8::ff00:42:8329'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
storage/csv/ha_tina.cc
View file @
a0d3a351
...
@@ -820,6 +820,16 @@ int ha_tina::find_current_row(uchar *buf)
...
@@ -820,6 +820,16 @@ int ha_tina::find_current_row(uchar *buf)
if
(
read_all
||
bitmap_is_set
(
table
->
read_set
,
(
*
field
)
->
field_index
))
if
(
read_all
||
bitmap_is_set
(
table
->
read_set
,
(
*
field
)
->
field_index
))
{
{
bool
is_enum
=
((
*
field
)
->
real_type
()
==
MYSQL_TYPE_ENUM
);
bool
is_enum
=
((
*
field
)
->
real_type
()
==
MYSQL_TYPE_ENUM
);
/*
If "field" distinguishes between text and binary formats (e.g. INET6),
we cannot pass buffer.char() (which is &my_charset_bin) to store(),
to avoid "field" mis-interpreting the data format as binary.
Let's pass my_charset_latin1 to tell the field that we're storing
in text format.
*/
CHARSET_INFO
*
storecs
=
(
*
field
)
->
type_handler
()
->
convert_to_binary_using_val_native
()
?
&
my_charset_latin1
:
buffer
.
charset
();
/*
/*
Here CHECK_FIELD_WARN checks that all values in the csv file are valid
Here CHECK_FIELD_WARN checks that all values in the csv file are valid
which is normally the case, if they were written by
which is normally the case, if they were written by
...
@@ -828,7 +838,7 @@ int ha_tina::find_current_row(uchar *buf)
...
@@ -828,7 +838,7 @@ int ha_tina::find_current_row(uchar *buf)
Thus, for enums we silence the warning, as it doesn't really mean
Thus, for enums we silence the warning, as it doesn't really mean
an invalid value.
an invalid value.
*/
*/
if
((
*
field
)
->
store
(
buffer
.
ptr
(),
buffer
.
length
(),
buffer
.
charset
()
,
if
((
*
field
)
->
store
(
buffer
.
ptr
(),
buffer
.
length
(),
storecs
,
is_enum
?
CHECK_FIELD_IGNORE
:
CHECK_FIELD_WARN
))
is_enum
?
CHECK_FIELD_IGNORE
:
CHECK_FIELD_WARN
))
{
{
if
(
!
is_enum
)
if
(
!
is_enum
)
...
...
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