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
374a28d2
Commit
374a28d2
authored
May 27, 2004
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merging
parents
f0d79c5a
164a9e35
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
90 additions
and
9 deletions
+90
-9
myisam/mi_create.c
myisam/mi_create.c
+7
-0
myisam/mi_key.c
myisam/mi_key.c
+4
-0
myisam/mi_open.c
myisam/mi_open.c
+9
-0
myisam/mi_range.c
myisam/mi_range.c
+2
-0
myisam/mi_rkey.c
myisam/mi_rkey.c
+2
-0
myisam/mi_rnext.c
myisam/mi_rnext.c
+4
-1
myisam/mi_rnext_same.c
myisam/mi_rnext_same.c
+2
-0
myisam/rt_index.c
myisam/rt_index.c
+5
-0
myisam/rt_index.h
myisam/rt_index.h
+3
-0
myisam/rt_key.c
myisam/rt_key.c
+3
-0
myisam/rt_key.h
myisam/rt_key.h
+3
-0
myisam/rt_mbr.c
myisam/rt_mbr.c
+4
-0
myisam/rt_mbr.h
myisam/rt_mbr.h
+3
-0
myisam/rt_split.c
myisam/rt_split.c
+4
-0
myisam/rt_test.c
myisam/rt_test.c
+10
-0
myisam/sp_defs.h
myisam/sp_defs.h
+3
-0
myisam/sp_key.c
myisam/sp_key.c
+5
-0
myisam/sp_test.c
myisam/sp_test.c
+10
-0
sql/spatial.cc
sql/spatial.cc
+4
-0
sql/spatial.h
sql/spatial.h
+3
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+0
-8
No files found.
myisam/mi_create.c
View file @
374a28d2
...
...
@@ -242,6 +242,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length
=
pointer
;
if
(
keydef
->
flag
&
HA_SPATIAL
)
{
#ifdef HAVE_SPATIAL
/* BAR TODO to support 3D and more dimensions in the future */
uint
sp_segs
=
SPDIMS
*
2
;
keydef
->
flag
=
HA_SPATIAL
;
...
...
@@ -270,6 +271,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length
+=
SPLEN
*
sp_segs
;
length
++
;
/* At least one length byte */
min_key_length_skip
+=
SPLEN
*
2
*
SPDIMS
;
#else
my_errno
=
HA_ERR_UNSUPPORTED
;
goto
err
;
#endif
/*HAVE_SPATIAL*/
}
else
if
(
keydef
->
flag
&
HA_FULLTEXT
)
...
...
@@ -588,6 +593,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
for
(
j
=
0
;
j
<
keydefs
[
i
].
keysegs
-
sp_segs
;
j
++
)
if
(
mi_keyseg_write
(
file
,
&
keydefs
[
i
].
seg
[
j
]))
goto
err
;
#ifdef HAVE_SPATIAL
for
(
j
=
0
;
j
<
sp_segs
;
j
++
)
{
HA_KEYSEG
sseg
;
...
...
@@ -603,6 +609,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if
(
mi_keyseg_write
(
file
,
&
sseg
))
goto
err
;
}
#endif
}
/* Create extra keys for unique definitions */
offset
=
reclength
-
uniques
*
MI_UNIQUE_HASH_LENGTH
;
...
...
myisam/mi_key.c
View file @
374a28d2
...
...
@@ -46,7 +46,11 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
/*
TODO: nulls processing
*/
#ifdef HAVE_SPATIAL
return
sp_make_key
(
info
,
keynr
,
key
,
record
,
filepos
);
#else
DBUG_ASSERT
(
0
);
/* mi_open should check that this never happens*/
#endif
}
start
=
key
;
...
...
myisam/mi_open.c
View file @
374a28d2
...
...
@@ -327,9 +327,14 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
if
(
share
->
keyinfo
[
i
].
flag
&
HA_SPATIAL
)
{
#ifdef HAVE_SPATIAL
uint
sp_segs
=
SPDIMS
*
2
;
share
->
keyinfo
[
i
].
seg
=
pos
-
sp_segs
;
share
->
keyinfo
[
i
].
keysegs
--
;
#else
my_errno
=
HA_ERR_UNSUPPORTED
;
goto
err
;
#endif
}
else
if
(
share
->
keyinfo
[
i
].
flag
&
HA_FULLTEXT
)
{
...
...
@@ -726,8 +731,12 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
{
if
(
keyinfo
->
key_alg
==
HA_KEY_ALG_RTREE
)
{
#ifdef HAVE_RTREE_KEYS
keyinfo
->
ck_insert
=
rtree_insert
;
keyinfo
->
ck_delete
=
rtree_delete
;
#else
DBUG_ASSERT
(
0
);
/* mi_open should check it never happens */
#endif
}
else
{
...
...
myisam/mi_range.c
View file @
374a28d2
...
...
@@ -65,6 +65,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
rw_rdlock
(
&
info
->
s
->
key_root_lock
[
inx
]);
switch
(
info
->
s
->
keyinfo
[
inx
].
key_alg
){
#ifdef HAVE_RTREE_KEYS
case
HA_KEY_ALG_RTREE
:
{
uchar
*
key_buff
;
...
...
@@ -79,6 +80,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
res
=
res
?
res
:
1
;
/* Don't return 0 */
break
;
}
#endif
case
HA_KEY_ALG_BTREE
:
default:
start_pos
=
(
min_key
?
...
...
myisam/mi_rkey.c
View file @
374a28d2
...
...
@@ -74,6 +74,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
use_key_length
=
USE_WHOLE_KEY
;
switch
(
info
->
s
->
keyinfo
[
inx
].
key_alg
)
{
#ifdef HAVE_RTREE_KEYS
case
HA_KEY_ALG_RTREE
:
if
(
rtree_find_first
(
info
,
inx
,
key_buff
,
use_key_length
,
nextflag
)
<
0
)
{
...
...
@@ -81,6 +82,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
goto
err
;
}
break
;
#endif
case
HA_KEY_ALG_BTREE
:
default:
if
(
!
_mi_search
(
info
,
keyinfo
,
key_buff
,
use_key_length
,
...
...
myisam/mi_rnext.c
View file @
374a28d2
...
...
@@ -45,9 +45,11 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
if
(
!
flag
)
{
switch
(
info
->
s
->
keyinfo
[
inx
].
key_alg
){
#ifdef HAVE_RTREE_KEYS
case
HA_KEY_ALG_RTREE
:
error
=
rtree_get_first
(
info
,
inx
,
info
->
lastkey_length
);
break
;
#endif
case
HA_KEY_ALG_BTREE
:
default:
error
=
_mi_search_first
(
info
,
info
->
s
->
keyinfo
+
inx
,
...
...
@@ -58,6 +60,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
else
{
switch
(
info
->
s
->
keyinfo
[
inx
].
key_alg
)
{
#ifdef HAVE_RTREE_KEYS
case
HA_KEY_ALG_RTREE
:
/*
Note that rtree doesn't support that the table
...
...
@@ -66,7 +69,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
*/
error
=
rtree_get_next
(
info
,
inx
,
info
->
lastkey_length
);
break
;
#endif
case
HA_KEY_ALG_BTREE
:
default:
if
(
!
changed
)
...
...
myisam/mi_rnext_same.c
View file @
374a28d2
...
...
@@ -43,6 +43,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
switch
(
keyinfo
->
key_alg
)
{
#ifdef HAVE_RTREE_KEYS
case
HA_KEY_ALG_RTREE
:
if
((
error
=
rtree_find_next
(
info
,
inx
,
myisam_read_vec
[
info
->
last_key_func
])))
...
...
@@ -53,6 +54,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
break
;
}
break
;
#endif
case
HA_KEY_ALG_BTREE
:
default:
memcpy
(
info
->
lastkey2
,
info
->
lastkey
,
info
->
last_rkey_length
);
...
...
myisam/rt_index.c
View file @
374a28d2
...
...
@@ -17,6 +17,8 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
...
...
@@ -991,3 +993,6 @@ err1:
my_afree
((
byte
*
)
page_buf
);
return
HA_POS_ERROR
;
}
#endif
/*HAVE_RTREE_KEYS*/
myisam/rt_index.h
View file @
374a28d2
...
...
@@ -18,6 +18,8 @@
#ifndef _rt_index_h
#define _rt_index_h
#ifdef HAVE_RTREE_KEYS
#define rt_PAGE_FIRST_KEY(page, nod_flag) (page + 2 + nod_flag)
#define rt_PAGE_NEXT_KEY(key, key_length, nod_flag) (key + key_length + \
(nod_flag ? nod_flag : info->s->base.rec_reflength))
...
...
@@ -41,4 +43,5 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
int
rtree_split_page
(
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
page
,
uchar
*
key
,
uint
key_length
,
my_off_t
*
new_page_offs
);
#endif
/*HAVE_RTREE_KEYS*/
#endif
/* _rt_index_h */
myisam/rt_key.c
View file @
374a28d2
...
...
@@ -16,6 +16,7 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
...
...
@@ -137,3 +138,5 @@ uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
}
return
best_key
;
}
#endif
/*HAVE_RTREE_KEYS*/
myisam/rt_key.h
View file @
374a28d2
...
...
@@ -20,6 +20,8 @@
#ifndef _rt_key_h
#define _rt_key_h
#ifdef HAVE_RTREE_KEYS
int
rtree_add_key
(
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
uint
key_length
,
uchar
*
page_buf
,
my_off_t
*
new_page
);
int
rtree_delete_key
(
MI_INFO
*
info
,
uchar
*
page
,
uchar
*
key
,
...
...
@@ -28,4 +30,5 @@ int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint
key_length
,
my_off_t
child_page
);
uchar
*
rtree_choose_key
(
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
uint
key_length
,
uchar
*
page_buf
,
uint
nod_flag
);
#endif
/*HAVE_RTREE_KEYS*/
#endif
/* _rt_key_h */
myisam/rt_mbr.c
View file @
374a28d2
...
...
@@ -17,6 +17,8 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_mbr.h"
...
...
@@ -757,3 +759,5 @@ int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
}
return
0
;
}
#endif
/*HAVE_RTREE_KEYS*/
myisam/rt_mbr.h
View file @
374a28d2
...
...
@@ -18,6 +18,8 @@
#ifndef _rt_mbr_h
#define _rt_mbr_h
#ifdef HAVE_RTREE_KEYS
int
rtree_key_cmp
(
HA_KEYSEG
*
keyseg
,
uchar
*
a
,
uchar
*
b
,
uint
key_length
,
uint
nextflag
);
int
rtree_combine_rect
(
HA_KEYSEG
*
keyseg
,
uchar
*
,
uchar
*
,
uchar
*
,
...
...
@@ -30,4 +32,5 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint
key_length
,
double
*
ab_area
);
int
rtree_page_mbr
(
MI_INFO
*
info
,
HA_KEYSEG
*
keyseg
,
uchar
*
page_buf
,
uchar
*
c
,
uint
key_length
);
#endif
/*HAVE_RTREE_KEYS*/
#endif
/* _rt_mbr_h */
myisam/rt_split.c
View file @
374a28d2
...
...
@@ -17,6 +17,8 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
...
...
@@ -346,3 +348,5 @@ split_err:
my_free
((
gptr
)
coord_buf
,
MYF
(
0
));
return
err_code
;
}
#endif
/*HAVE_RTREE_KEYS*/
myisam/rt_test.c
View file @
374a28d2
...
...
@@ -19,6 +19,9 @@
#include "myisam.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#define MAX_REC_LENGTH 1024
...
...
@@ -398,3 +401,10 @@ static void create_record(char *record,uint rownr)
pos
+=
sizeof
(
c
);
}
}
#else
int
main
(
int
argc
__attribute__
((
unused
)),
char
*
argv
[]
__attribute__
((
unused
)))
{
exit
(
0
);
}
#endif
/*HAVE_RTREE_KEYS*/
myisam/sp_defs.h
View file @
374a28d2
...
...
@@ -22,6 +22,8 @@
#define SPTYPE HA_KEYTYPE_DOUBLE
#define SPLEN 8
#ifdef HAVE_SPATIAL
enum
wkbType
{
wkbPoint
=
1
,
...
...
@@ -42,4 +44,5 @@ enum wkbByteOrder
uint
sp_make_key
(
register
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
const
byte
*
record
,
my_off_t
filepos
);
#endif
/*HAVE_SPATIAL*/
#endif
/* _SP_DEFS_H */
myisam/sp_key.c
View file @
374a28d2
...
...
@@ -15,6 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "myisamdef.h"
#ifdef HAVE_SPATIAL
#include "sp_defs.h"
static
int
sp_add_point_to_mbr
(
uchar
*
(
*
wkb
),
uchar
*
end
,
uint
n_dims
,
...
...
@@ -284,3 +287,5 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
}
return
res
;
}
#endif
/*HAVE_SPATIAL*/
myisam/sp_test.c
View file @
374a28d2
...
...
@@ -18,6 +18,8 @@
/* Written by Alex Barkov, who has a shared copyright to this code */
#include "myisam.h"
#ifdef HAVE_SPATIAL
#include "sp_defs.h"
#define MAX_REC_LENGTH 1024
...
...
@@ -553,3 +555,11 @@ static void rtree_PrintWKB(uchar *wkb, uint n_dims)
}
}
}
#else
int
main
(
int
argc
__attribute__
((
unused
)),
char
*
argv
[]
__attribute__
((
unused
)))
{
exit
(
0
);
}
#endif
/*HAVE_SPATIAL*/
sql/spatial.cc
View file @
374a28d2
...
...
@@ -15,6 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#ifdef HAVE_SPATIAL
#define MAX_DIGITS_IN_DOUBLE 16
/***************************** Gis_class_info *******************************/
...
...
@@ -1652,3 +1655,4 @@ const Geometry::Class_info *Gis_geometry_collection::get_class_info() const
return
&
geometrycollection_class
;
}
#endif
/*HAVE_SPATIAL*/
sql/spatial.h
View file @
374a28d2
...
...
@@ -17,6 +17,8 @@
#ifndef _spatial_h
#define _spatial_h
#ifdef HAVE_SPATIAL
const
uint
SRID_SIZE
=
4
;
const
uint
SIZEOF_STORED_DOUBLE
=
8
;
const
uint
POINT_DATA_SIZE
=
SIZEOF_STORED_DOUBLE
*
2
;
...
...
@@ -459,4 +461,5 @@ struct Geometry_buffer
void
*
arr
[(
geometry_buffer_size
-
1
)
/
sizeof
(
void
*
)
+
1
];
};
#endif
/*HAVE_SPATAIAL*/
#endif
sql/sql_yacc.yy
View file @
374a28d2
...
...
@@ -1312,7 +1312,6 @@ type:
$$=FIELD_TYPE_GEOMETRY;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name,
sym_group_geom.needed_define);
YYABORT;
...
...
@@ -1630,7 +1629,6 @@ key_type:
$$= Key::SPATIAL;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
...
...
@@ -1664,7 +1662,6 @@ opt_unique_or_fulltext:
$$= Key::SPATIAL;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
...
...
@@ -2676,7 +2673,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
...
...
@@ -2688,7 +2684,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
...
...
@@ -2700,7 +2695,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
...
...
@@ -2712,7 +2706,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
...
...
@@ -2809,7 +2802,6 @@ simple_expr:
$$= $1;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
...
...
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