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
cf80041e
Commit
cf80041e
authored
Jan 19, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
field length convertion (bytes->chars) should be done with rounding UP.
parent
ca8929a1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+11
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+12
-0
sql/field.cc
sql/field.cc
+3
-3
No files found.
mysql-test/r/ctype_utf8.result
View file @
cf80041e
drop table if exists t1;
set names utf8;
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);
select left(_utf8 0xD0B0D0B1D0B2,1);
left(_utf8 0xD0B0D0B1D0B2,1)
left(_utf8 0xD0B0D0B1D0B2,1)
...
@@ -68,3 +69,13 @@ this is a test
...
@@ -68,3 +69,13 @@ this is a test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
aa b
create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(4) character set utf8 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
date_format("2004-01-19 10:10:10", "%Y-%m-%d")
2004-01-19
drop table t1;
mysql-test/t/ctype_utf8.test
View file @
cf80041e
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
# Tests with the utf8 character set
# Tests with the utf8 character set
#
#
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
set
names
utf8
;
set
names
utf8
;
select
left
(
_utf8
0xD0B0D0B1D0B2
,
1
);
select
left
(
_utf8
0xD0B0D0B1D0B2
,
1
);
...
@@ -41,3 +44,12 @@ select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
...
@@ -41,3 +44,12 @@ select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
#
#
select
insert
(
'txs'
,
2
,
1
,
'hi'
),
insert
(
'is '
,
4
,
0
,
'a'
),
insert
(
'txxxxt'
,
2
,
4
,
'es'
);
select
insert
(
'txs'
,
2
,
1
,
'hi'
),
insert
(
'is '
,
4
,
0
,
'a'
),
insert
(
'txxxxt'
,
2
,
4
,
'es'
);
select
insert
(
"aa"
,
100
,
1
,
"b"
),
insert
(
"aa"
,
1
,
3
,
"b"
);
select
insert
(
"aa"
,
100
,
1
,
"b"
),
insert
(
"aa"
,
1
,
3
,
"b"
);
#
# CREATE ... SELECT
#
create
table
t1
select
date_format
(
"2004-01-19 10:10:10"
,
"%Y-%m-%d"
);
show
create
table
t1
;
select
*
from
t1
;
drop
table
t1
;
sql/field.cc
View file @
cf80041e
...
@@ -5611,11 +5611,11 @@ create_field::create_field(Field *old_field,Field *orig_field)
...
@@ -5611,11 +5611,11 @@ create_field::create_field(Field *old_field,Field *orig_field)
case
3
:
sql_type
=
FIELD_TYPE_MEDIUM_BLOB
;
break
;
case
3
:
sql_type
=
FIELD_TYPE_MEDIUM_BLOB
;
break
;
default:
sql_type
=
FIELD_TYPE_LONG_BLOB
;
break
;
default:
sql_type
=
FIELD_TYPE_LONG_BLOB
;
break
;
}
}
length
/=
charset
->
mbmaxlen
;
// QQ: Probably not needed
length
=
(
length
+
charset
->
mbmaxlen
-
1
)
/
charset
->
mbmaxlen
;
// QQ: Probably not needed
break
;
break
;
case
FIELD_TYPE_STRING
:
case
FIELD_TYPE_STRING
:
case
FIELD_TYPE_VAR_STRING
:
case
FIELD_TYPE_VAR_STRING
:
length
/=
charset
->
mbmaxlen
;
length
=
(
length
+
charset
->
mbmaxlen
-
1
)
/
charset
->
mbmaxlen
;
break
;
break
;
default:
default:
break
;
break
;
...
...
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