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
2b6776d3
Commit
2b6776d3
authored
Jul 24, 2001
by
tim@white.box
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case for update/replace bug in bdb.
Remove unused argument to ha_berkeley::remove_key().
parent
c61f04b0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
16 deletions
+19
-16
.bzrignore
.bzrignore
+2
-0
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+2
-0
mysql-test/t/bdb.test
mysql-test/t/bdb.test
+7
-0
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+7
-14
sql/ha_berkeley.h
sql/ha_berkeley.h
+1
-2
No files found.
.bzrignore
View file @
2b6776d3
...
...
@@ -289,3 +289,5 @@ tags
tmp/*
myisam/test1.MYD
myisam/test1.MYI
.gdbinit
.vimrc
mysql-test/r/bdb.result
View file @
2b6776d3
...
...
@@ -139,6 +139,8 @@ t1 1 level 1 level A 3 NULL NULL
gesuchnr benutzer_id
1 1
2 1
id x
1 2
Table Op Msg_type Msg_text
test.t1 optimize status OK
a
...
...
mysql-test/t/bdb.test
View file @
2b6776d3
...
...
@@ -65,6 +65,13 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
select
*
from
t1
;
drop
table
t1
;
# test for bug in replace with secondary key
create
table
t1
(
id
int
not
null
primary
key
,
x
int
not
null
,
key
(
x
))
type
=
bdb
;
insert
into
t1
(
id
,
x
)
values
(
1
,
1
);
replace
into
t1
(
id
,
x
)
values
(
1
,
2
);
select
*
from
t1
;
drop
table
t1
;
#
# test delete using hidden_primary_key
#
...
...
sql/ha_berkeley.cc
View file @
2b6776d3
...
...
@@ -888,7 +888,7 @@ int ha_berkeley::write_row(byte * record)
if
(
changed_keys
&
1
)
{
if
((
new_error
=
remove_key
(
sub_trans
,
keynr
,
record
,
(
DBT
*
)
0
,
&
prim_key
)))
&
prim_key
)))
break
;
/* purecov: inspected */
}
}
...
...
@@ -970,7 +970,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
{
// Primary key changed or we are updating a key that can have duplicates.
// Delete the old row and add a new one
if
(
!
(
error
=
remove_key
(
trans
,
primary_key
,
old_row
,
(
DBT
*
)
0
,
old_key
)))
if
(
!
(
error
=
remove_key
(
trans
,
primary_key
,
old_row
,
old_key
)))
{
if
(
!
(
error
=
pack_row
(
&
row
,
new_row
,
0
)))
{
...
...
@@ -1034,7 +1034,7 @@ int ha_berkeley::restore_keys(DB_TXN *trans, key_map changed_keys,
if
(
changed_keys
&
1
)
{
if
(
changed_keys
!=
1
&&
(
error
=
remove_key
(
trans
,
keynr
,
new_row
,
(
DBT
*
)
0
,
new_key
)))
(
error
=
remove_key
(
trans
,
keynr
,
new_row
,
new_key
)))
break
;
/* purecov: inspected */
if
((
error
=
key_file
[
keynr
]
->
put
(
key_file
[
keynr
],
trans
,
create_key
(
&
tmp_key
,
keynr
,
key_buff2
,
...
...
@@ -1105,8 +1105,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
continue
;
if
(
key_cmp
(
keynr
,
old_row
,
new_row
)
||
primary_key_changed
)
{
if
((
error
=
remove_key
(
sub_trans
,
keynr
,
old_row
,
(
DBT
*
)
0
,
&
old_prim_key
)))
if
((
error
=
remove_key
(
sub_trans
,
keynr
,
old_row
,
&
old_prim_key
)))
{
if
(
using_ignore
&&
/* purecov: inspected */
(
thd_options
&
OPTION_INTERNAL_SUBTRANSACTIONS
))
...
...
@@ -1172,11 +1171,9 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
Delete one key
This uses key_buff2, when keynr != primary key, so it's important that
a function that calls this doesn't use this buffer for anything else.
packed_record may be NULL if the key is unique
*/
int
ha_berkeley
::
remove_key
(
DB_TXN
*
trans
,
uint
keynr
,
const
byte
*
record
,
DBT
*
packed_record
,
DBT
*
prim_key
)
{
int
error
;
...
...
@@ -1208,12 +1205,8 @@ int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record,
&
tmp_cursor
,
0
)))
{
if
(
!
(
error
=
tmp_cursor
->
c_get
(
tmp_cursor
,
(
keynr
==
primary_key
?
prim_key
:
create_key
(
&
key
,
keynr
,
key_buff2
,
record
)),
(
keynr
==
primary_key
?
packed_record
:
prim_key
),
DB_GET_BOTH
|
DB_RMW
)))
create_key
(
&
key
,
keynr
,
key_buff2
,
record
),
prim_key
,
DB_GET_BOTH
|
DB_RMW
)))
{
// This shouldn't happen
error
=
tmp_cursor
->
c_del
(
tmp_cursor
,
0
);
}
...
...
@@ -1236,7 +1229,7 @@ int ha_berkeley::remove_keys(DB_TXN *trans, const byte *record,
{
if
(
keys
&
1
)
{
int
new_error
=
remove_key
(
trans
,
keynr
,
record
,
new_record
,
prim_key
);
int
new_error
=
remove_key
(
trans
,
keynr
,
record
,
prim_key
);
if
(
new_error
)
{
result
=
new_error
;
// Return last error /* purecov: inspected */
...
...
sql/ha_berkeley.h
View file @
2b6776d3
...
...
@@ -69,8 +69,7 @@ class ha_berkeley: public handler
int
key_length
=
MAX_KEY_LENGTH
);
DBT
*
pack_key
(
DBT
*
key
,
uint
keynr
,
char
*
buff
,
const
byte
*
key_ptr
,
uint
key_length
);
int
remove_key
(
DB_TXN
*
trans
,
uint
keynr
,
const
byte
*
record
,
DBT
*
packed_record
,
DBT
*
prim_key
);
int
remove_key
(
DB_TXN
*
trans
,
uint
keynr
,
const
byte
*
record
,
DBT
*
prim_key
);
int
remove_keys
(
DB_TXN
*
trans
,
const
byte
*
record
,
DBT
*
new_record
,
DBT
*
prim_key
,
key_map
keys
);
int
restore_keys
(
DB_TXN
*
trans
,
key_map
changed_keys
,
uint
primary_key
,
...
...
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