aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/lib/OpenSim/AssetServer
diff options
context:
space:
mode:
Diffstat (limited to 'share/perl/lib/OpenSim/AssetServer')
-rw-r--r--share/perl/lib/OpenSim/AssetServer/AssetManager.pm34
-rw-r--r--share/perl/lib/OpenSim/AssetServer/Config.pm24
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 @@
1package OpenSim::AssetServer::AssetManager;
2
3use strict;
4use Carp;
5use OpenSim::Utility;
6use OpenSim::AssetServer::Config;
7
8
9sub 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
19sub 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
341;
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 @@
1package OpenSim::AssetServer::Config;
2
3use strict;
4
5our %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
13our @ASSETS_COLUMNS = (
14 "id",
15 "name",
16 "description",
17 "assetType",
18 "invType",
19 "local",
20 "temporary",
21 "data",
22);
23
241;