403Webshell
Server IP : 172.67.216.182  /  Your IP : 172.71.152.62
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_search.test
# WL#6968 InnoDB R-tree cursor support

# Not supported in embedded
--source include/not_embedded.inc
--source include/not_valgrind.inc

--source include/have_innodb.inc

# Create table with R-tree index.
create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb;

# Insert enough values to let R-tree split.
delimiter |;
create procedure insert_t1(IN total int)
begin
	declare i int default 1;
	while (i <= total) DO
		insert into t1 values (i, Point(i, i));
		set i = i + 1;
	end while;
end|
delimiter ;|

# Test level 1 rtree.
CALL insert_t1(1000);
select count(*) from t1;

set @g1 = ST_GeomFromText('Polygon((0 0,0 1000,1000 1000,1000 0,0 0))');

select count(*) from t1 where MBRWithin(t1.c2, @g1);

set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);

set @g1 = ST_GeomFromText('Polygon((10 10,10 800,800 800,800 10,10 10))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);

set @g1 = ST_GeomFromText('Polygon((100 100,100 800,800 800,800 100,100 100))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);

#SET DEBUG='+d, rtr_pessimistic_position';
#select count(*) from t1 where MBRWithin(t1.c2, @g1);
#SET DEBUG='-d, rtr_pessimistic_position';

# Equality search
set @g1 =  ST_GeomFromText('Point(1 1)');
select count(*) from t1 where MBRequals(t1.c2, @g1);

# MBRDisjoint search
set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
select count(*) from t1 where MBRdisjoint(t1.c2, @g1);

# Clean up.
DROP PROCEDURE insert_t1;

truncate t1;

let $1=150;
let $2=150;
while ($1)
{
  eval INSERT INTO t1  VALUES ($1, ST_GeomFromText('LineString($1 $1, $2 $2)'));
  dec $1;
  inc $2;
}

select count(*) from t1;

set @g1 = ST_GeomFromText('Polygon((0 0,0 1000,1000 1000,1000 0,0 0))');
select count(*) from t1 where MBRwithin(t1.c2, @g1);
truncate t1;

INSERT INTO t1  VALUES (1, ST_GeomFromText('LineString(2 2, 150 150)'));
INSERT INTO t1  VALUES (1, ST_GeomFromText('LineString(3 3, 160 160)'));
INSERT INTO t1  VALUES (1, ST_GeomFromText('LineString(4 4, 170 170)'));
INSERT INTO t1  VALUES (1, ST_GeomFromText('LineString(5 5, 180 180)'));
INSERT INTO t1  VALUES (1, ST_GeomFromText('LineString(6 6, 190 190)'));
INSERT INTO t1  VALUES (1, ST_GeomFromText('LineString(7 7, 200 200)'));
INSERT INTO t1  VALUES (1, ST_GeomFromText('LineString(8 8, 210 210)'));

insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;

# Testing "MBRtouches"
# This is apparently now treated as "intersects"
set @g1 = ST_GeomFromText('Polygon((0 0,0 2, 2 2, 2 0, 0 0))');
select count(*) from t1 where MBRtouches(t1.c2, @g1);

set @g1 = ST_GeomFromText('Polygon((0 0,0 200,200 200,200 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);

# Test MBRequals
set @g1 = ST_GeomFromText('LineString(2 2, 150 150)');
select count(*) from t1 where MBRequals(t1.c2, @g1);

# Test store procedure with open cursor
set @g1 = ST_GeomFromText('Polygon((0 0,0 200,200 200,200 0,0 0))');
create table t3 (a int) engine = innodb;

delimiter |;

CREATE PROCEDURE curdemo()
BEGIN
  DECLARE done INT DEFAULT FALSE;
  DECLARE a INT;

  DECLARE cur1 CURSOR FOR SELECT c1 from t1 where  MBRWithin(t1.c2, @g1);
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

  OPEN cur1;
  read_loop: LOOP
    FETCH cur1 INTO a;
   IF done THEN
      LEAVE read_loop;
   END IF;
  INSERT INTO test.t3 VALUES (a);
END LOOP;

CLOSE cur1;
END|

delimiter ;|

call curdemo();

select count(*) from t3;

drop procedure curdemo;
drop table t3;
drop table t1;


Youez - 2016 - github.com/yon3zu
LinuXploit