aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL
diff options
context:
space:
mode:
authorTleiades Hax2007-10-13 12:35:37 +0000
committerTleiades Hax2007-10-13 12:35:37 +0000
commit5a1e896edcb3e5e8341e9d3fb5b3e323c7ec3210 (patch)
treee2b1b30f60fe91d5b578d39f816925fdc791bae3 /OpenSim/Framework/Data.MySQL
parentAdded capbility to use MySQL as the database backend in stand alone mode for ... (diff)
downloadopensim-SC_OLD-5a1e896edcb3e5e8341e9d3fb5b3e323c7ec3210.zip
opensim-SC_OLD-5a1e896edcb3e5e8341e9d3fb5b3e323c7ec3210.tar.gz
opensim-SC_OLD-5a1e896edcb3e5e8341e9d3fb5b3e323c7ec3210.tar.bz2
opensim-SC_OLD-5a1e896edcb3e5e8341e9d3fb5b3e323c7ec3210.tar.xz
OpenSimMain now respects the asset_plugin paramter, and storing of assets will *not* throw an exception
Diffstat (limited to 'OpenSim/Framework/Data.MySQL')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLAssetData.cs23
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql4
2 files changed, 23 insertions, 4 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
index 70e04b6..79f87e0 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
@@ -40,9 +40,28 @@ namespace OpenSim.Framework.Data.MySQL
40 40
41 } 41 }
42 42
43 public AssetBase FetchAsset(LLUUID uuid) 43 public AssetBase FetchAsset(LLUUID assetID)
44 { 44 {
45 throw new Exception("The method or operation is not implemented."); 45 AssetBase asset = null;
46
47 MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection);
48 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
49 p.Value = assetID.GetBytes();
50 using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow))
51 {
52 if (dbReader.Read())
53 {
54 asset = new AssetBase();
55 asset.Data = (byte[])dbReader["data"];
56 asset.Description = (string)dbReader["description"];
57 asset.FullID = assetID;
58 asset.InvType = (sbyte)dbReader["invType"];
59 asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false;
60 asset.Name = (string)dbReader["name"];
61 asset.Type = (sbyte)dbReader["assetType"];
62 }
63 }
64 return asset;
46 } 65 }
47 66
48 public void CreateAsset(AssetBase asset) 67 public void CreateAsset(AssetBase asset)
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql
index 049a3a2..b9c1b97 100644
--- a/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql
+++ b/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql
@@ -2,8 +2,8 @@ CREATE TABLE `assets` (
2 `id` binary(16) NOT NULL, 2 `id` binary(16) NOT NULL,
3 `name` varchar(64) NOT NULL, 3 `name` varchar(64) NOT NULL,
4 `description` varchar(64) NOT NULL, 4 `description` varchar(64) NOT NULL,
5 `assetType` smallint(5) unsigned NOT NULL, 5 `assetType` tinyint(4) NOT NULL,
6 `invType` smallint(5) unsigned NOT NULL, 6 `invType` tinyint(4) NOT NULL,
7 `local` tinyint(1) NOT NULL, 7 `local` tinyint(1) NOT NULL,
8 `temporary` tinyint(1) NOT NULL, 8 `temporary` tinyint(1) NOT NULL,
9 `data` longblob NOT NULL, 9 `data` longblob NOT NULL,