mirror of
https://github.com/opensim/opensim.git
synced 2026-07-05 11:10:45 +08:00
To use, see the appearance section in opensim.ini.example, set "persist = true", then add the correct connection string for your database.(see mysql-AvatarAppearance.sql in share folder for a example of the table mysql table structure). This could possible be used in a very small grid, but would mean each region server would need to connect to the same mysql database. But the work to move the code to one of the grid servers shouldn't be too much.
53 lines
1.2 KiB
C#
53 lines
1.2 KiB
C#
using System.Data;
|
|
using System.Data.Common;
|
|
using libsecondlife;
|
|
using MySql.Data.MySqlClient;
|
|
|
|
using TribalMedia.Framework.Data;
|
|
|
|
namespace OpenSim.Framework.Data
|
|
{
|
|
public abstract class OpenSimDatabaseConnector : BaseDatabaseConnector
|
|
{
|
|
public OpenSimDatabaseConnector(string connectionString) : base(connectionString)
|
|
{
|
|
}
|
|
|
|
public override object ConvertToDbType(object value)
|
|
{
|
|
if (value is LLUUID)
|
|
{
|
|
return ((LLUUID) value).UUID.ToString();
|
|
}
|
|
|
|
return base.ConvertToDbType(value);
|
|
}
|
|
|
|
public override BaseDataReader CreateReader(IDataReader reader)
|
|
{
|
|
return new OpenSimDataReader(reader);
|
|
}
|
|
}
|
|
|
|
|
|
public class MySQLDatabaseMapper : OpenSimDatabaseConnector
|
|
{
|
|
public MySQLDatabaseMapper(string connectionString)
|
|
: base(connectionString)
|
|
{
|
|
}
|
|
|
|
public override DbConnection GetNewConnection()
|
|
{
|
|
MySqlConnection connection = new MySqlConnection(m_connectionString);
|
|
return connection;
|
|
}
|
|
|
|
public override string CreateParamName(string fieldName)
|
|
{
|
|
return "?" + fieldName;
|
|
}
|
|
}
|
|
}
|
|
|