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
9ba73923
Commit
9ba73923
authored
Feb 12, 2005
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#8235 Connection collation change & table create with default result in crash
parent
40da910d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
3 deletions
+69
-3
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+14
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+21
-0
sql/field.cc
sql/field.cc
+10
-2
strings/ctype-ucs2.c
strings/ctype-ucs2.c
+24
-1
No files found.
mysql-test/r/ctype_ucs.result
View file @
9ba73923
...
...
@@ -613,3 +613,17 @@ ucs2_bin 00610009
ucs2_bin 0061
ucs2_bin 00610020
drop table t1;
SET NAMES latin1;
SET collation_connection='ucs2_swedish_ci';
CREATE TABLE t1 (Field1 int(10) default '0');
INSERT INTO t1 VALUES ('-1');
SELECT * FROM t1;
Field1
-1
DROP TABLE t1;
CREATE TABLE t1 (Field1 int(10) unsigned default '0');
INSERT INTO t1 VALUES ('-1');
Warnings:
Warning 1265 Data truncated for column 'Field1' at row 1
DROP TABLE t1;
SET NAMES latin1;
mysql-test/t/ctype_ucs.test
View file @
9ba73923
...
...
@@ -390,3 +390,24 @@ SET collation_connection='ucs2_general_ci';
SET
NAMES
latin1
;
SET
collation_connection
=
'ucs2_bin'
;
--
source
include
/
ctype_filesort
.
inc
SET
NAMES
latin1
;
#
# Bug#8235
#
# This bug also helped to find another problem that
# INSERT of a UCS2 string containing a negative number
# into a unsigned int column didn't produce warnings.
# This test covers both problems.
#
SET
collation_connection
=
'ucs2_swedish_ci'
;
CREATE
TABLE
t1
(
Field1
int
(
10
)
default
'0'
);
# no warnings, negative numbers are allowed
INSERT
INTO
t1
VALUES
(
'-1'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
Field1
int
(
10
)
unsigned
default
'0'
);
# this should generate a "Data truncated" warning
INSERT
INTO
t1
VALUES
(
'-1'
);
DROP
TABLE
t1
;
SET
NAMES
latin1
;
sql/field.cc
View file @
9ba73923
...
...
@@ -1777,6 +1777,14 @@ void Field_medium::sql_type(String &res) const
****************************************************************************/
static
bool
test_if_minus
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
e
)
{
my_wc_t
wc
;
return
cs
->
cset
->
mb_wc
(
cs
,
&
wc
,
(
uchar
*
)
s
,
(
uchar
*
)
e
)
>
0
&&
wc
==
'-'
;
}
int
Field_long
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
long
tmp
;
...
...
@@ -1790,7 +1798,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
if
(
unsigned_flag
)
{
if
(
!
len
||
*
from
==
'-'
)
if
(
!
len
||
test_if_minus
(
cs
,
from
,
from
+
len
)
)
{
tmp
=
0
;
// Set negative to 0
my_errno
=
ERANGE
;
...
...
@@ -2086,7 +2094,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
my_errno
=
0
;
if
(
unsigned_flag
)
{
if
(
!
len
||
*
from
==
'-'
)
if
(
!
len
||
test_if_minus
(
cs
,
from
,
from
+
len
)
)
{
tmp
=
0
;
// Set negative to 0
my_errno
=
ERANGE
;
...
...
strings/ctype-ucs2.c
View file @
9ba73923
...
...
@@ -1480,6 +1480,29 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs,
return
0
;
}
ulong
my_scan_ucs2
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
const
char
*
str
,
const
char
*
end
,
int
sequence_type
)
{
const
char
*
str0
=
str
;
end
--
;
/* for easier loop condition, because of two bytes per character */
switch
(
sequence_type
)
{
case
MY_SEQ_SPACES
:
for
(
;
str
<
end
;
str
+=
2
)
{
if
(
str
[
0
]
!=
'\0'
||
str
[
1
]
!=
' '
)
break
;
}
return
str
-
str0
;
default:
return
0
;
}
}
static
MY_COLLATION_HANDLER
my_collation_ucs2_general_ci_handler
=
{
NULL
,
/* init */
...
...
@@ -1534,7 +1557,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler=
my_strntoull_ucs2
,
my_strntod_ucs2
,
my_strtoll10_ucs2
,
my_scan_
8bit
my_scan_
ucs2
};
...
...
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