GridManager.pm 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package OpenSim::GridServer::GridManager;
  2. use strict;
  3. use Carp;
  4. use OpenSim::Utility;
  5. use OpenSim::GridServer::Config;
  6. sub getRegionByUUID {
  7. my $uuid = shift;
  8. my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_by_uuid}, $uuid);
  9. my $count = @$result;
  10. if ($count > 0) {
  11. return $result->[0];
  12. }
  13. Carp::croak("can not find region");
  14. }
  15. sub getRegionByHandle {
  16. my $handle = shift;
  17. my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_by_handle}, $handle);
  18. my $count = @$result;
  19. if ($count > 0) {
  20. return $result->[0];
  21. }
  22. Carp::croak("can not find region # $handle");
  23. }
  24. sub getRegionList {
  25. my ($xmin, $ymin, $xmax, $ymax) = @_;
  26. my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_list}, $xmin, $xmax, $ymin, $ymax);
  27. my $count = @$result;
  28. if ($count > 0) {
  29. return $result;
  30. }
  31. Carp::croak("can not find region");
  32. }
  33. sub getRegionList2 {
  34. my ($xmin, $ymin, $xmax, $ymax) = @_;
  35. my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_list2}, $xmin, $xmax, $ymin, $ymax);
  36. my $count = @$result;
  37. if ($count > 0) {
  38. return $result;
  39. }
  40. Carp::croak("can not find region");
  41. }
  42. sub deleteRegions {
  43. my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{delete_all_regions});
  44. my $count = @$result;
  45. if ($count > 0) {
  46. return $result;
  47. }
  48. Carp::croak("failed to delete regions");
  49. }
  50. 1;