aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/lib/OpenSim/GridServer/GridManager.pm
blob: 2170d74db8fa4a7d6d75b99bdfd14b5ea63689b0 (plain)
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
package OpenSim::GridServer::GridManager;

use strict;
use Carp;
use OpenSim::Utility;
use OpenSim::GridServer::Config;

sub getRegionByUUID {
	my $uuid = shift;
	my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_by_uuid}, $uuid);
	my $count = @$result;
	if ($count > 0) {
		return $result->[0];
	}
	Carp::croak("can not find region");
}

sub getRegionByHandle {
	my $handle = shift;
	my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_by_handle}, $handle);
	my $count = @$result;
	if ($count > 0) {
		return $result->[0];
	}
	Carp::croak("can not find region # $handle");
}

sub getRegionList {
	my ($xmin, $ymin, $xmax, $ymax) = @_;
	my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_list}, $xmin, $xmax, $ymin, $ymax);
	my $count = @$result;
	if ($count > 0) {
		return $result;
	}
	Carp::croak("can not find region");
}

sub getRegionList2 {
	my ($xmin, $ymin, $xmax, $ymax) = @_;
	my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_list2}, $xmin, $xmax, $ymin, $ymax);
	my $count = @$result;
	if ($count > 0) {
		return $result;
	}
	Carp::croak("can not find region");
}

sub deleteRegions {
	my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{delete_all_regions});
	my $count = @$result;
	if ($count > 0) {
		return $result;
	}
	Carp::croak("failed to delete regions");
}

1;