开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 51

tomdev/MySQLAdvisor

forked from nwsuafzq/MySQLAdvisor
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (2)
master
develop
master
分支 (2)
master
develop
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (2)
master
develop
MySQLAdvisor
/
sql
/
spatial.h
MySQLAdvisor
/
sql
/
spatial.h
spatial.h 21.57 KB
一键复制 编辑 原始数据 按行查看 历史
坚守 提交于 2017年03月06日 15:34 +08:00 . 初始化sqladvisor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef _spatial_h
#define _spatial_h
#include "sql_string.h" /* String, LEX_STRING */
#include <my_compiler.h>
#ifdef HAVE_SPATIAL
#include <algorithm>
const uint SRID_SIZE= 4;
const uint SIZEOF_STORED_DOUBLE= 8;
const uint POINT_DATA_SIZE= (SIZEOF_STORED_DOUBLE * 2);
const uint WKB_HEADER_SIZE= 1+4;
const uint32 GET_SIZE_ERROR= ((uint32) -1);
/**
Point with coordinates X and Y.
*/
class point_xy
{
public:
double x;
double y;
point_xy() { }
point_xy(double x_arg, double y_arg): x(x_arg), y(y_arg) { }
/**
Distance to another point.
*/
double distance(point_xy p)
{
return sqrt(pow(x - p.x, 2) + pow(y - p.y, 2));
}
/**
Compare to another point.
Return true if equal, false if not equal.
*/
bool eq(point_xy p)
{
return (x == p.x) && (y == p.y);
}
};
typedef struct wkb_header_st
{
uchar byte_order;
uint32 wkb_type;
} wkb_header;
/***************************** MBR *******************************/
/*
It's ok that a lot of the functions are inline as these are only used once
in MySQL
*/
struct MBR
{
double xmin, ymin, xmax, ymax;
MBR()
{
xmin= ymin= DBL_MAX;
xmax= ymax= -DBL_MAX;
}
MBR(const double xmin_arg, const double ymin_arg,
const double xmax_arg, const double ymax_arg)
:xmin(xmin_arg), ymin(ymin_arg), xmax(xmax_arg), ymax(ymax_arg)
{}
MBR(const point_xy &min, const point_xy &max)
:xmin(min.x), ymin(min.y), xmax(max.x), ymax(max.y)
{}
inline void add_xy(double x, double y)
{
/* Not using "else" for proper one point MBR calculation */
if (x < xmin)
xmin= x;
if (x > xmax)
xmax= x;
if (y < ymin)
ymin= y;
if (y > ymax)
ymax= y;
}
void add_xy(point_xy p)
{
add_xy(p.x, p.y);
}
void add_xy(const char *px, const char *py)
{
double x, y;
float8get(x, px);
float8get(y, py);
add_xy(x,y);
}
void add_mbr(const MBR *mbr)
{
if (mbr->xmin < xmin)
xmin= mbr->xmin;
if (mbr->xmax > xmax)
xmax= mbr->xmax;
if (mbr->ymin < ymin)
ymin= mbr->ymin;
if (mbr->ymax > ymax)
ymax= mbr->ymax;
}
int equals(const MBR *mbr)
{
/* The following should be safe, even if we compare doubles */
return ((mbr->xmin == xmin) && (mbr->ymin == ymin) &&
(mbr->xmax == xmax) && (mbr->ymax == ymax));
}
int disjoint(const MBR *mbr)
{
/* The following should be safe, even if we compare doubles */
return ((mbr->xmin > xmax) || (mbr->ymin > ymax) ||
(mbr->xmax < xmin) || (mbr->ymax < ymin));
}
int intersects(const MBR *mbr)
{
return !disjoint(mbr);
}
int touches(const MBR *mbr)
{
/* The following should be safe, even if we compare doubles */
return ((mbr->xmin == xmax || mbr->xmax == xmin) &&
((mbr->ymin >= ymin && mbr->ymin <= ymax) ||
(mbr->ymax >= ymin && mbr->ymax <= ymax))) ||
((mbr->ymin == ymax || mbr->ymax == ymin) &&
((mbr->xmin >= xmin && mbr->xmin <= xmax) ||
(mbr->xmax >= xmin && mbr->xmax <= xmax)));
}
int within(const MBR *mbr)
{
/* The following should be safe, even if we compare doubles */
return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) &&
(mbr->xmax >= xmax) && (mbr->ymax >= ymax));
}
int contains(const MBR *mbr)
{
/* The following should be safe, even if we compare doubles */
return ((mbr->xmin >= xmin) && (mbr->ymin >= ymin) &&
(mbr->xmax <= xmax) && (mbr->ymax <= ymax));
}
bool inner_point(double x, double y) const
{
/* The following should be safe, even if we compare doubles */
return (xmin<x) && (xmax>x) && (ymin<y) && (ymax>y);
}
/**
The dimension maps to an integer as:
- Polygon -> 2
- Horizontal or vertical line -> 1
- Point -> 0
- Invalid MBR -> -1
*/
int dimension() const
{
int d= 0;
if (xmin > xmax)
return -1;
else if (xmin < xmax)
d++;
if (ymin > ymax)
return -1;
else if (ymin < ymax)
d++;
return d;
}
int overlaps(const MBR *mbr)
{
/*
overlaps() requires that some point inside *this is also inside
*mbr, and that both geometries and their intersection are of the
same dimension.
*/
int d = dimension();
if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr))
return 0;
using std::min;
using std::max;
MBR intersection(max(xmin, mbr->xmin), max(ymin, mbr->ymin),
min(xmax, mbr->xmax), min(ymax, mbr->ymax));
return (d == intersection.dimension());
}
};
/***************************** Geometry *******************************/
struct Geometry_buffer;
class Geometry
{
public:
Geometry() {} /* Remove gcc warning */
virtual ~Geometry() {} /* Remove gcc warning */
static void *operator new(size_t size, void *buffer)
{
return buffer;
}
static void operator delete(void *ptr, void *buffer)
{}
static void operator delete(void *buffer)
{}
static String bad_geometry_data;
enum wkbType
{
wkb_point= 1,
wkb_linestring= 2,
wkb_polygon= 3,
wkb_multipoint= 4,
wkb_multilinestring= 5,
wkb_multipolygon= 6,
wkb_geometrycollection= 7,
wkb_last=7
};
enum wkbByteOrder
{
wkb_xdr= 0, /* Big Endian */
wkb_ndr= 1 /* Little Endian */
};
/**
Constant storage for WKB.
Encapsulation and the available methods make it impossible
to update the members of wkb_container once it is initialized.
The only allowed modification method is set(),
which fully replaces the previous buffer.
*/
class wkb_container
{
protected:
const char *m_data;
const char *m_data_end;
public:
wkb_container() { }
wkb_container(const char *data, const char *data_end)
{
set(data, data_end);
}
void set(const char *data, const char *data_end)
{
m_data= data;
m_data_end= data_end;
}
const char *data() const
{
return m_data;
}
const char *data_end() const
{
return m_data_end;
}
uint32 length() const
{
return (uint32) (m_data_end - m_data);
}
/**
Check if there's enough data remaining as requested.
@arg data_amount data requested
@return true if not enough data
*/
inline bool no_data(size_t data_amount) const
{
return (m_data + data_amount > m_data_end);
}
/**
Check if there're enough points remaining as requested.
Need to perform the calculation in logical units, since multiplication
can overflow the size data type.
@arg expected_points number of points expected
@arg extra_point_space extra space for each point element in the array
@return true if there are not enough points
*/
inline bool not_enough_points(uint32 expected_points,
uint32 extra_point_space= 0) const
{
return (m_data_end < m_data ||
expected_points > ((m_data_end - m_data) /
(POINT_DATA_SIZE + extra_point_space)));
}
};
/**
WKB parser, designed to traverse through WKB data from
beginning of the buffer towards the end using a set
of scan_xxx(), get_xxx() and skip_xxx() routines,
with safety tests to avoid going beyond the buffer end.
*/
class wkb_parser: public wkb_container
{
/* Low level routines to get data of various types */
void get_uint4(uint32 *number)
{
*number= uint4korr(m_data); //GIS-TODO: byte order
}
void get_float8(double *x)
{
float8get(*x, m_data); //GIS-TODO: byte order
}
public:
wkb_parser(const char *data, const char *data_end):
wkb_container(data, data_end) { }
wkb_parser(const wkb_container *container):
wkb_container(*container) { }
/* Routines to skip non-interesting data */
void skip_unsafe(size_t nbytes)
{
DBUG_ASSERT(!no_data(nbytes));
m_data+= nbytes;
}
bool skip(size_t nbytes)
{
if (no_data(nbytes))
return true;
m_data+= nbytes;
return false;
}
bool skip_wkb_header()
{
return skip(WKB_HEADER_SIZE);
}
bool skip_coord()
{
return skip(SIZEOF_STORED_DOUBLE);
}
/* Routines to scan wkb header information */
bool scan_wkb_header(wkb_header *header)
{
if (no_data(WKB_HEADER_SIZE))
return true;
header->byte_order= (uchar) (*m_data);
m_data++;
get_uint4(&header->wkb_type);
m_data+= 4;
return false;
}
/* Routines to scan uint4 information */
bool scan_uint4(uint32 *number)
{
if (no_data(4))
return true;
get_uint4(number);
m_data+= 4;
return false;
}
bool scan_non_zero_uint4(uint32 *number)
{
return (scan_uint4(number) || 0 == *number);
}
bool scan_n_points_and_check_data(uint32 *n_points,
uint32 extra_point_space= 0)
{
return scan_non_zero_uint4(n_points) ||
not_enough_points(*n_points, extra_point_space);
}
/* Routines to scan coordinate information */
void scan_xy_unsafe(point_xy *p)
{
DBUG_ASSERT(!no_data(POINT_DATA_SIZE));
get_float8(&p->x);
m_data+= SIZEOF_STORED_DOUBLE;
get_float8(&p->y);
m_data+= SIZEOF_STORED_DOUBLE;
}
bool scan_xy(point_xy *p)
{
if (no_data(SIZEOF_STORED_DOUBLE * 2))
return true;
scan_xy_unsafe(p);
return false;
}
bool scan_coord(double *x)
{
if (no_data(SIZEOF_STORED_DOUBLE))
return true;
get_float8(x);
m_data+= SIZEOF_STORED_DOUBLE;
return false;
}
};
/** Callback which creates Geometry objects on top of a given placement. */
typedef Geometry *(*create_geom_t)(char *);
class Class_info
{
public:
LEX_STRING m_name;
int m_type_id;
create_geom_t m_create_func;
Class_info(const char *name, int type_id, create_geom_t create_func);
};
virtual const Class_info *get_class_info() const=0;
virtual uint32 get_data_size() const=0;
virtual bool init_from_wkt(Gis_read_stream *trs, String *wkb)=0;
/* returns the length of the wkb that was read */
virtual uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
String *res)=0;
virtual uint init_from_opresult(String *bin,
const char *opres, uint opres_length)
{ return init_from_wkb(opres + 4, UINT_MAX32, wkb_ndr, bin) + 4; }
virtual bool get_data_as_wkt(String *txt, wkb_parser *wkb) const=0;
virtual bool get_mbr(MBR *mbr, wkb_parser *wkb) const=0;
bool get_mbr(MBR *mbr)
{
wkb_parser wkb(&m_wkb_data);
return get_mbr(mbr, &wkb);
}
virtual bool dimension(uint32 *dim, wkb_parser *wkb) const
{
*dim= feature_dimension();
uint32 length;
if ((length= get_data_size()) == GET_SIZE_ERROR)
return true;
wkb->skip(length);
return false;
}
bool dimension(uint32 *dim)
{
wkb_parser wkb(&m_wkb_data);
return dimension(dim, &wkb);
}
virtual uint32 feature_dimension() const= 0;
virtual int get_x(double *x) const { return -1; }
virtual int get_y(double *y) const { return -1; }
virtual int geom_length(double *len) const { return -1; }
/**
Calculate area of a Geometry.
This default implementation returns 0 for the types that have zero area:
Point, LineString, MultiPoint, MultiLineString.
The over geometry types (Polygon, MultiPolygon, GeometryCollection)
override the default method.
*/
virtual bool area(double *ar, wkb_parser *wkb) const
{
uint32 data_size= get_data_size();
if (data_size == GET_SIZE_ERROR || wkb->no_data(data_size))
return true;
wkb->skip_unsafe(data_size);
*ar= 0;
return false;
}
bool area(double *ar) const
{
wkb_parser wkb(&m_wkb_data);
return area(ar, &wkb);
}
virtual int is_closed(int *closed) const { return -1; }
virtual int num_interior_ring(uint32 *n_int_rings) const { return -1; }
virtual int num_points(uint32 *n_points) const { return -1; }
virtual int num_geometries(uint32 *num) const { return -1; }
virtual int start_point(String *point) const { return -1; }
virtual int end_point(String *point) const { return -1; }
virtual int exterior_ring(String *ring) const { return -1; }
virtual int centroid(String *point) const { return -1; }
virtual int point_n(uint32 num, String *result) const { return -1; }
virtual int interior_ring_n(uint32 num, String *result) const { return -1; }
virtual int geometry_n(uint32 num, String *result) const { return -1; }
public:
static Geometry *construct(Geometry_buffer *buffer,
const char *data, uint32 data_len);
static Geometry *construct(Geometry_buffer *buffer, const String *str)
{
return construct(buffer, str->ptr(), str->length());
}
bool as_wkt(String *wkt, wkb_parser *wkb)
{
uint32 len= (uint) get_class_info()->m_name.length;
if (wkt->reserve(len + 2, 512))
return true;
wkt->qs_append(get_class_info()->m_name.str, len);
wkt->qs_append('(');
if (get_data_as_wkt(wkt, wkb))
return true;
wkt->qs_append(')');
return false;
}
bool as_wkt(String *wkt)
{
wkb_parser wkb(&m_wkb_data);
return as_wkt(wkt, &wkb);
}
inline void set_data_ptr(const char *data, uint32 data_len)
{
m_wkb_data.set(data, data + data_len);
}
inline void set_data_ptr(const wkb_container *wkb)
{
m_wkb_data= *wkb;
}
bool envelope(String *result) const;
static Class_info *ci_collection[wkb_last+1];
protected:
static Class_info *find_class(int type_id)
{
return ((type_id < wkb_point) || (type_id > wkb_last)) ?
NULL : ci_collection[type_id];
}
static Class_info *find_class(const char *name, uint32 len);
void append_points(String *txt, uint32 n_points,
wkb_parser *wkb, uint32 offset) const;
bool create_point(String *result, wkb_parser *wkb) const;
bool create_point(String *result, point_xy p) const;
bool get_mbr_for_points(MBR *mbr, wkb_parser *wkb, uint offset) const;
wkb_container m_wkb_data;
};
/***************************** Point *******************************/
class Gis_point: public Geometry
{
public:
Gis_point() {} /* Remove gcc warning */
virtual ~Gis_point() {} /* Remove gcc warning */
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, wkb_parser *wkb) const;
bool get_mbr(MBR *mbr, wkb_parser *wkb) const;
int get_xy(point_xy *p) const
{
wkb_parser wkb(&m_wkb_data);
return wkb.scan_xy(p);
}
int get_x(double *x) const
{
wkb_parser wkb(&m_wkb_data);
return wkb.scan_coord(x);
}
int get_y(double *y) const
{
wkb_parser wkb(&m_wkb_data);
return wkb.skip_coord() || wkb.scan_coord(y);
}
uint32 feature_dimension() const { return 0; }
const Class_info *get_class_info() const;
};
/***************************** LineString *******************************/
class Gis_line_string: public Geometry
{
// Maximum number of points in LineString that can fit into String
static const uint32 max_n_points=
(uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
POINT_DATA_SIZE;
public:
Gis_line_string() {} /* Remove gcc warning */
virtual ~Gis_line_string() {} /* Remove gcc warning */
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, wkb_parser *wkb) const;
bool get_mbr(MBR *mbr, wkb_parser *wkb) const;
int geom_length(double *len) const;
int is_closed(int *closed) const;
int num_points(uint32 *n_points) const;
int start_point(String *point) const;
int end_point(String *point) const;
int point_n(uint32 n, String *result) const;
uint32 feature_dimension() const { return 1; }
const Class_info *get_class_info() const;
};
/***************************** Polygon *******************************/
class Gis_polygon: public Geometry
{
public:
Gis_polygon() {} /* Remove gcc warning */
virtual ~Gis_polygon() {} /* Remove gcc warning */
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint opres_length);
bool get_data_as_wkt(String *txt, wkb_parser *wkb) const;
bool get_mbr(MBR *mbr, wkb_parser *wkb) const;
bool area(double *ar, wkb_parser *wkb) const;
int exterior_ring(String *result) const;
int num_interior_ring(uint32 *n_int_rings) const;
int interior_ring_n(uint32 num, String *result) const;
bool centroid_xy(point_xy *p) const;
int centroid(String *result) const;
uint32 feature_dimension() const { return 2; }
const Class_info *get_class_info() const;
};
/***************************** MultiPoint *******************************/
class Gis_multi_point: public Geometry
{
// Maximum number of points in MultiPoint that can fit into String
static const uint32 max_n_points=
(uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
(WKB_HEADER_SIZE + POINT_DATA_SIZE);
public:
Gis_multi_point() {} /* Remove gcc warning */
virtual ~Gis_multi_point() {} /* Remove gcc warning */
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint opres_length);
bool get_data_as_wkt(String *txt, wkb_parser *wkb) const;
bool get_mbr(MBR *mbr, wkb_parser *wkb) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
uint32 feature_dimension() const { return 0; }
const Class_info *get_class_info() const;
};
/***************************** MultiLineString *******************************/
class Gis_multi_line_string: public Geometry
{
public:
Gis_multi_line_string() {} /* Remove gcc warning */
virtual ~Gis_multi_line_string() {} /* Remove gcc warning */
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint opres_length);
bool get_data_as_wkt(String *txt, wkb_parser *wkb) const;
bool get_mbr(MBR *mbr, wkb_parser *wkb) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
int geom_length(double *len) const;
int is_closed(int *closed) const;
uint32 feature_dimension() const { return 1; }
const Class_info *get_class_info() const;
};
/***************************** MultiPolygon *******************************/
class Gis_multi_polygon: public Geometry
{
public:
Gis_multi_polygon() {} /* Remove gcc warning */
virtual ~Gis_multi_polygon() {} /* Remove gcc warning */
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, wkb_parser *wkb) const;
bool get_mbr(MBR *mbr, wkb_parser *wkb) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
bool area(double *ar, wkb_parser *wkb) const;
int centroid(String *result) const;
uint32 feature_dimension() const { return 2; }
const Class_info *get_class_info() const;
uint init_from_opresult(String *bin, const char *opres, uint opres_length);
};
/*********************** GeometryCollection *******************************/
class Gis_geometry_collection: public Geometry
{
public:
Gis_geometry_collection() {} /* Remove gcc warning */
virtual ~Gis_geometry_collection() {} /* Remove gcc warning */
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint opres_length);
bool get_data_as_wkt(String *txt, wkb_parser *wkb) const;
bool get_mbr(MBR *mbr, wkb_parser *wkb) const;
bool area(double *ar, wkb_parser *wkb) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
bool dimension(uint32 *dim, wkb_parser *wkb) const;
uint32 feature_dimension() const
{
DBUG_ASSERT(0);
return 0;
}
const Class_info *get_class_info() const;
};
struct Geometry_buffer : public
my_aligned_storage<sizeof(Gis_point), MY_ALIGNOF(Gis_point)> {};
#endif /*HAVE_SPATAIAL*/
#endif
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

MySQLAdvisor是原SQLAdvisor项目转移到此,原先由美团点评公司技术工程部DBA团队(北京)开发维护的一个分析SQL给出索引优化建议的工具,现在由社区进行维护、迭代更新。它基于MySQL原生态词法解析,结合分析SQL中的where条件、聚合条件、多表Join关系 给出索引优化建议
暂无标签
GPL-2.0
使用 GPL-2.0 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/tomdev/MySQLAdvisor.git
git@gitee.com:tomdev/MySQLAdvisor.git
tomdev
MySQLAdvisor
MySQLAdvisor
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /