AssetManager.pm 714 B

12345678910111213141516171819202122232425262728293031323334
  1. package OpenSim::AssetServer::AssetManager;
  2. use strict;
  3. use Carp;
  4. use OpenSim::Utility;
  5. use OpenSim::AssetServer::Config;
  6. sub getAssetByUUID {
  7. my $uuid = shift;
  8. my $result = &OpenSim::Utility::getSimpleResult($OpenSim::AssetServer::Config::SYS_SQL{select_asset_by_uuid}, $uuid);
  9. my $count = @$result;
  10. if ($count > 0) {
  11. return $result->[0];
  12. }
  13. Carp::croak("can not find asset($uuid)");
  14. }
  15. sub saveAsset {
  16. my $asset = shift;
  17. my $result = &OpenSim::Utility::getSimpleResult(
  18. $OpenSim::AssetServer::Config::SYS_SQL{insert_asset},
  19. $asset->{id},
  20. $asset->{name},
  21. $asset->{description},
  22. $asset->{assetType},
  23. $asset->{invType},
  24. $asset->{"local"},
  25. $asset->{temporary},
  26. $asset->{data}
  27. );
  28. }
  29. 1;