403Webshell
Server IP : 104.21.38.3  /  Your IP : 162.158.106.112
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/mysql-test/suite/innodb_gis/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test
# WL#6745 InnoDB R-tree support
# This test case will test basic R-tree support features.

--source include/have_innodb.inc

# Create table with R-tree index.
create table t1 (i int, i2 char(10), g geometry not null, primary key (i, i2), spatial index (g))engine=innodb;

# Insert values.
insert into t1 values (1, "111", POINT(1,1));
insert into t1 values (2, "222", POINT(1.5,1.5));
insert into t1 values (3, "333", POINT(3,3));
insert into t1 values (4, "444", POINT(3.1,3.1));
insert into t1 values (5, "555", POINT(5,5));

analyze table t1;

# Select by R-tree index.
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);

# Delete values.
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;

select ST_astext(t1.g) from t1;

# Update values.
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
update t1 set g = POINT(2,2) where MBRWithin(t1.g, @g1);
check table t1;

select ST_astext(t1.g) from t1;

# Show index.
--replace_column 7 #
show indexes from t1;

# Cleanup.
drop table t1;

# Test functions.
create table t1 (name VARCHAR(100), square GEOMETRY not null, spatial index (square))engine=innodb;


INSERT INTO t1 VALUES("small",  ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big",    ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));

INSERT INTO t1 VALUES("up",     ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2",    ST_GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3",    ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));

INSERT INTO t1 VALUES("down",   ST_GeomFromText('POLYGON (( 0 -1, 0  1, 2  1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2",  ST_GeomFromText('POLYGON (( 0 -2, 0  0, 2  0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3",  ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));

INSERT INTO t1 VALUES("right",  ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", ST_GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));

INSERT INTO t1 VALUES("left",   ST_GeomFromText('POLYGON (( -1 0, -1 2,  1 2,  1 0, -1 0))'));
INSERT INTO t1 VALUES("left2",  ST_GeomFromText('POLYGON (( -2 0, -2 2,  0 2,  0 0, -2 0))'));
INSERT INTO t1 VALUES("left3",  ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));

SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))');
SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square);
SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square);
SELECT name, ST_AsText(square) from t1 where MBREquals(@p, square);
SELECT name, ST_AsText(square) from t1 where MBRIntersects(@p, square);
SELECT name, ST_AsText(square) from t1 where MBROverlaps(@p, square);
SELECT name, ST_AsText(square) from t1 where MBRTouches(@p, square);
SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);

# MBROverlaps needs a few more tests, with point and line dimensions

--error ER_GIS_INVALID_DATA
SET @vert1   = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
--error ER_GIS_INVALID_DATA
SET @horiz1  = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
--error ER_GIS_INVALID_DATA
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
--error ER_GIS_INVALID_DATA
SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
--error ER_GIS_INVALID_DATA
SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
--error ER_GIS_INVALID_DATA
SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');

SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name;
SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL;
SELECT MBROverlaps(@horiz1, @horiz2) FROM DUAL;
SELECT MBROverlaps(@horiz1, @horiz3) FROM DUAL;
SELECT MBROverlaps(@horiz1, @point1) FROM DUAL;
SELECT MBROverlaps(@horiz1, @point2) FROM DUAL;

DROP TABLE t1;

# Inplace create spatial index is not supported
create table t1 (i int not null, g geometry not null)engine=innodb;

# Insert values.
insert into t1 values (1, POINT(1,1));
insert into t1 values (2, POINT(1.5,1.5));
insert into t1 values (3, POINT(3,3));
insert into t1 values (4, POINT(3.1,3.1));
insert into t1 values (5, POINT(5,5));

alter table t1 add primary key(i), algorithm=inplace;
alter table t1 drop primary key;

create spatial index idx on t1(g) algorithm=inplace;

create spatial index idx2 on t1(g);

alter table t1 add primary key(i), algorithm=inplace;

show create table t1;

drop index idx on t1;

drop table t1;


Youez - 2016 - github.com/yon3zu
LinuXploit