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
22f71c2e
Commit
22f71c2e
authored
Dec 11, 2001
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_mi_ft_segiterator function family
parent
3e4bdf60
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
80 deletions
+81
-80
build-tags
build-tags
+0
-11
myisam/ft_update.c
myisam/ft_update.c
+71
-69
myisam/ftdefs.h
myisam/ftdefs.h
+10
-0
No files found.
build-tags
deleted
100755 → 0
View file @
3e4bdf60
#! /bin/sh
if
[
!
-f
configure.in
]
;
then
echo
"
$0
must be run from MySQL source root"
exit
1
fi
rm
-f
TAGS
find
-not
-path
\*
SCCS
\*
-and
\
\(
-name
\*
.cc
-or
-name
\*
.h
-or
-name
\*
.yy
-or
-name
\*
.c
\)
\
-print
-exec
etags
-o
TAGS
--append
{}
\;
myisam/ft_update.c
View file @
22f71c2e
...
...
@@ -27,39 +27,75 @@
#define set_if_smaller(A,B)
/* no op */
/**************************************************************/
void
_mi_ft_segiterator_init
(
MI_INFO
*
info
,
uint
keynr
,
const
byte
*
record
,
FT_SEG_ITERATOR
*
ftsi
)
{
ftsi
->
num
=
info
->
s
->
keyinfo
[
keynr
].
keysegs
-
FT_SEGS
;
ftsi
->
seg
=
info
->
s
->
keyinfo
[
keynr
].
seg
;
ftsi
->
rec
=
record
;
}
/* parses a document i.e. calls ft_parse for every keyseg */
uint
_mi_ft_parse
(
TREE
*
parsed
,
MI_INFO
*
info
,
uint
keynr
,
const
byte
*
record
)
void
_mi_ft_segiterator_dummy_init
(
const
byte
*
record
,
uint
len
,
FT_SEG_ITERATOR
*
ftsi
)
{
byte
*
pos
;
uint
i
;
MI_KEYSEG
*
keyseg
=
info
->
s
->
keyinfo
[
keynr
].
seg
;
ftsi
->
num
=
1
;
ftsi
->
seg
=
0
;
ftsi
->
pos
=
record
;
ftsi
->
len
=
len
;
}
for
(
i
=
info
->
s
->
keyinfo
[
keynr
].
keysegs
-
FT_SEGS
;
i
--
;
)
{
uint
len
;
/* This function breaks convention "return 0 in success"
but it's easier to use like this
keyseg
--
;
if
(
keyseg
->
null_bit
&&
(
record
[
keyseg
->
null_pos
]
&
keyseg
->
null_bit
))
continue
;
/* NULL field */
pos
=
(
byte
*
)
record
+
keyseg
->
start
;
if
(
keyseg
->
flag
&
HA_VAR_LENGTH
)
{
len
=
uint2korr
(
pos
);
pos
+=
2
;
/* Skip VARCHAR length */
set_if_smaller
(
len
,
keyseg
->
length
);
}
else
if
(
keyseg
->
flag
&
HA_BLOB_PART
)
{
len
=
_mi_calc_blob_length
(
keyseg
->
bit_start
,
pos
);
memcpy_fixed
(
&
pos
,
pos
+
keyseg
->
bit_start
,
sizeof
(
char
*
));
set_if_smaller
(
len
,
keyseg
->
length
);
}
else
len
=
keyseg
->
length
;
if
(
ft_parse
(
parsed
,
pos
,
len
))
while(_mi_ft_segiterator())
so "1" means "OK", "0" means "EOF"
*/
uint
_mi_ft_segiterator
(
register
FT_SEG_ITERATOR
*
ftsi
)
{
if
(
!
ftsi
->
num
)
return
0
;
if
(
!
ftsi
->
seg
)
return
1
;
ftsi
->
seg
--
;
ftsi
->
num
--
;
if
(
ftsi
->
seg
->
null_bit
&&
(
ftsi
->
rec
[
ftsi
->
seg
->
null_pos
]
&
ftsi
->
seg
->
null_bit
))
{
ftsi
->
pos
=
0
;
return
1
;
}
ftsi
->
pos
=
ftsi
->
rec
+
ftsi
->
seg
->
start
;
if
(
ftsi
->
seg
->
flag
&
HA_VAR_LENGTH
)
{
ftsi
->
len
=
uint2korr
(
ftsi
->
pos
);
ftsi
->
pos
+=
2
;
/* Skip VARCHAR length */
set_if_smaller
(
ftsi
->
len
,
ftsi
->
seg
->
length
);
return
1
;
}
if
(
ftsi
->
seg
->
flag
&
HA_BLOB_PART
)
{
ftsi
->
len
=
_mi_calc_blob_length
(
ftsi
->
seg
->
bit_start
,
ftsi
->
pos
);
memcpy_fixed
(
&
ftsi
->
pos
,
ftsi
->
pos
+
ftsi
->
seg
->
bit_start
,
sizeof
(
char
*
));
set_if_smaller
(
ftsi
->
len
,
ftsi
->
seg
->
length
);
return
1
;
}
ftsi
->
len
=
ftsi
->
seg
->
length
;
return
1
;
}
/* parses a document i.e. calls ft_parse for every keyseg */
uint
_mi_ft_parse
(
TREE
*
parsed
,
MI_INFO
*
info
,
uint
keynr
,
const
byte
*
record
)
{
FT_SEG_ITERATOR
ftsi
;
_mi_ft_segiterator_init
(
info
,
keynr
,
record
,
&
ftsi
);
while
(
_mi_ft_segiterator
(
&
ftsi
))
if
(
ftsi
.
pos
)
if
(
ft_parse
(
parsed
,
(
byte
*
)
ftsi
.
pos
,
ftsi
.
len
))
return
1
;
/* Handle the case where all columns are NULL */
if
(
!
is_tree_inited
(
parsed
)
&&
ft_parse
(
parsed
,
(
byte
*
)
""
,
0
))
return
1
;
...
...
@@ -117,50 +153,16 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wlist,
int
_mi_ft_cmp
(
MI_INFO
*
info
,
uint
keynr
,
const
byte
*
rec1
,
const
byte
*
rec2
)
{
MI_KEYSEG
*
keyseg
;
byte
*
pos1
,
*
pos2
;
uint
i
;
FT_SEG_ITERATOR
ftsi1
,
ftsi2
;
_mi_ft_segiterator_init
(
info
,
keynr
,
rec1
,
&
ftsi1
)
;
_mi_ft_segiterator_init
(
info
,
keynr
,
rec2
,
&
ftsi2
)
;
i
=
info
->
s
->
keyinfo
[
keynr
].
keysegs
-
FT_SEGS
;
keyseg
=
info
->
s
->
keyinfo
[
keynr
].
seg
;
while
(
i
--
)
while
(
_mi_ft_segiterator
(
&
ftsi1
)
&&
_mi_ft_segiterator
(
&
ftsi2
))
{
uint
len1
,
len2
;
LINT_INIT
(
len1
);
LINT_INIT
(
len2
);
keyseg
--
;
if
(
keyseg
->
null_bit
)
{
if
(
(
rec1
[
keyseg
->
null_pos
]
^
rec2
[
keyseg
->
null_pos
])
&
keyseg
->
null_bit
)
return
THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT
;
if
(
rec1
[
keyseg
->
null_pos
]
&
keyseg
->
null_bit
)
continue
;
/* NULL field */
}
pos1
=
(
byte
*
)
rec1
+
keyseg
->
start
;
pos2
=
(
byte
*
)
rec2
+
keyseg
->
start
;
if
(
keyseg
->
flag
&
HA_VAR_LENGTH
)
{
len1
=
uint2korr
(
pos1
);
pos1
+=
2
;
/* Skip VARCHAR length */
set_if_smaller
(
len1
,
keyseg
->
length
);
len2
=
uint2korr
(
pos2
);
pos2
+=
2
;
/* Skip VARCHAR length */
set_if_smaller
(
len2
,
keyseg
->
length
);
}
else
if
(
keyseg
->
flag
&
HA_BLOB_PART
)
{
len1
=
_mi_calc_blob_length
(
keyseg
->
bit_start
,
pos1
);
memcpy_fixed
(
&
pos1
,
pos1
+
keyseg
->
bit_start
,
sizeof
(
char
*
));
set_if_smaller
(
len1
,
keyseg
->
length
);
len2
=
_mi_calc_blob_length
(
keyseg
->
bit_start
,
pos2
);
memcpy_fixed
(
&
pos2
,
pos2
+
keyseg
->
bit_start
,
sizeof
(
char
*
));
set_if_smaller
(
len2
,
keyseg
->
length
);
}
else
/* fixed length key */
{
len1
=
len2
=
keyseg
->
length
;
}
if
((
len1
!=
len2
)
||
memcmp
(
pos1
,
pos2
,
len1
))
if
((
ftsi1
.
pos
!=
ftsi2
.
pos
)
&&
_mi_compare_text
(
default_charset_info
,
(
uchar
*
)
ftsi1
.
pos
,
ftsi1
.
len
,
(
uchar
*
)
ftsi2
.
pos
,
ftsi2
.
len
,
0
))
return
THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT
;
}
return
GEE_THEY_ARE_ABSOLUTELY_IDENTICAL
;
...
...
myisam/ftdefs.h
View file @
22f71c2e
...
...
@@ -120,6 +120,16 @@ uint _ft_make_key(MI_INFO *, uint , byte *, FT_WORD *, my_off_t);
byte
ft_get_word
(
byte
**
,
byte
*
,
FT_WORD
*
,
FTB_PARAM
*
);
byte
ft_simple_get_word
(
byte
**
,
byte
*
,
FT_WORD
*
);
typedef
struct
_st_ft_seg_iterator
{
uint
num
,
len
;
MI_KEYSEG
*
seg
;
const
byte
*
rec
,
*
pos
;
}
FT_SEG_ITERATOR
;
void
_mi_ft_segiterator_init
(
MI_INFO
*
,
uint
,
const
byte
*
,
FT_SEG_ITERATOR
*
);
void
_mi_ft_segiterator_dummy_init
(
const
byte
*
,
uint
,
FT_SEG_ITERATOR
*
);
uint
_mi_ft_segiterator
(
FT_SEG_ITERATOR
*
);
int
ft_parse
(
TREE
*
,
byte
*
,
int
);
FT_WORD
*
ft_linearize
(
/*MI_INFO *, uint, byte *, */
TREE
*
);
FT_WORD
*
_mi_ft_parserecord
(
MI_INFO
*
,
uint
,
byte
*
,
const
byte
*
);
...
...
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