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
7bdd452d
Commit
7bdd452d
authored
Jan 11, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If VARCHAR strips only trailing spaces, then produce
a note, not a warning or error.
parent
e7b38aa7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
+23
-9
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+2
-2
mysql-test/r/heap.result
mysql-test/r/heap.result
+1
-1
mysql-test/r/myisam.result
mysql-test/r/myisam.result
+2
-2
mysql-test/r/strict.result
mysql-test/r/strict.result
+1
-1
sql/field.cc
sql/field.cc
+17
-3
No files found.
mysql-test/r/bdb.result
View file @
7bdd452d
...
...
@@ -1300,7 +1300,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings:
Warning
1265 Data truncated for column 'v' at row 1
Note
1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+
*+*+ *
...
...
@@ -1346,7 +1346,7 @@ t1 CREATE TABLE `t1` (
)
ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
Warning
1265 Data truncated for column 't' at row 2
Note
1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
mysql-test/r/heap.result
View file @
7bdd452d
...
...
@@ -255,7 +255,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings:
Warning
1265 Data truncated for column 'v' at row 1
Note
1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+ *+*+ *
...
...
mysql-test/r/myisam.result
View file @
7bdd452d
...
...
@@ -571,7 +571,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings:
Warning
1265 Data truncated for column 'v' at row 1
Note
1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+
*+*+ *
...
...
@@ -617,7 +617,7 @@ t1 CREATE TABLE `t1` (
)
ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
Warning
1265 Data truncated for column 't' at row 2
Note
1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
mysql-test/r/strict.result
View file @
7bdd452d
...
...
@@ -818,7 +818,6 @@ ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('hellobob');
ERROR 01000: Data truncated for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES ('hello ');
ERROR 01000: Data truncated for column 'col2' at row 1
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
ERROR 01000: Data truncated for column 'col1' at row 2
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
...
...
@@ -835,6 +834,7 @@ col1 col2
hello hello
he hellot
hello hello
NULL hello
hello hellob
DROP TABLE t1;
CREATE TABLE t1 (col1 enum('red','blue','green'));
...
...
sql/field.cc
View file @
7bdd452d
...
...
@@ -4672,6 +4672,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
uint32
not_used
,
copy_length
;
char
buff
[
80
];
String
tmpstr
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
enum
MYSQL_ERROR
::
enum_warning_level
level
=
MYSQL_ERROR
::
WARN_LEVEL_WARN
;
/* Convert character set if nesessary */
if
(
String
::
needs_conversion
(
length
,
cs
,
field_charset
,
&
not_used
))
...
...
@@ -4697,10 +4698,23 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
else
int2store
(
ptr
,
copy_length
);
if
(
copy_length
<
length
)
// Check if we lost something other than just trailing spaces
if
((
copy_length
<
length
)
&&
table
->
in_use
->
count_cuted_fields
)
{
const
char
*
end
=
from
+
length
;
from
+=
copy_length
;
from
+=
field_charset
->
cset
->
scan
(
field_charset
,
from
,
end
,
MY_SEQ_SPACES
);
/*
If we lost only spaces then produce a NOTE, not a WARNING.
But if we have already had errors (e.g with charset conversion),
then don't reset level to NOTE.
*/
if
(
from
==
end
&&
!
error
)
level
=
MYSQL_ERROR
::
WARN_LEVEL_NOTE
;
error
=
1
;
}
if
(
error
)
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_TRUNCATED
,
1
);
set_warning
(
level
,
ER_WARN_DATA_TRUNCATED
,
1
);
return
error
;
}
...
...
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