diff options
Diffstat (limited to 'share/perl/lib/OpenSim/AssetServer')
-rw-r--r-- | share/perl/lib/OpenSim/AssetServer/AssetManager.pm | 34 | ||||
-rw-r--r-- | share/perl/lib/OpenSim/AssetServer/Config.pm | 24 |
2 files changed, 58 insertions, 0 deletions
diff --git a/share/perl/lib/OpenSim/AssetServer/AssetManager.pm b/share/perl/lib/OpenSim/AssetServer/AssetManager.pm new file mode 100644 index 0000000..f36ab1a --- /dev/null +++ b/share/perl/lib/OpenSim/AssetServer/AssetManager.pm | |||
@@ -0,0 +1,34 @@ | |||
1 | package OpenSim::AssetServer::AssetManager; | ||
2 | |||
3 | use strict; | ||
4 | use Carp; | ||
5 | use OpenSim::Utility; | ||
6 | use OpenSim::AssetServer::Config; | ||
7 | |||
8 | |||
9 | sub getAssetByUUID { | ||
10 | my $uuid = shift; | ||
11 | my $result = &OpenSim::Utility::getSimpleResult($OpenSim::AssetServer::Config::SYS_SQL{select_asset_by_uuid}, $uuid); | ||
12 | my $count = @$result; | ||
13 | if ($count > 0) { | ||
14 | return $result->[0]; | ||
15 | } | ||
16 | Carp::croak("can not find asset($uuid)"); | ||
17 | } | ||
18 | |||
19 | sub saveAsset { | ||
20 | my $asset = shift; | ||
21 | my $result = &OpenSim::Utility::getSimpleResult( | ||
22 | $OpenSim::AssetServer::Config::SYS_SQL{insert_asset}, | ||
23 | $asset->{id}, | ||
24 | $asset->{name}, | ||
25 | $asset->{description}, | ||
26 | $asset->{assetType}, | ||
27 | $asset->{invType}, | ||
28 | $asset->{"local"}, | ||
29 | $asset->{temporary}, | ||
30 | $asset->{data} | ||
31 | ); | ||
32 | } | ||
33 | |||
34 | 1; | ||
diff --git a/share/perl/lib/OpenSim/AssetServer/Config.pm b/share/perl/lib/OpenSim/AssetServer/Config.pm new file mode 100644 index 0000000..5598921 --- /dev/null +++ b/share/perl/lib/OpenSim/AssetServer/Config.pm | |||
@@ -0,0 +1,24 @@ | |||
1 | package OpenSim::AssetServer::Config; | ||
2 | |||
3 | use strict; | ||
4 | |||
5 | our %SYS_SQL = ( | ||
6 | select_asset_by_uuid => | ||
7 | "SELECT * FROM assets WHERE id=X?", | ||
8 | insert_asset => | ||
9 | "INSERT INTO assets VALUES (?,?,?,?,?,?,?,?)" | ||
10 | ); | ||
11 | |||
12 | |||
13 | our @ASSETS_COLUMNS = ( | ||
14 | "id", | ||
15 | "name", | ||
16 | "description", | ||
17 | "assetType", | ||
18 | "invType", | ||
19 | "local", | ||
20 | "temporary", | ||
21 | "data", | ||
22 | ); | ||
23 | |||
24 | 1; | ||