aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/lib/OpenSim/AssetServer/AssetManager.pm
blob: f36ab1ae5b44e275677cef1e7a1ad960dbff099d (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
package OpenSim::AssetServer::AssetManager;

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


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

sub saveAsset {
	my $asset = shift;
	my $result = &OpenSim::Utility::getSimpleResult(
		$OpenSim::AssetServer::Config::SYS_SQL{insert_asset},
		$asset->{id},
		$asset->{name},
		$asset->{description},
		$asset->{assetType},
		$asset->{invType},
		$asset->{"local"},
		$asset->{temporary},
		$asset->{data}
	);
}

1;