Apply patch from bug #1601 -- more documentation for Data/MySQL. Thanks kerunix_Flan!
parent
1c6bf4fe77
commit
ca724636d4
|
@ -36,6 +36,9 @@ using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A MySQL Interface for the Asset Server
|
||||||
|
/// </summary>
|
||||||
internal class MySQLAssetData : AssetDataBase, IPlugin
|
internal class MySQLAssetData : AssetDataBase, IPlugin
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -45,12 +48,16 @@ namespace OpenSim.Data.MySQL
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises Asset interface
|
/// <para>Initialises Asset interface</para>
|
||||||
/// Loads and initialises the MySQL storage plugin
|
/// <para>
|
||||||
/// Warns and uses the obsolete mysql_connection.ini if connect string is empty.
|
/// <list type="bullet">
|
||||||
/// Check for migration
|
/// <item>Loads and initialises the MySQL storage plugin.</item>
|
||||||
|
/// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
|
||||||
|
/// <item>Check for migration</item>
|
||||||
|
/// </list>
|
||||||
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="connect">connect string.</param>
|
/// <param name="connect">connect string</param>
|
||||||
override public void Initialise(string connect)
|
override public void Initialise(string connect)
|
||||||
{
|
{
|
||||||
// TODO: This will let you pass in the connect string in
|
// TODO: This will let you pass in the connect string in
|
||||||
|
@ -78,10 +85,16 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// uses the obsolete mysql_connection.ini
|
/// <para>Initialises Asset interface</para>
|
||||||
|
/// <para>
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>Loads and initialises the MySQL storage plugin</item>
|
||||||
|
/// <item>uses the obsolete mysql_connection.ini</item>
|
||||||
|
/// </list>
|
||||||
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="connect">connect string.</param>
|
/// <param name="connect">connect string</param>
|
||||||
/// <remarks>Probably deprecated and shouldn't be used</remarks>
|
/// <remarks>Probably DEPRECATED and shouldn't be used</remarks>
|
||||||
override public void Initialise()
|
override public void Initialise()
|
||||||
{
|
{
|
||||||
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
||||||
|
@ -98,6 +111,13 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
#region IAssetProvider Members
|
#region IAssetProvider Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>Execute CreateAssetsTable.sql if oldVersion == null</item>
|
||||||
|
/// <item>do nothing if oldVersion != null</item>
|
||||||
|
/// </list>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="oldVersion"></param>
|
||||||
private void UpgradeAssetsTable(string oldVersion)
|
private void UpgradeAssetsTable(string oldVersion)
|
||||||
{
|
{
|
||||||
// null as the version, indicates that the table didn't exist
|
// null as the version, indicates that the table didn't exist
|
||||||
|
@ -112,6 +132,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ensure that the assets related tables exists and are at the latest version
|
/// Ensure that the assets related tables exists and are at the latest version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="m"></param>
|
||||||
private void TestTables(Migration m)
|
private void TestTables(Migration m)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||||
|
@ -129,10 +150,11 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Fetch Asset <paramref name="assetID"/> from database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assetID"></param>
|
/// <param name="assetID">Asset UUID to fetch</param>
|
||||||
/// <returns></returns>
|
/// <returns>Return the asset</returns>
|
||||||
|
/// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks>
|
||||||
override public AssetBase FetchAsset(LLUUID assetID)
|
override public AssetBase FetchAsset(LLUUID assetID)
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
@ -175,9 +197,10 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Create an asset in database, or update it if existing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="asset"></param>
|
/// <param name="asset">Asset UUID to create</param>
|
||||||
|
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
||||||
override public void CreateAsset(AssetBase asset)
|
override public void CreateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
lock (_dbConnection)
|
lock (_dbConnection)
|
||||||
|
@ -224,19 +247,19 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Update a asset in database, see <see cref="CreateAsset"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="asset"></param>
|
/// <param name="asset">Asset UUID to update</param>
|
||||||
override public void UpdateAsset(AssetBase asset)
|
override public void UpdateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
CreateAsset(asset);
|
CreateAsset(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// check if the asset UUID exist in database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uuid"></param>
|
/// <param name="uuid">The asset UUID</param>
|
||||||
/// <returns></returns>
|
/// <returns>true if exist.</returns>
|
||||||
override public bool ExistsAsset(LLUUID uuid)
|
override public bool ExistsAsset(LLUUID uuid)
|
||||||
{
|
{
|
||||||
bool assetExists = false;
|
bool assetExists = false;
|
||||||
|
@ -285,7 +308,7 @@ namespace OpenSim.Data.MySQL
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// database provider version
|
/// Database provider version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
override public string Version
|
override public string Version
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,9 @@ using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A MySQL Interface for the Region Server
|
||||||
|
/// </summary>
|
||||||
public class MySQLDataStore : IRegionDataStore
|
public class MySQLDataStore : IRegionDataStore
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -76,7 +79,7 @@ namespace OpenSim.Data.MySQL
|
||||||
private DataTable m_landAccessListTable;
|
private DataTable m_landAccessListTable;
|
||||||
private DataTable m_regionBanListTable;
|
private DataTable m_regionBanListTable;
|
||||||
|
|
||||||
// Temporary attribute while this is experimental
|
/// <value>Temporary attribute while this is experimental</value>
|
||||||
private bool persistPrimInventories;
|
private bool persistPrimInventories;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -177,7 +180,8 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a list of tables, return the version of the tables, as seen in the database
|
/// Given a list of tables, return the version of the tables, as seen in the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tableList"></param>
|
/// <param name="tableList">The list of table</param>
|
||||||
|
/// <param name="dbcon">The database connection handler</param>
|
||||||
public void GetTableVersion(Dictionary<string, string> tableList, MySqlConnection dbcon)
|
public void GetTableVersion(Dictionary<string, string> tableList, MySqlConnection dbcon)
|
||||||
{
|
{
|
||||||
lock (dbcon)
|
lock (dbcon)
|
||||||
|
@ -226,6 +230,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// Execute a SQL statement stored in a resource, as a string
|
/// Execute a SQL statement stored in a resource, as a string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">the ressource name</param>
|
/// <param name="name">the ressource name</param>
|
||||||
|
/// <param name="dbcon">The database connection handler</param>
|
||||||
public void ExecuteResourceSql(string name, MySqlConnection dbcon)
|
public void ExecuteResourceSql(string name, MySqlConnection dbcon)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand(getResourceString(name), dbcon);
|
MySqlCommand cmd = new MySqlCommand(getResourceString(name), dbcon);
|
||||||
|
@ -260,9 +265,13 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>Execute CreateLandTable.sql if oldVersion == null</item>
|
||||||
|
/// <item>Execute UpgradeLandTable.sqm if oldVersion contain "Rev."</item>
|
||||||
|
/// </list>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="oldVersion"></param>
|
/// <param name="oldVersion"></param>
|
||||||
/// <param name="dbconn"></param>
|
/// <param name="dbconn">The database connection handler</param>
|
||||||
private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn)
|
private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn)
|
||||||
{
|
{
|
||||||
// null as the version, indicates that the table didn't exist
|
// null as the version, indicates that the table didn't exist
|
||||||
|
@ -280,8 +289,8 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds an object into region storage
|
/// Adds an object into region storage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj"></param>
|
/// <param name="obj">The object</param>
|
||||||
/// <param name="regionUUID"></param>
|
/// <param name="regionUUID">The region UUID</param>
|
||||||
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
|
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
lock (m_dataSet)
|
lock (m_dataSet)
|
||||||
|
@ -307,8 +316,8 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// removes an object from region storage
|
/// removes an object from region storage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj"></param>
|
/// <param name="obj">The object</param>
|
||||||
/// <param name="regionUUID"></param>
|
/// <param name="regionUUID">The Region UUID</param>
|
||||||
public void RemoveObject(LLUUID obj, LLUUID regionUUID)
|
public void RemoveObject(LLUUID obj, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
|
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
|
||||||
|
@ -362,6 +371,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// Load persisted objects from region storage.
|
/// Load persisted objects from region storage.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="regionUUID">the Region UUID</param>
|
/// <param name="regionUUID">the Region UUID</param>
|
||||||
|
/// <returns>List of loaded groups</returns>
|
||||||
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
|
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>();
|
Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>();
|
||||||
|
@ -448,7 +458,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load in a prim's persisted inventory.
|
/// Load in a prim's persisted inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="prim"></param>
|
/// <param name="prim">The prim</param>
|
||||||
private void LoadItems(SceneObjectPart prim)
|
private void LoadItems(SceneObjectPart prim)
|
||||||
{
|
{
|
||||||
lock (m_dataSet)
|
lock (m_dataSet)
|
||||||
|
@ -484,7 +494,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store a terrain revision in region storage
|
/// Store a terrain revision in region storage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ter">terrain data</param>
|
/// <param name="ter">HeightField data</param>
|
||||||
/// <param name="regionID">region UUID</param>
|
/// <param name="regionID">region UUID</param>
|
||||||
public void StoreTerrain(double[,] ter, LLUUID regionID)
|
public void StoreTerrain(double[,] ter, LLUUID regionID)
|
||||||
{
|
{
|
||||||
|
@ -513,7 +523,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// Load the latest terrain revision from region storage
|
/// Load the latest terrain revision from region storage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="regionID">the region UUID</param>
|
/// <param name="regionID">the region UUID</param>
|
||||||
/// <returns></returns>
|
/// <returns>Heightfield data</returns>
|
||||||
public double[,] LoadTerrain(LLUUID regionID)
|
public double[,] LoadTerrain(LLUUID regionID)
|
||||||
{
|
{
|
||||||
double[,] terret = new double[256,256];
|
double[,] terret = new double[256,256];
|
||||||
|
@ -563,8 +573,10 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// delete from land where UUID=globalID
|
/// <list type="bullet">
|
||||||
/// delete from landaccesslist where LandUUID=globalID
|
/// <item>delete from land where UUID=globalID</item>
|
||||||
|
/// <item>delete from landaccesslist where LandUUID=globalID</item>
|
||||||
|
/// </list>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="globalID"></param>
|
/// <param name="globalID"></param>
|
||||||
public void RemoveLandObject(LLUUID globalID)
|
public void RemoveLandObject(LLUUID globalID)
|
||||||
|
@ -629,10 +641,10 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Load (fetch?) a region banlist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="regionUUID"></param>
|
/// <param name="regionUUID">The region UUID</param>
|
||||||
/// <returns></returns>
|
/// <returns>The Region banlist</returns>
|
||||||
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
|
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
|
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
|
||||||
|
@ -660,9 +672,9 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Add an item to region banlist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item">The item</param>
|
||||||
public void AddToRegionBanlist(RegionBanListItem item)
|
public void AddToRegionBanlist(RegionBanListItem item)
|
||||||
{
|
{
|
||||||
lock (m_dataSet)
|
lock (m_dataSet)
|
||||||
|
@ -684,9 +696,9 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Remove an item from region banlist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item">The item</param>
|
||||||
public void RemoveFromRegionBanlist(RegionBanListItem item)
|
public void RemoveFromRegionBanlist(RegionBanListItem item)
|
||||||
{
|
{
|
||||||
lock (m_dataSet)
|
lock (m_dataSet)
|
||||||
|
@ -783,7 +795,7 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// See <see cref="Commit"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
|
@ -798,6 +810,13 @@ namespace OpenSim.Data.MySQL
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dt"></param>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataColumn createCol(DataTable dt, string name, Type type)
|
private static DataColumn createCol(DataTable dt, string name, Type type)
|
||||||
{
|
{
|
||||||
DataColumn col = new DataColumn(name, type);
|
DataColumn col = new DataColumn(name, type);
|
||||||
|
@ -805,6 +824,10 @@ namespace OpenSim.Data.MySQL
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the "terrain" table
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataTable createTerrainTable()
|
private static DataTable createTerrainTable()
|
||||||
{
|
{
|
||||||
DataTable terrain = new DataTable("terrain");
|
DataTable terrain = new DataTable("terrain");
|
||||||
|
@ -815,6 +838,10 @@ namespace OpenSim.Data.MySQL
|
||||||
return terrain;
|
return terrain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the "regionban" table
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataTable createRegionBanTable()
|
private static DataTable createRegionBanTable()
|
||||||
{
|
{
|
||||||
DataTable regionban = new DataTable("regionban");
|
DataTable regionban = new DataTable("regionban");
|
||||||
|
@ -826,6 +853,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the "prims" table
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataTable createPrimTable()
|
private static DataTable createPrimTable()
|
||||||
{
|
{
|
||||||
DataTable prims = new DataTable("prims");
|
DataTable prims = new DataTable("prims");
|
||||||
|
@ -890,6 +921,10 @@ namespace OpenSim.Data.MySQL
|
||||||
return prims;
|
return prims;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the "land" table
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataTable createLandTable()
|
private static DataTable createLandTable()
|
||||||
{
|
{
|
||||||
DataTable land = new DataTable("land");
|
DataTable land = new DataTable("land");
|
||||||
|
@ -934,6 +969,10 @@ namespace OpenSim.Data.MySQL
|
||||||
return land;
|
return land;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the "landaccesslist" table
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataTable createLandAccessListTable()
|
private static DataTable createLandAccessListTable()
|
||||||
{
|
{
|
||||||
DataTable landaccess = new DataTable("landaccesslist");
|
DataTable landaccess = new DataTable("landaccesslist");
|
||||||
|
@ -944,6 +983,10 @@ namespace OpenSim.Data.MySQL
|
||||||
return landaccess;
|
return landaccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the "primshapes" table
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataTable createShapeTable()
|
private static DataTable createShapeTable()
|
||||||
{
|
{
|
||||||
DataTable shapes = new DataTable("primshapes");
|
DataTable shapes = new DataTable("primshapes");
|
||||||
|
@ -984,6 +1027,10 @@ namespace OpenSim.Data.MySQL
|
||||||
return shapes;
|
return shapes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the "primitems" table
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static DataTable createItemsTable()
|
private static DataTable createItemsTable()
|
||||||
{
|
{
|
||||||
DataTable items = new DataTable("primitems");
|
DataTable items = new DataTable("primitems");
|
||||||
|
@ -1025,6 +1072,11 @@ namespace OpenSim.Data.MySQL
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private SceneObjectPart buildPrim(DataRow row)
|
private SceneObjectPart buildPrim(DataRow row)
|
||||||
{
|
{
|
||||||
SceneObjectPart prim = new SceneObjectPart();
|
SceneObjectPart prim = new SceneObjectPart();
|
||||||
|
@ -1153,6 +1205,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return taskItem;
|
return taskItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static LandData buildLandData(DataRow row)
|
private static LandData buildLandData(DataRow row)
|
||||||
{
|
{
|
||||||
LandData newData = new LandData();
|
LandData newData = new LandData();
|
||||||
|
@ -1214,6 +1271,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return newData;
|
return newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
|
private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
|
||||||
{
|
{
|
||||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||||
|
@ -1223,6 +1285,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="val"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static Array serializeTerrain(double[,] val)
|
private static Array serializeTerrain(double[,] val)
|
||||||
{
|
{
|
||||||
MemoryStream str = new MemoryStream(65536*sizeof (double));
|
MemoryStream str = new MemoryStream(65536*sizeof (double));
|
||||||
|
@ -1242,6 +1309,13 @@ namespace OpenSim.Data.MySQL
|
||||||
return str.ToArray();
|
return str.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <param name="prim"></param>
|
||||||
|
/// <param name="sceneGroupID"></param>
|
||||||
|
/// <param name="regionUUID"></param>
|
||||||
private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
|
private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
row["UUID"] = Util.ToRawUuidString(prim.UUID);
|
row["UUID"] = Util.ToRawUuidString(prim.UUID);
|
||||||
|
@ -1318,6 +1392,11 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <param name="taskItem"></param>
|
||||||
private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
|
private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
|
||||||
{
|
{
|
||||||
row["itemID"] = taskItem.ItemID;
|
row["itemID"] = taskItem.ItemID;
|
||||||
|
@ -1343,6 +1422,12 @@ namespace OpenSim.Data.MySQL
|
||||||
row["flags"] = taskItem.Flags;
|
row["flags"] = taskItem.Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <param name="land"></param>
|
||||||
|
/// <param name="regionUUID"></param>
|
||||||
private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
|
private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
row["UUID"] = Util.ToRawUuidString(land.globalID);
|
row["UUID"] = Util.ToRawUuidString(land.globalID);
|
||||||
|
@ -1382,6 +1467,12 @@ namespace OpenSim.Data.MySQL
|
||||||
row["AuthBuyerID"] = land.authBuyerID;
|
row["AuthBuyerID"] = land.authBuyerID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <param name="entry"></param>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID)
|
private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID)
|
||||||
{
|
{
|
||||||
row["LandUUID"] = Util.ToRawUuidString(parcelID);
|
row["LandUUID"] = Util.ToRawUuidString(parcelID);
|
||||||
|
@ -1389,6 +1480,11 @@ namespace OpenSim.Data.MySQL
|
||||||
row["Flags"] = entry.Flags;
|
row["Flags"] = entry.Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private PrimitiveBaseShape buildShape(DataRow row)
|
private PrimitiveBaseShape buildShape(DataRow row)
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape s = new PrimitiveBaseShape();
|
PrimitiveBaseShape s = new PrimitiveBaseShape();
|
||||||
|
@ -1447,6 +1543,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row"></param>
|
||||||
|
/// <param name="prim"></param>
|
||||||
private void fillShapeRow(DataRow row, SceneObjectPart prim)
|
private void fillShapeRow(DataRow row, SceneObjectPart prim)
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape s = prim.Shape;
|
PrimitiveBaseShape s = prim.Shape;
|
||||||
|
@ -1502,6 +1603,12 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prim"></param>
|
||||||
|
/// <param name="sceneGroupID"></param>
|
||||||
|
/// <param name="regionUUID"></param>
|
||||||
private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
|
private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
lock (m_dataSet)
|
lock (m_dataSet)
|
||||||
|
@ -1535,7 +1642,11 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// see IRegionDatastore
|
/// <summary>
|
||||||
|
/// see IRegionDatastore
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="primID"></param>
|
||||||
|
/// <param name="items"></param>
|
||||||
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
|
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
|
||||||
{
|
{
|
||||||
if (!persistPrimInventories)
|
if (!persistPrimInventories)
|
||||||
|
@ -1576,17 +1687,24 @@ namespace OpenSim.Data.MySQL
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a MySQL insert command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="table"></param>
|
||||||
|
/// <param name="dt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is subtle enough to deserve some commentary.
|
||||||
|
/// Instead of doing *lots* and *lots of hardcoded strings
|
||||||
|
/// for database definitions we'll use the fact that
|
||||||
|
/// realistically all insert statements look like "insert
|
||||||
|
/// into A(b, c) values(:b, :c) on the parameterized query
|
||||||
|
/// front. If we just have a list of b, c, etc... we can
|
||||||
|
/// generate these strings instead of typing them out.
|
||||||
|
/// </remarks>
|
||||||
private static MySqlCommand createInsertCommand(string table, DataTable dt)
|
private static MySqlCommand createInsertCommand(string table, DataTable dt)
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* This is subtle enough to deserve some commentary.
|
|
||||||
* Instead of doing *lots* and *lots of hardcoded strings
|
|
||||||
* for database definitions we'll use the fact that
|
|
||||||
* realistically all insert statements look like "insert
|
|
||||||
* into A(b, c) values(:b, :c) on the parameterized query
|
|
||||||
* front. If we just have a list of b, c, etc... we can
|
|
||||||
* generate these strings instead of typing them out.
|
|
||||||
*/
|
|
||||||
string[] cols = new string[dt.Columns.Count];
|
string[] cols = new string[dt.Columns.Count];
|
||||||
for (int i = 0; i < dt.Columns.Count; i++)
|
for (int i = 0; i < dt.Columns.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -1611,6 +1729,13 @@ namespace OpenSim.Data.MySQL
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a MySQL update command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="table"></param>
|
||||||
|
/// <param name="pk"></param>
|
||||||
|
/// <param name="dt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static MySqlCommand createUpdateCommand(string table, string pk, DataTable dt)
|
private static MySqlCommand createUpdateCommand(string table, string pk, DataTable dt)
|
||||||
{
|
{
|
||||||
string sql = "update " + table + " set ";
|
string sql = "update " + table + " set ";
|
||||||
|
@ -1638,6 +1763,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static string defineTable(DataTable dt)
|
private static string defineTable(DataTable dt)
|
||||||
{
|
{
|
||||||
string sql = "create table " + dt.TableName + "(";
|
string sql = "create table " + dt.TableName + "(";
|
||||||
|
@ -1673,16 +1803,18 @@ namespace OpenSim.Data.MySQL
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// This is a convenience function that collapses 5 repetitive
|
/// <para>This is a convenience function that collapses 5 repetitive
|
||||||
/// lines for defining MySqlParameters to 2 parameters:
|
/// lines for defining MySqlParameters to 2 parameters:
|
||||||
/// column name and database type.
|
/// column name and database type.
|
||||||
///
|
/// </para>
|
||||||
|
/// <para>
|
||||||
/// It assumes certain conventions like ?param as the param
|
/// It assumes certain conventions like ?param as the param
|
||||||
/// name to replace in parametrized queries, and that source
|
/// name to replace in parametrized queries, and that source
|
||||||
/// version is always current version, both of which are fine
|
/// version is always current version, both of which are fine
|
||||||
/// for us.
|
/// for us.
|
||||||
///</summary>
|
/// </para>
|
||||||
///<returns>a built MySql parameter</returns>
|
/// </summary>
|
||||||
|
/// <returns>a built MySql parameter</returns>
|
||||||
private static MySqlParameter createMySqlParameter(string name, Type type)
|
private static MySqlParameter createMySqlParameter(string name, Type type)
|
||||||
{
|
{
|
||||||
MySqlParameter param = new MySqlParameter();
|
MySqlParameter param = new MySqlParameter();
|
||||||
|
@ -1693,6 +1825,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="da"></param>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void SetupPrimCommands(MySqlDataAdapter da, MySqlConnection conn)
|
private void SetupPrimCommands(MySqlDataAdapter da, MySqlConnection conn)
|
||||||
{
|
{
|
||||||
MySqlCommand insertCommand = createInsertCommand("prims", m_primTable);
|
MySqlCommand insertCommand = createInsertCommand("prims", m_primTable);
|
||||||
|
@ -1709,6 +1846,11 @@ namespace OpenSim.Data.MySQL
|
||||||
da.DeleteCommand = delete;
|
da.DeleteCommand = delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="da"></param>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn)
|
private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn)
|
||||||
{
|
{
|
||||||
da.InsertCommand = createInsertCommand("primitems", m_itemsTable);
|
da.InsertCommand = createInsertCommand("primitems", m_itemsTable);
|
||||||
|
@ -1722,6 +1864,12 @@ namespace OpenSim.Data.MySQL
|
||||||
delete.Connection = conn;
|
delete.Connection = conn;
|
||||||
da.DeleteCommand = delete;
|
da.DeleteCommand = delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="da"></param>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn)
|
private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn)
|
||||||
{
|
{
|
||||||
da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable);
|
da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable);
|
||||||
|
@ -1736,12 +1884,23 @@ namespace OpenSim.Data.MySQL
|
||||||
delete.Connection = conn;
|
delete.Connection = conn;
|
||||||
da.DeleteCommand = delete;
|
da.DeleteCommand = delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="da"></param>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn)
|
private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn)
|
||||||
{
|
{
|
||||||
da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]);
|
da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]);
|
||||||
da.InsertCommand.Connection = conn;
|
da.InsertCommand.Connection = conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="da"></param>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void setupLandCommands(MySqlDataAdapter da, MySqlConnection conn)
|
private void setupLandCommands(MySqlDataAdapter da, MySqlConnection conn)
|
||||||
{
|
{
|
||||||
da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]);
|
da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]);
|
||||||
|
@ -1751,12 +1910,22 @@ namespace OpenSim.Data.MySQL
|
||||||
da.UpdateCommand.Connection = conn;
|
da.UpdateCommand.Connection = conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="da"></param>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void setupLandAccessCommands(MySqlDataAdapter da, MySqlConnection conn)
|
private void setupLandAccessCommands(MySqlDataAdapter da, MySqlConnection conn)
|
||||||
{
|
{
|
||||||
da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]);
|
da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]);
|
||||||
da.InsertCommand.Connection = conn;
|
da.InsertCommand.Connection = conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="da"></param>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void SetupShapeCommands(MySqlDataAdapter da, MySqlConnection conn)
|
private void SetupShapeCommands(MySqlDataAdapter da, MySqlConnection conn)
|
||||||
{
|
{
|
||||||
da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]);
|
da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]);
|
||||||
|
@ -1771,6 +1940,10 @@ namespace OpenSim.Data.MySQL
|
||||||
da.DeleteCommand = delete;
|
da.DeleteCommand = delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conn">MySQL connection handler</param>
|
||||||
private static void InitDB(MySqlConnection conn)
|
private static void InitDB(MySqlConnection conn)
|
||||||
{
|
{
|
||||||
string createPrims = defineTable(createPrimTable());
|
string createPrims = defineTable(createPrimTable());
|
||||||
|
@ -1859,6 +2032,12 @@ namespace OpenSim.Data.MySQL
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conn"></param>
|
||||||
|
/// <param name="m"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private bool TestTables(MySqlConnection conn, Migration m)
|
private bool TestTables(MySqlConnection conn, Migration m)
|
||||||
{
|
{
|
||||||
// we already have migrations, get out of here
|
// we already have migrations, get out of here
|
||||||
|
@ -1968,6 +2147,11 @@ namespace OpenSim.Data.MySQL
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Type conversion functions
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static DbType dbtypeFromType(Type type)
|
private static DbType dbtypeFromType(Type type)
|
||||||
{
|
{
|
||||||
if (type == typeof (String))
|
if (type == typeof (String))
|
||||||
|
@ -2000,8 +2184,11 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is something we'll need to implement for each db
|
/// <summary>
|
||||||
// slightly differently.
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
|
||||||
private static string MySqlType(Type type)
|
private static string MySqlType(Type type)
|
||||||
{
|
{
|
||||||
if (type == typeof (String))
|
if (type == typeof (String))
|
||||||
|
|
|
@ -49,10 +49,14 @@ namespace OpenSim.Data.MySQL
|
||||||
private MySQLManager database;
|
private MySQLManager database;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises Grid interface
|
/// <para>Initialises Grid interface</para>
|
||||||
/// Loads and initialises the MySQL storage plugin
|
/// <para>
|
||||||
/// Warns and uses the obsolete mysql_connection.ini if connect string is empty.
|
/// <list type="bullet">
|
||||||
/// Check for migration
|
/// <item>Loads and initialises the MySQL storage plugin</item>
|
||||||
|
/// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
|
||||||
|
/// <item>Check for migration</item>
|
||||||
|
/// </list>
|
||||||
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="connect">connect string.</param>
|
/// <param name="connect">connect string.</param>
|
||||||
override public void Initialise(string connect)
|
override public void Initialise(string connect)
|
||||||
|
@ -410,8 +414,8 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a location reservation
|
/// Adds a location reservation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="x"></param>
|
/// <param name="x">x coordinate</param>
|
||||||
/// <param name="y"></param>
|
/// <param name="y">y coordinate</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
override public ReservationData GetReservationAtPoint(uint x, uint y)
|
override public ReservationData GetReservationAtPoint(uint x, uint y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,12 +49,16 @@ namespace OpenSim.Data.MySQL
|
||||||
private MySQLManager database;
|
private MySQLManager database;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises User interface
|
/// <para>Initialises Inventory interface</para>
|
||||||
/// Loads and initialises the MySQL storage plugin
|
/// <para>
|
||||||
/// warns and uses the obsolete mysql_connection.ini if connect string is empty.
|
/// <list type="bullet">
|
||||||
/// Check for migration
|
/// <item>Loads and initialises the MySQL storage plugin</item>
|
||||||
|
/// <item>warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
|
||||||
|
/// <item>Check for migration</item>
|
||||||
|
/// </list>
|
||||||
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="connect">connect string.</param>
|
/// <param name="connect">connect string</param>
|
||||||
public void Initialise(string connect)
|
public void Initialise(string connect)
|
||||||
{
|
{
|
||||||
if (connect != String.Empty)
|
if (connect != String.Empty)
|
||||||
|
@ -90,6 +94,13 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
#region Test and initialization code
|
#region Test and initialization code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>Execute CreateFoldersTable.sql if oldVersion == null</item>
|
||||||
|
/// <item>do nothing if oldVersion != null</item>
|
||||||
|
/// </list>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="oldVersion"></param>
|
||||||
private void UpgradeFoldersTable(string oldVersion)
|
private void UpgradeFoldersTable(string oldVersion)
|
||||||
{
|
{
|
||||||
// null as the version, indicates that the table didn't exist
|
// null as the version, indicates that the table didn't exist
|
||||||
|
@ -99,13 +110,19 @@ namespace OpenSim.Data.MySQL
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the table is already at the current version, then we can exit immediately
|
//// if the table is already at the current version, then we can exit immediately
|
||||||
// if (oldVersion == "Rev. 2")
|
// if (oldVersion == "Rev. 2")
|
||||||
// return;
|
// return;
|
||||||
|
// database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
|
||||||
// database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>Execute CreateItemsTable.sql if oldVersion == null</item>
|
||||||
|
/// <item>Execute "UpgradeItemsTableToVersion3.sql" if oldVersion start with "Rev. 2;"</item>
|
||||||
|
/// </list>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="oldVersion"></param>
|
||||||
private void UpgradeItemsTable(string oldVersion)
|
private void UpgradeItemsTable(string oldVersion)
|
||||||
{
|
{
|
||||||
// null as the version, indicates that the table didn't exist
|
// null as the version, indicates that the table didn't exist
|
||||||
|
@ -123,6 +140,11 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conn">MySQL connection handler</param>
|
||||||
|
/// <param name="m"></param>
|
||||||
private void TestTables(MySqlConnection conn, Migration m)
|
private void TestTables(MySqlConnection conn, Migration m)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||||
|
@ -178,7 +200,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the version of this DB provider
|
/// Returns the version of this DB provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the DB provider</returns>
|
/// <returns>A string containing the DB provider version</returns>
|
||||||
public string getVersion()
|
public string getVersion()
|
||||||
{
|
{
|
||||||
return database.getVersion();
|
return database.getVersion();
|
||||||
|
@ -260,9 +282,9 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// see InventoryItemBase.getUserRootFolder
|
/// see <see cref="InventoryItemBase.getUserRootFolder"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="user">The user UUID</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
||||||
{
|
{
|
||||||
|
@ -545,9 +567,9 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Detele the specified inventory item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item">The inventory item UUID to delete</param>
|
||||||
public void deleteInventoryItem(LLUUID itemID)
|
public void deleteInventoryItem(LLUUID itemID)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -609,9 +631,10 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new inventory folder
|
/// Move an inventory folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folder">Folder to create</param>
|
/// <param name="folder">Folder to move</param>
|
||||||
|
/// <remarks>UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID</remarks>
|
||||||
public void moveInventoryFolder(InventoryFolderBase folder)
|
public void moveInventoryFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
string sql =
|
string sql =
|
||||||
|
|
Loading…
Reference in New Issue