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
52326aba
Commit
52326aba
authored
Oct 03, 2006
by
acurtis/antony@ltamd64.xiphis.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge xiphis.org:/home/antony/work2/p2-bug22080.2
into xiphis.org:/home/antony/work2/p2-bug22080.3
parents
d9e92fbd
f6129d68
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
16 deletions
+60
-16
mysql-test/r/csv.result
mysql-test/r/csv.result
+19
-0
mysql-test/t/csv.test
mysql-test/t/csv.test
+23
-0
storage/csv/ha_tina.cc
storage/csv/ha_tina.cc
+18
-16
No files found.
mysql-test/r/csv.result
View file @
52326aba
...
...
@@ -5205,3 +5205,22 @@ select * from bug15205;
val
drop table bug15205;
drop table bug15205_2;
create table bug22080_1 (id int,string varchar(64)) Engine=CSV;
create table bug22080_2 (id int,string varchar(64)) Engine=CSV;
create table bug22080_3 (id int,string varchar(64)) Engine=CSV;
insert into bug22080_1 values(1,'string');
insert into bug22080_1 values(2,'string');
insert into bug22080_1 values(3,'string');
"1","string"
2","string"
"3","string"
check table bug22080_2;
Table Op Msg_type Msg_text
test.bug22080_2 check error Corrupt
"1","string"
"2",string"
"3","string"
check table bug22080_3;
Table Op Msg_type Msg_text
test.bug22080_3 check error Corrupt
drop tables bug22080_1,bug22080_2,bug22080_3;
mysql-test/t/csv.test
View file @
52326aba
...
...
@@ -1582,3 +1582,26 @@ select * from bug15205_2;
select
*
from
bug15205
;
drop
table
bug15205
;
drop
table
bug15205_2
;
#
# Bug#22080 "CHECK fails to identify some corruption"
#
create
table
bug22080_1
(
id
int
,
string
varchar
(
64
))
Engine
=
CSV
;
create
table
bug22080_2
(
id
int
,
string
varchar
(
64
))
Engine
=
CSV
;
create
table
bug22080_3
(
id
int
,
string
varchar
(
64
))
Engine
=
CSV
;
insert
into
bug22080_1
values
(
1
,
'string'
);
insert
into
bug22080_1
values
(
2
,
'string'
);
insert
into
bug22080_1
values
(
3
,
'string'
);
# Currupt the file as described in the bug report
--
exec
sed
-
e
's/"2"/2"/'
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
bug22080_1
.
CSV
>
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
bug22080_2
.
CSV
--
exec
sed
-
e
's/2","/2",/'
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
bug22080_1
.
CSV
>
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
bug22080_3
.
CSV
--
exec
cat
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
bug22080_2
.
CSV
check
table
bug22080_2
;
--
exec
cat
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
bug22080_3
.
CSV
check
table
bug22080_3
;
drop
tables
bug22080_1
,
bug22080_2
,
bug22080_3
;
storage/csv/ha_tina.cc
View file @
52326aba
...
...
@@ -548,7 +548,10 @@ int ha_tina::encode_quote(byte *buf)
in the code.
*/
if
((
*
field
)
->
is_null
())
ptr
=
end_ptr
=
0
;
{
buffer
.
append
(
STRING_WITH_LEN
(
"
\"\"
,"
));
continue
;
}
else
{
(
*
field
)
->
val_str
(
&
attribute
,
&
attribute
);
...
...
@@ -649,6 +652,7 @@ int ha_tina::find_current_row(byte *buf)
off_t
end_offset
,
curr_offset
=
current_position
;
int
eoln_len
;
my_bitmap_map
*
org_bitmap
;
int
error
;
DBUG_ENTER
(
"ha_tina::find_current_row"
);
/*
...
...
@@ -662,23 +666,23 @@ int ha_tina::find_current_row(byte *buf)
/* Avoid asserts in ::store() for columns that are not going to be updated */
org_bitmap
=
dbug_tmp_use_all_columns
(
table
,
table
->
write_set
);
error
=
HA_ERR_CRASHED_ON_USAGE
;
memset
(
buf
,
0
,
table
->
s
->
null_bytes
);
for
(
Field
**
field
=
table
->
field
;
*
field
;
field
++
)
{
buffer
.
length
(
0
);
if
(
file_buff
->
get_value
(
curr_offset
)
==
'"'
)
if
(
curr_offset
<
end_offset
&&
file_buff
->
get_value
(
curr_offset
)
==
'"'
)
curr_offset
++
;
// Incrementpast the first quote
else
{
dbug_tmp_restore_column_map
(
table
->
write_set
,
org_bitmap
);
DBUG_RETURN
(
HA_ERR_CRASHED_ON_USAGE
);
}
for
(;
curr_offset
!=
end_offset
;
curr_offset
++
)
goto
err
;
for
(;
curr_offset
<
end_offset
;
curr_offset
++
)
{
// Need to convert line feeds!
if
(
file_buff
->
get_value
(
curr_offset
)
==
'"'
&&
(((
file_buff
->
get_value
(
curr_offset
+
1
)
==
','
)
&&
(
file_buff
->
get_value
(
curr_offset
+
2
)
==
'"'
))
||
((
file_buff
->
get_value
(
curr_offset
+
1
)
==
','
)
||
(
curr_offset
==
end_offset
-
1
)))
{
curr_offset
+=
2
;
// Move past the , and the "
...
...
@@ -708,10 +712,7 @@ int ha_tina::find_current_row(byte *buf)
we are working with a damaged file.
*/
if
(
curr_offset
==
end_offset
-
1
)
{
dbug_tmp_restore_column_map
(
table
->
write_set
,
org_bitmap
);
DBUG_RETURN
(
HA_ERR_CRASHED_ON_USAGE
);
}
goto
err
;
buffer
.
append
(
file_buff
->
get_value
(
curr_offset
));
}
}
...
...
@@ -719,11 +720,12 @@ int ha_tina::find_current_row(byte *buf)
(
*
field
)
->
store
(
buffer
.
ptr
(),
buffer
.
length
(),
system_charset_info
);
}
next_position
=
end_offset
+
eoln_len
;
/* Maybe use \N for null? */
memset
(
buf
,
0
,
table
->
s
->
null_bytes
);
/* We do not implement nulls! */
error
=
0
;
err:
dbug_tmp_restore_column_map
(
table
->
write_set
,
org_bitmap
);
DBUG_RETURN
(
0
);
DBUG_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