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
342dafb0
Commit
342dafb0
authored
Nov 15, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
27b7b8ab
ecd4ac2a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
17 deletions
+42
-17
heap/heapdef.h
heap/heapdef.h
+2
-1
heap/hp_hash.c
heap/hp_hash.c
+17
-12
heap/hp_rkey.c
heap/hp_rkey.c
+2
-4
mysql-test/r/heap_btree.result
mysql-test/r/heap_btree.result
+14
-0
mysql-test/t/heap_btree.test
mysql-test/t/heap_btree.test
+7
-0
No files found.
heap/heapdef.h
View file @
342dafb0
...
...
@@ -97,7 +97,8 @@ extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key);
extern
my_bool
hp_if_null_in_key
(
HP_KEYDEF
*
keyinfo
,
const
byte
*
record
);
extern
int
hp_close
(
register
HP_INFO
*
info
);
extern
void
hp_clear
(
HP_SHARE
*
info
);
extern
uint
hp_rb_pack_key
(
HP_KEYDEF
*
keydef
,
uchar
*
key
,
const
uchar
*
old
);
extern
uint
hp_rb_pack_key
(
HP_KEYDEF
*
keydef
,
uchar
*
key
,
const
uchar
*
old
,
uint
k_len
);
#ifdef THREAD
extern
pthread_mutex_t
THR_LOCK_heap
;
#else
...
...
heap/hp_hash.c
View file @
342dafb0
...
...
@@ -30,13 +30,13 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
TREE
*
rb_tree
=
&
keyinfo
->
rb_tree
;
heap_rb_param
custom_arg
;
info
->
lastinx
=
inx
;
custom_arg
.
keyseg
=
keyinfo
->
seg
;
custom_arg
.
search_flag
=
SEARCH_FIND
|
SEARCH_SAME
;
custom_arg
.
key_length
=
start_key_len
;
info
->
lastinx
=
inx
;
custom_arg
.
keyseg
=
keyinfo
->
seg
;
custom_arg
.
search_flag
=
SEARCH_FIND
|
SEARCH_SAME
;
if
(
start_key
)
{
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
start_key
);
custom_arg
.
key_length
=
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
start_key
,
start_key_len
);
start_pos
=
tree_record_pos
(
rb_tree
,
info
->
recbuf
,
start_search_flag
,
&
custom_arg
);
}
...
...
@@ -45,10 +45,10 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
start_pos
=
0
;
}
custom_arg
.
key_length
=
end_key_len
;
if
(
end_key
)
{
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
end_key
);
custom_arg
.
key_length
=
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
end_key
,
end_key_len
);
end_pos
=
tree_record_pos
(
rb_tree
,
info
->
recbuf
,
end_search_flag
,
&
custom_arg
);
}
...
...
@@ -450,21 +450,26 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
return
key
-
start_key
;
}
uint
hp_rb_pack_key
(
HP_KEYDEF
*
keydef
,
uchar
*
key
,
const
uchar
*
old
)
uint
hp_rb_pack_key
(
HP_KEYDEF
*
keydef
,
uchar
*
key
,
const
uchar
*
old
,
uint
k_len
)
{
HA_KEYSEG
*
seg
,
*
endseg
;
uchar
*
start_key
=
key
;
for
(
seg
=
keydef
->
seg
,
endseg
=
seg
+
keydef
->
keysegs
;
seg
<
endseg
;
old
+=
seg
->
length
,
seg
++
)
for
(
seg
=
keydef
->
seg
,
endseg
=
seg
+
keydef
->
keysegs
;
seg
<
endseg
&&
(
int
)
k_len
>
0
;
old
+=
seg
->
length
,
seg
++
)
{
if
(
seg
->
null_bit
)
{
k_len
--
;
if
(
!
(
*
key
++=
(
char
)
1
-
*
old
++
))
{
k_len
-=
seg
->
length
;
continue
;
}
}
memcpy
((
byte
*
)
key
,
old
,
seg
->
length
);
key
+=
seg
->
length
;
k_len
-=
seg
->
length
;
}
return
key
-
start_key
;
}
...
...
heap/hp_rkey.c
View file @
342dafb0
...
...
@@ -36,10 +36,9 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
{
heap_rb_param
custom_arg
;
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
key
);
custom_arg
.
keyseg
=
info
->
s
->
keydef
[
inx
].
seg
;
custom_arg
.
key_length
=
key_len
;
custom_arg
.
key_length
=
info
->
lastkey_len
=
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
key
,
key_len
);
custom_arg
.
search_flag
=
SEARCH_FIND
|
SEARCH_SAME
;
/* for next rkey() after deletion */
if
(
find_flag
==
HA_READ_AFTER_KEY
)
...
...
@@ -48,7 +47,6 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
info
->
last_find_flag
=
HA_READ_KEY_OR_PREV
;
else
info
->
last_find_flag
=
find_flag
;
info
->
lastkey_len
=
key_len
;
if
(
!
(
pos
=
tree_search_key
(
&
keyinfo
->
rb_tree
,
info
->
recbuf
,
info
->
parents
,
&
info
->
last_pos
,
find_flag
,
&
custom_arg
)))
{
...
...
mysql-test/r/heap_btree.result
View file @
342dafb0
...
...
@@ -213,6 +213,20 @@ a b
INSERT INTO t1 VALUES (1,3);
Duplicate entry '3' for key 1
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) type=heap;
INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
SELECT * FROM t1 WHERE a=1 and b IS NULL;
a b c
1 NULL NULL
1 NULL 1
SELECT * FROM t1 WHERE a=1 and c IS NULL;
a b c
1 NULL NULL
1 1 NULL
SELECT * FROM t1 WHERE a=1 and b IS NULL and c IS NULL;
a b c
1 NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a int not null, primary key using BTREE (a)) type=heap;
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
DELETE from t1 where a < 100;
...
...
mysql-test/t/heap_btree.test
View file @
342dafb0
...
...
@@ -137,6 +137,13 @@ SELECT * FROM t1 WHERE b<=>NULL;
INSERT
INTO
t1
VALUES
(
1
,
3
);
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
int
,
b
int
,
c
int
,
key
using
BTREE
(
a
,
b
,
c
))
type
=
heap
;
INSERT
INTO
t1
VALUES
(
1
,
NULL
,
NULL
),
(
1
,
1
,
NULL
),
(
1
,
NULL
,
1
);
SELECT
*
FROM
t1
WHERE
a
=
1
and
b
IS
NULL
;
SELECT
*
FROM
t1
WHERE
a
=
1
and
c
IS
NULL
;
SELECT
*
FROM
t1
WHERE
a
=
1
and
b
IS
NULL
and
c
IS
NULL
;
DROP
TABLE
t1
;
#
# Test when deleting all rows
#
...
...
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