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
afb1ad84
Commit
afb1ad84
authored
Jul 26, 2005
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a fix (bug #11546: Bad error message from inserting out of range values, SQL_MODE='tradition').
parent
bbd06a33
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
mysql-test/r/strict.result
mysql-test/r/strict.result
+7
-0
mysql-test/t/strict.test
mysql-test/t/strict.test
+11
-0
sql/field.cc
sql/field.cc
+8
-2
No files found.
mysql-test/r/strict.result
View file @
afb1ad84
...
...
@@ -1258,3 +1258,10 @@ select * from t1;
d
2000-10-01
drop table t1;
set @@sql_mode='traditional';
create table t1(a bit(2));
insert into t1 values(b'101');
ERROR 22001: Data too long for column 'a' at row 1
select * from t1;
a
drop table t1;
mysql-test/t/strict.test
View file @
afb1ad84
...
...
@@ -1118,3 +1118,14 @@ insert into t1 values ('2000-10-01');
update
t1
set
d
=
1100
;
select
*
from
t1
;
drop
table
t1
;
#
# BIT fields
#
set
@@
sql_mode
=
'traditional'
;
create
table
t1
(
a
bit
(
2
));
--
error
1406
insert
into
t1
values
(
b
'101'
);
select
*
from
t1
;
drop
table
t1
;
sql/field.cc
View file @
afb1ad84
...
...
@@ -7846,7 +7846,10 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
{
set_rec_bits
(
0xff
,
bit_ptr
,
bit_ofs
,
bit_len
);
memset
(
ptr
,
0xff
,
field_length
);
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
1
);
if
(
table
->
in_use
->
really_abort_on_warning
())
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_DATA_TOO_LONG
,
1
);
else
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
1
);
return
1
;
}
/* delta is >= -1 here */
...
...
@@ -8063,7 +8066,10 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
memset
(
ptr
,
0xff
,
field_length
);
if
(
bits
)
*
ptr
&=
((
1
<<
bits
)
-
1
);
/* set first byte */
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
1
);
if
(
table
->
in_use
->
really_abort_on_warning
())
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_DATA_TOO_LONG
,
1
);
else
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
1
);
return
1
;
}
bzero
(
ptr
,
delta
);
...
...
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