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
010f4242
Commit
010f4242
authored
Sep 26, 2004
by
bar@noter.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1/
into noter.intranet.mysql.r18.ru:/root/mysql-4.1
parents
75b628b8
29b8c6b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
11 deletions
+100
-11
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+9
-0
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+16
-0
mysql-test/t/bdb.test
mysql-test/t/bdb.test
+12
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+14
-0
sql/field.cc
sql/field.cc
+49
-11
No files found.
mysql-test/r/bdb.result
View file @
010f4242
...
...
@@ -1251,3 +1251,12 @@ truncate t1;
select * from t1;
a b
drop table t1;
SET NAMES utf8;
create table t1 (a varchar(255) character set utf8) engine=bdb;
set @a:= convert(repeat(_latin1 0xFF, 255) using utf8);
insert into t1 values (@a);
select a, length(a), char_length(a) from t1;
a length(a) char_length(a)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 510 255
drop table t1;
SET NAMES latin1;
mysql-test/r/ctype_utf8.result
View file @
010f4242
...
...
@@ -644,3 +644,19 @@ INSERT INTO t1 VALUES ('test');
SELECT a FROM t1 WHERE a LIKE '%te';
a
DROP TABLE t1;
SET NAMES utf8;
CREATE TABLE t1 (
subject varchar(255) character set utf8 collate utf8_unicode_ci,
p varchar(15) character set utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
INSERT INTO t1 VALUES ('aaa','bbb');
SELECT length(subject) FROM t1;
length(subject)
432
3
SELECT length(subject) FROM t1 ORDER BY 1;
length(subject)
3
432
DROP TABLE t1;
mysql-test/t/bdb.test
View file @
010f4242
...
...
@@ -897,3 +897,15 @@ commit;
truncate
t1
;
select
*
from
t1
;
drop
table
t1
;
#
# Check that BDB works fine with a string which is
# longer than 255 bytes for multibyte characters.
#
SET
NAMES
utf8
;
create
table
t1
(
a
varchar
(
255
)
character
set
utf8
)
engine
=
bdb
;
set
@
a
:=
convert
(
repeat
(
_latin1
0xFF
,
255
)
using
utf8
);
insert
into
t1
values
(
@
a
);
select
a
,
length
(
a
),
char_length
(
a
)
from
t1
;
drop
table
t1
;
SET
NAMES
latin1
;
mysql-test/t/ctype_utf8.test
View file @
010f4242
...
...
@@ -499,3 +499,17 @@ CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
INSERT
INTO
t1
VALUES
(
'test'
);
SELECT
a
FROM
t1
WHERE
a
LIKE
'%te'
;
DROP
TABLE
t1
;
#
# Bug #5723: length(<varchar utf8 field>) returns varying results
#
SET
NAMES
utf8
;
CREATE
TABLE
t1
(
subject
varchar
(
255
)
character
set
utf8
collate
utf8_unicode_ci
,
p
varchar
(
15
)
character
set
utf8
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
'谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m'
,
'040312-000057'
);
INSERT
INTO
t1
VALUES
(
'aaa'
,
'bbb'
);
SELECT
length
(
subject
)
FROM
t1
;
SELECT
length
(
subject
)
FROM
t1
ORDER
BY
1
;
DROP
TABLE
t1
;
sql/field.cc
View file @
010f4242
...
...
@@ -4414,12 +4414,19 @@ void Field_string::sql_type(String &res) const
char
*
Field_string
::
pack
(
char
*
to
,
const
char
*
from
,
uint
max_length
)
{
const
char
*
end
=
from
+
min
(
field_length
,
max_length
);
u
char
length
;
u
int
length
;
while
(
end
>
from
&&
end
[
-
1
]
==
' '
)
end
--
;
*
to
=
length
=
(
uchar
)
(
end
-
from
);
memcpy
(
to
+
1
,
from
,
(
int
)
length
);
return
to
+
1
+
length
;
length
=
(
end
-
from
);
if
(
field_length
>
255
)
{
int2store
(
to
,
length
);
to
+=
2
;
}
else
*
to
++=
(
char
)
(
uchar
)
length
;
memcpy
(
to
,
from
,
(
int
)
length
);
return
to
+
length
;
}
...
...
@@ -4432,15 +4439,28 @@ char *Field_string::pack_key(char *to, const char *from, uint max_length)
set_if_smaller
(
length
,
char_length
);
while
(
length
&&
from
[
length
-
1
]
==
' '
)
length
--
;
*
to
=
(
uchar
)
length
;
memcpy
(
to
+
1
,
from
,
length
);
return
to
+
1
+
length
;
if
(
field_length
>
255
)
{
int2store
(
to
,
length
);
to
+=
2
;
}
else
*
to
++=
(
char
)
(
uchar
)
length
;
memcpy
(
to
,
from
,
length
);
return
to
+
length
;
}
const
char
*
Field_string
::
unpack
(
char
*
to
,
const
char
*
from
)
{
uint
length
=
(
uint
)
(
uchar
)
*
from
++
;
uint
length
;
if
(
field_length
>
255
)
{
length
=
uint2korr
(
from
);
from
+=
2
;
}
else
length
=
(
uint
)
(
uchar
)
*
from
++
;
memcpy
(
to
,
from
,
(
int
)
length
);
bfill
(
to
+
length
,
field_length
-
length
,
' '
);
return
from
+
length
;
...
...
@@ -4449,8 +4469,19 @@ const char *Field_string::unpack(char *to, const char *from)
int
Field_string
::
pack_cmp
(
const
char
*
a
,
const
char
*
b
,
uint
length
)
{
uint
a_length
=
(
uint
)
(
uchar
)
*
a
++
;
uint
b_length
=
(
uint
)
(
uchar
)
*
b
++
;
uint
a_length
,
b_length
;
if
(
field_length
>
255
)
{
a_length
=
uint2korr
(
a
);
b_length
=
uint2korr
(
b
);
a
+=
2
;
b
+=
2
;
}
else
{
a_length
=
(
uint
)
(
uchar
)
*
a
++
;
b_length
=
(
uint
)
(
uchar
)
*
b
++
;
}
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a
,
a_length
,
(
const
uchar
*
)
b
,
b_length
);
...
...
@@ -4459,7 +4490,14 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length)
int
Field_string
::
pack_cmp
(
const
char
*
b
,
uint
length
)
{
uint
b_length
=
(
uint
)
(
uchar
)
*
b
++
;
uint
b_length
;
if
(
field_length
>
255
)
{
b_length
=
uint2korr
(
b
);
b
+=
2
;
}
else
b_length
=
(
uint
)
(
uchar
)
*
b
++
;
char
*
end
=
ptr
+
field_length
;
while
(
end
>
ptr
&&
end
[
-
1
]
==
' '
)
end
--
;
...
...
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