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
d74558eb
Commit
d74558eb
authored
Jun 24, 2004
by
ingo@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/mydev/mysql-4.0
into mysql.com:/home/mydev/mysql-4.0-bug2688
parents
c9b1946c
e1cd282e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+18
-0
mysql-test/t/bdb.test
mysql-test/t/bdb.test
+18
-0
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+31
-0
No files found.
mysql-test/r/bdb.result
View file @
d74558eb
...
...
@@ -1190,3 +1190,21 @@ a
A
a
drop table t1;
create table t1 (
pk1 varchar(8) not null default '',
pk2 varchar(4) not null default '',
key1 int(11) default null,
key2 int(11) default null,
primary key (pk1,pk2),
key key1 (key1),
key key2 (key2)) engine=bdb;
insert into t1 values ('','empt',2,2), ('a','a--a',2,2),
('bb','b--b',2,2), ('ccc','c--c',2,2), ('dddd','d--d',2,2);
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
pk1 pk2 key1 key2
empt 2 2
a a--a 2 2
bb b--b 2 2
ccc c--c 2 2
dddd d--d 2 2
drop table t1;
mysql-test/t/bdb.test
View file @
d74558eb
...
...
@@ -829,3 +829,21 @@ alter table t1 modify a char(10) binary;
explain
select
a
from
t1
;
select
a
from
t1
;
drop
table
t1
;
#
# bug#2688 - Wrong index_merge query results for BDB table with variable length primary key
#
create
table
t1
(
pk1
varchar
(
8
)
not
null
default
''
,
pk2
varchar
(
4
)
not
null
default
''
,
key1
int
(
11
)
default
null
,
key2
int
(
11
)
default
null
,
primary
key
(
pk1
,
pk2
),
key
key1
(
key1
),
key
key2
(
key2
))
engine
=
bdb
;
insert
into
t1
values
(
''
,
'empt'
,
2
,
2
),
(
'a'
,
'a--a'
,
2
,
2
),
(
'bb'
,
'b--b'
,
2
,
2
),
(
'ccc'
,
'c--c'
,
2
,
2
),
(
'dddd'
,
'd--d'
,
2
,
2
);
select
*
from
t1
force
index
(
key1
,
key2
)
where
key1
<
3
or
key2
<
3
;
drop
table
t1
;
sql/ha_berkeley.cc
View file @
d74558eb
...
...
@@ -1611,13 +1611,44 @@ int ha_berkeley::rnd_pos(byte * buf, byte *pos)
(
char
*
)
buf
,
primary_key
,
&
current_row
,
(
DBT
*
)
0
,
0
));
}
/*
Set a reference to the current record in (ref,ref_length).
SYNOPSIS
ha_berkeley::position()
record The current record buffer
DESCRIPTION
The BDB handler stores the primary key in (ref,ref_length).
There is either an explicit primary key, or an implicit (hidden)
primary key.
During open(), 'ref_length' is calculated as the maximum primary
key length. When an actual key is shorter than that, the rest of
the buffer must be cleared out. The row cannot be identified, if
garbage follows behind the end of the key. There is no length
field for the current key, so that the whole ref_length is used
for comparison.
RETURN
nothing
*/
void
ha_berkeley
::
position
(
const
byte
*
record
)
{
DBT
key
;
DBUG_ENTER
(
"ha_berkeley::position"
);
if
(
hidden_primary_key
)
{
DBUG_ASSERT
(
ref_length
==
BDB_HIDDEN_PRIMARY_KEY_LENGTH
);
memcpy_fixed
(
ref
,
(
char
*
)
current_ident
,
BDB_HIDDEN_PRIMARY_KEY_LENGTH
);
}
else
{
create_key
(
&
key
,
primary_key
,
(
char
*
)
ref
,
record
);
if
(
key
.
size
<
ref_length
)
bzero
(
ref
+
key
.
size
,
ref_length
-
key
.
size
);
}
DBUG_VOID_RETURN
;
}
...
...
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