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
afrisby
Tleiades Hax 2007-10-13 09:21:08 +00:00
parent e8c1de8e72
commit f6aeff6cc3
4 changed files with 7 additions and 31 deletions

View File

@ -40,28 +40,9 @@ namespace OpenSim.Framework.Data.MySQL
} }
public AssetBase FetchAsset(LLUUID assetID) public AssetBase FetchAsset(LLUUID uuid)
{ {
AssetBase asset = null; throw new Exception("The method or operation is not implemented.");
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;
} }
public void CreateAsset(AssetBase asset) public void CreateAsset(AssetBase asset)

View File

@ -225,13 +225,10 @@ namespace OpenSim.Framework.Data.MySQL
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
List<InventoryFolderBase> items = new List<InventoryFolderBase>(); List<InventoryFolderBase> items = new List<InventoryFolderBase>();
while (reader.Read()) while(reader.Read())
items.Add(readInventoryFolder(reader)); items.Add(readInventoryFolder(reader));
InventoryFolderBase rootFolder = null; InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one).
if (items.Count > 0)
rootFolder = items[0]; //should only be one folder with parent set to zero (the root one).
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();

View File

@ -2,8 +2,8 @@ CREATE TABLE `assets` (
`id` binary(16) NOT NULL, `id` binary(16) NOT NULL,
`name` varchar(64) NOT NULL, `name` varchar(64) NOT NULL,
`description` varchar(64) NOT NULL, `description` varchar(64) NOT NULL,
`assetType` TINYINT(4) NOT NULL, `assetType` smallint(5) unsigned NOT NULL,
`invType` TINYINT(4) NOT NULL, `invType` smallint(5) unsigned NOT NULL,
`local` tinyint(1) NOT NULL, `local` tinyint(1) NOT NULL,
`temporary` tinyint(1) NOT NULL, `temporary` tinyint(1) NOT NULL,
`data` longblob NOT NULL, `data` longblob NOT NULL,

View File

@ -80,7 +80,6 @@ namespace OpenSim
private string standaloneWelcomeMessage = null; private string standaloneWelcomeMessage = null;
private string standaloneInventoryPlugin = "OpenSim.Framework.Data.SQLite.dll"; private string standaloneInventoryPlugin = "OpenSim.Framework.Data.SQLite.dll";
private string standaloneUserPlugin = "OpenSim.Framework.Data.DB4o.dll"; private string standaloneUserPlugin = "OpenSim.Framework.Data.DB4o.dll";
private string standaloneAssetPlugin = "OpenSim.Framework.Data.SQLite.dll";
private string m_assetStorage = "db4o"; private string m_assetStorage = "db4o";
@ -132,7 +131,6 @@ namespace OpenSim
standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false); standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim"); standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
standaloneAssetPlugin = configSource.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.SQLite.dll");
standaloneUserPlugin = configSource.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll"); standaloneUserPlugin = configSource.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
m_networkServersInfo.loadFromConfiguration(configSource); m_networkServersInfo.loadFromConfiguration(configSource);
@ -285,7 +283,7 @@ namespace OpenSim
} }
else else
{ {
assetServer = new SQLAssetServer(standaloneAssetPlugin); assetServer = new SQLAssetServer("OpenSim.Framework.Data.SQLite.dll");
} }
assetServer.SetServerInfo(m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); assetServer.SetServerInfo(m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
m_assetCache = new AssetCache(assetServer); m_assetCache = new AssetCache(assetServer);