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
23a522c0
Commit
23a522c0
authored
Apr 28, 2003
by
venu@myvenu.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into myvenu.com:/home/venu/work/sql/dev-4.1
parents
7f51b1d3
0eb1be58
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
10 deletions
+114
-10
include/mysqld_error.h
include/mysqld_error.h
+5
-1
mysql-test/r/warnings.result
mysql-test/r/warnings.result
+24
-0
mysql-test/std_data/warnings_loaddata.dat
mysql-test/std_data/warnings_loaddata.dat
+8
-0
mysql-test/t/warnings.test
mysql-test/t/warnings.test
+12
-0
sql/field.cc
sql/field.cc
+6
-1
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+6
-1
sql/sql_load.cc
sql/sql_load.cc
+53
-7
No files found.
include/mysqld_error.h
View file @
23a522c0
...
@@ -275,5 +275,9 @@
...
@@ -275,5 +275,9 @@
#define ER_ZLIB_Z_BUF_ERROR 1256
#define ER_ZLIB_Z_BUF_ERROR 1256
#define ER_ZLIB_Z_DATA_ERROR 1257
#define ER_ZLIB_Z_DATA_ERROR 1257
#define ER_CUT_VALUE_GROUP_CONCAT 1258
#define ER_CUT_VALUE_GROUP_CONCAT 1258
#define ER_ERROR_MESSAGES 259
#define ER_WARN_TOO_FEW_RECORDS 1259
#define ER_WARN_TOO_MANY_RECORDS 1260
#define ER_WARN_DATA_TRUNCATED 1261
#define ER_WARN_NULL_TO_NOTNULL 1262
#define ER_ERROR_MESSAGES 263
mysql-test/r/warnings.result
View file @
23a522c0
...
@@ -30,3 +30,27 @@ create table if not exists t1(id int);
...
@@ -30,3 +30,27 @@ create table if not exists t1(id int);
select @@warning_count;
select @@warning_count;
@@warning_count
@@warning_count
0
0
drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1261 Data truncated for column 'd' at row 3
Warning 1261 Data truncated for column 'c' at row 4
Warning 1259 Value count is fewer than the column count at row 5
Warning 1261 Data truncated for column 'b' at row 6
Warning 1260 Value count is more than the column count at row 7
Warning 1261 Data truncated for column 'a' at row 8
select @@warning_count;
@@warning_count
7
show warnings;
Level Code Message
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1261 Data truncated for column 'd' at row 3
Warning 1261 Data truncated for column 'c' at row 4
Warning 1259 Value count is fewer than the column count at row 5
Warning 1261 Data truncated for column 'b' at row 6
Warning 1260 Value count is more than the column count at row 7
Warning 1261 Data truncated for column 'a' at row 8
drop table t1;
mysql-test/std_data/warnings_loaddata.dat
0 → 100644
View file @
23a522c0
10,20,2003-04-21,mysql
20,\N,2003-04-22,MySQL
30,40,2003-04-23,MySQL is Open Source Database
40,50,monty,30
50,60,2003-04-24
60,67 abc,2003-04-25,mysql
70,80,2003-04-26,mysql,open,source
500,90,2003-04-27,mysql
mysql-test/t/warnings.test
View file @
23a522c0
...
@@ -17,6 +17,7 @@ set SQL_WARNINGS=0;
...
@@ -17,6 +17,7 @@ set SQL_WARNINGS=0;
#
#
# Test other warnings
# Test other warnings
#
drop
temporary
table
if
exists
not_exists
;
drop
temporary
table
if
exists
not_exists
;
drop
table
if
exists
not_exists_table
;
drop
table
if
exists
not_exists_table
;
...
@@ -26,3 +27,14 @@ show count(*) warnings;
...
@@ -26,3 +27,14 @@ show count(*) warnings;
create
table
t1
(
id
int
);
create
table
t1
(
id
int
);
create
table
if
not
exists
t1
(
id
int
);
create
table
if
not
exists
t1
(
id
int
);
select
@@
warning_count
;
select
@@
warning_count
;
drop
table
t1
;
#
# Test warnings for LOAD DATA INFILE
#
create
table
t1
(
a
tinyint
,
b
int
not
null
,
c
date
,
d
char
(
5
));
load
data
infile
'../../std_data/warnings_loaddata.dat'
into
table
t1
fields
terminated
by
','
;
select
@@
warning_count
;
show
warnings
;
drop
table
t1
;
sql/field.cc
View file @
23a522c0
...
@@ -1677,6 +1677,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -1677,6 +1677,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
!
test_if_int
(
from
,
len
,
end
,
cs
)))
!
test_if_int
(
from
,
len
,
end
,
cs
)))
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
error
=
1
;
}
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
if
(
table
->
db_low_byte_first
)
...
@@ -1932,7 +1933,10 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -1932,7 +1933,10 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
if
(
error
||
if
(
error
||
(
from
+
len
!=
end
&&
current_thd
->
count_cuted_fields
&&
(
from
+
len
!=
end
&&
current_thd
->
count_cuted_fields
&&
!
test_if_int
(
from
,
len
,
end
,
cs
)))
!
test_if_int
(
from
,
len
,
end
,
cs
)))
current_thd
->
cuted_fields
++
;
{
current_thd
->
cuted_fields
++
;
error
=
1
;
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
if
(
table
->
db_low_byte_first
)
{
{
...
@@ -2416,6 +2420,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -2416,6 +2420,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
if
(
err
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
if
(
err
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
err
=
1
;
}
}
if
(
unsigned_flag
&&
j
<
0
)
if
(
unsigned_flag
&&
j
<
0
)
{
{
...
...
sql/share/english/errmsg.txt
View file @
23a522c0
...
@@ -259,4 +259,9 @@
...
@@ -259,4 +259,9 @@
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"%d line(s) was(were) cut by group_concat()";
\ No newline at end of file
"Value count is fewer than the column count at row %ld";
"Value count is more than the column count at row %ld";
"Data truncated for column '%s' at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"
sql/sql_load.cc
View file @
23a522c0
...
@@ -368,9 +368,11 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -368,9 +368,11 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
List_iterator_fast
<
Item
>
it
(
fields
);
List_iterator_fast
<
Item
>
it
(
fields
);
Item_field
*
sql_field
;
Item_field
*
sql_field
;
ulonglong
id
;
ulonglong
id
;
ulong
row_pos
;
DBUG_ENTER
(
"read_fixed_length"
);
DBUG_ENTER
(
"read_fixed_length"
);
id
=
0
;
id
=
0
;
row_pos
=
1
;
/* No fields can be null in this format. mark all fields as not null */
/* No fields can be null in this format. mark all fields as not null */
while
((
sql_field
=
(
Item_field
*
)
it
++
))
while
((
sql_field
=
(
Item_field
*
)
it
++
))
sql_field
->
field
->
set_notnull
();
sql_field
->
field
->
set_notnull
();
...
@@ -392,8 +394,11 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -392,8 +394,11 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
Field
*
field
=
sql_field
->
field
;
Field
*
field
=
sql_field
->
field
;
if
(
pos
==
read_info
.
row_end
)
if
(
pos
==
read_info
.
row_end
)
{
{
thd
->
cuted_fields
++
;
/* Not enough fields */
thd
->
cuted_fields
++
;
/* Not enough fields */
field
->
reset
();
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_TOO_FEW_RECORDS
,
ER
(
ER_WARN_TOO_FEW_RECORDS
),
row_pos
);
field
->
reset
();
}
}
else
else
{
{
...
@@ -403,14 +408,25 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -403,14 +408,25 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
field
->
field_length
)
field
->
field_length
)
length
=
field
->
field_length
;
length
=
field
->
field_length
;
save_chr
=
pos
[
length
];
pos
[
length
]
=
'\0'
;
// Safeguard aganst malloc
save_chr
=
pos
[
length
];
pos
[
length
]
=
'\0'
;
// Safeguard aganst malloc
field
->
store
((
char
*
)
pos
,
length
,
read_info
.
read_charset
);
if
(
field
->
store
((
char
*
)
pos
,
length
,
read_info
.
read_charset
))
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_TRUNCATED
,
ER
(
ER_WARN_DATA_TRUNCATED
),
field
->
field_name
,
row_pos
);
}
pos
[
length
]
=
save_chr
;
pos
[
length
]
=
save_chr
;
if
((
pos
+=
length
)
>
read_info
.
row_end
)
if
((
pos
+=
length
)
>
read_info
.
row_end
)
pos
=
read_info
.
row_end
;
/* Fills rest with space */
pos
=
read_info
.
row_end
;
/* Fills rest with space */
}
}
}
}
if
(
pos
!=
read_info
.
row_end
)
if
(
pos
!=
read_info
.
row_end
)
{
thd
->
cuted_fields
++
;
/* To long row */
thd
->
cuted_fields
++
;
/* To long row */
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_TOO_MANY_RECORDS
,
ER
(
ER_WARN_TOO_MANY_RECORDS
),
row_pos
);
}
if
(
write_record
(
table
,
&
info
))
if
(
write_record
(
table
,
&
info
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
/*
/*
...
@@ -426,7 +442,13 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -426,7 +442,13 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
if
(
read_info
.
next_line
())
// Skip to next line
if
(
read_info
.
next_line
())
// Skip to next line
break
;
break
;
if
(
read_info
.
line_cuted
)
if
(
read_info
.
line_cuted
)
{
thd
->
cuted_fields
++
;
/* To long row */
thd
->
cuted_fields
++
;
/* To long row */
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_TOO_MANY_RECORDS
,
ER
(
ER_WARN_TOO_MANY_RECORDS
),
row_pos
);
}
row_pos
++
;
}
}
if
(
id
&&
!
read_info
.
error
)
if
(
id
&&
!
read_info
.
error
)
thd
->
insert_id
(
id
);
// For binary/update log
thd
->
insert_id
(
id
);
// For binary/update log
...
@@ -444,11 +466,13 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -444,11 +466,13 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
Item_field
*
sql_field
;
Item_field
*
sql_field
;
uint
enclosed_length
;
uint
enclosed_length
;
ulonglong
id
;
ulonglong
id
;
ulong
row_pos
;
DBUG_ENTER
(
"read_sep_field"
);
DBUG_ENTER
(
"read_sep_field"
);
enclosed_length
=
enclosed
.
length
();
enclosed_length
=
enclosed
.
length
();
id
=
0
;
id
=
0
;
row_pos
=
1
;
for
(;;
it
.
rewind
())
for
(;;
it
.
rewind
())
{
{
if
(
thd
->
killed
)
if
(
thd
->
killed
)
...
@@ -478,13 +502,26 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -478,13 +502,26 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
if
(
field
->
type
()
==
FIELD_TYPE_TIMESTAMP
)
if
(
field
->
type
()
==
FIELD_TYPE_TIMESTAMP
)
((
Field_timestamp
*
)
field
)
->
set_time
();
((
Field_timestamp
*
)
field
)
->
set_time
();
else
if
(
field
!=
table
->
next_number_field
)
else
if
(
field
!=
table
->
next_number_field
)
{
thd
->
cuted_fields
++
;
thd
->
cuted_fields
++
;
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_NULL_TO_NOTNULL
,
ER
(
ER_WARN_NULL_TO_NOTNULL
),
field
->
field_name
,
row_pos
);
}
}
}
continue
;
continue
;
}
}
field
->
set_notnull
();
field
->
set_notnull
();
read_info
.
row_end
[
0
]
=
0
;
// Safe to change end marker
read_info
.
row_end
[
0
]
=
0
;
// Safe to change end marker
field
->
store
((
char
*
)
read_info
.
row_start
,
length
,
read_info
.
read_charset
);
if
(
field
->
store
((
char
*
)
read_info
.
row_start
,
length
,
read_info
.
read_charset
))
{
// Data truncated or out of bounds
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_TRUNCATED
,
ER
(
ER_WARN_DATA_TRUNCATED
),
field
->
field_name
,
row_pos
);
}
}
}
if
(
read_info
.
error
)
if
(
read_info
.
error
)
break
;
break
;
...
@@ -497,6 +534,9 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -497,6 +534,9 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
sql_field
->
field
->
set_null
();
sql_field
->
field
->
set_null
();
sql_field
->
field
->
reset
();
sql_field
->
field
->
reset
();
thd
->
cuted_fields
++
;
thd
->
cuted_fields
++
;
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_TOO_FEW_RECORDS
,
ER
(
ER_WARN_TOO_FEW_RECORDS
),
row_pos
);
}
}
}
}
if
(
write_record
(
table
,
&
info
))
if
(
write_record
(
table
,
&
info
))
...
@@ -514,7 +554,13 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -514,7 +554,13 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
if
(
read_info
.
next_line
())
// Skip to next line
if
(
read_info
.
next_line
())
// Skip to next line
break
;
break
;
if
(
read_info
.
line_cuted
)
if
(
read_info
.
line_cuted
)
{
thd
->
cuted_fields
++
;
/* To long row */
thd
->
cuted_fields
++
;
/* To long row */
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_TOO_MANY_RECORDS
,
ER
(
ER_WARN_TOO_MANY_RECORDS
),
row_pos
);
}
row_pos
++
;
}
}
if
(
id
&&
!
read_info
.
error
)
if
(
id
&&
!
read_info
.
error
)
thd
->
insert_id
(
id
);
// For binary/update log
thd
->
insert_id
(
id
);
// For binary/update log
...
...
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