From f6aeff6cc3f6ebc58db702206d469718d19b7ba0 Mon Sep 17 00:00:00 2001 From: Tleiades Hax Date: Sat, 13 Oct 2007 09:21:08 +0000 Subject: Added capbility to use MySQL as the database backend in stand alone mode for assets and inventory. Added asset_plugin key to "StandAlone" section of OpenSim.ini --- OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | 23 ++-------------------- OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 7 ++----- .../Data.MySQL/Resources/CreateAssetsTable.sql | 4 ++-- 3 files changed, 6 insertions(+), 28 deletions(-) (limited to 'OpenSim/Framework/Data.MySQL') diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index 5a169ac..70e04b6 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -40,28 +40,9 @@ namespace OpenSim.Framework.Data.MySQL } - public AssetBase FetchAsset(LLUUID assetID) + public AssetBase FetchAsset(LLUUID uuid) { - AssetBase asset = null; - - MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection); - MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); - p.Value = assetID.GetBytes(); - using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) - { - if (dbReader.Read()) - { - asset = new AssetBase(); - asset.Data = (byte[])dbReader["data"]; - asset.Description = (string)dbReader["description"]; - asset.FullID = assetID; - asset.InvType = (sbyte)dbReader["invType"]; - asset.Local = ((sbyte)dbReader["local"])!=0?true:false; - asset.Name = (string)dbReader["name"]; - asset.Type = (sbyte)dbReader["assetType"]; - } - } - return asset; + throw new Exception("The method or operation is not implemented."); } public void CreateAsset(AssetBase asset) diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index 7bd1273..6423f28 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs @@ -225,13 +225,10 @@ namespace OpenSim.Framework.Data.MySQL MySqlDataReader reader = result.ExecuteReader(); List items = new List(); - while (reader.Read()) + while(reader.Read()) items.Add(readInventoryFolder(reader)); - InventoryFolderBase rootFolder = null; - if (items.Count > 0) - rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). - + InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). reader.Close(); result.Dispose(); diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql index 3b6fff2..049a3a2 100644 --- a/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql +++ b/OpenSim/Framework/Data.MySQL/Resources/CreateAssetsTable.sql @@ -2,8 +2,8 @@ CREATE TABLE `assets` ( `id` binary(16) NOT NULL, `name` varchar(64) NOT NULL, `description` varchar(64) NOT NULL, - `assetType` TINYINT(4) NOT NULL, - `invType` TINYINT(4) NOT NULL, + `assetType` smallint(5) unsigned NOT NULL, + `invType` smallint(5) unsigned NOT NULL, `local` tinyint(1) NOT NULL, `temporary` tinyint(1) NOT NULL, `data` longblob NOT NULL, -- cgit v1.1