Apply patch from bug #1609 -- Documentation for Data/MSSQL. Thanks kerunix_Flan!
parent
d96caaa14e
commit
f8ccf00f1c
|
@ -36,6 +36,9 @@ using OpenSim.Framework;
|
|||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// A MSSQL Interface for the Asset server
|
||||
/// </summary>
|
||||
internal class MSSQLAssetData : AssetDataBase
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -44,6 +47,13 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
#region IAssetProvider Members
|
||||
|
||||
/// <summary>
|
||||
/// Migration method
|
||||
/// <list type="bullet">
|
||||
/// <item>Execute "CreateAssetsTable.sql" if tableName == null</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of table</param>
|
||||
private void UpgradeAssetsTable(string tableName)
|
||||
{
|
||||
// null as the version, indicates that the table didn't exist
|
||||
|
@ -68,6 +78,11 @@ namespace OpenSim.Data.MSSQL
|
|||
UpgradeAssetsTable(tableList["assets"]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch Asset from database
|
||||
/// </summary>
|
||||
/// <param name="assetID">the asset UUID</param>
|
||||
/// <returns></returns>
|
||||
override public AssetBase FetchAsset(LLUUID assetID)
|
||||
{
|
||||
AssetBase asset = null;
|
||||
|
@ -85,6 +100,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return asset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create asset in database
|
||||
/// </summary>
|
||||
/// <param name="asset">the asset</param>
|
||||
override public void CreateAsset(AssetBase asset)
|
||||
{
|
||||
if (ExistsAsset((LLUUID) asset.FullID))
|
||||
|
@ -130,7 +149,10 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update asset in database
|
||||
/// </summary>
|
||||
/// <param name="asset">the asset</param>
|
||||
override public void UpdateAsset(AssetBase asset)
|
||||
{
|
||||
SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " +
|
||||
|
@ -171,6 +193,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if asset exist in database
|
||||
/// </summary>
|
||||
/// <param name="uuid"></param>
|
||||
/// <returns>true if exist.</returns>
|
||||
override public bool ExistsAsset(LLUUID uuid)
|
||||
{
|
||||
if (FetchAsset(uuid) != null)
|
||||
|
@ -191,13 +218,23 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
#region IPlugin Members
|
||||
|
||||
/// <summary>
|
||||
/// <para>Initialises asset interface</para>
|
||||
/// <para>
|
||||
/// TODO: this would allow you to pass in connnect info as
|
||||
/// a string instead of file, if someone writes the support
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="connect">connect string</param>
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
// TODO: this would allow you to pass in connnect info as
|
||||
// a string instead of file, if someone writes the support
|
||||
Initialise();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises asset interface
|
||||
/// </summary>
|
||||
/// <remarks>it use mssql_connection.ini</remarks>
|
||||
override public void Initialise()
|
||||
{
|
||||
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
||||
|
@ -214,12 +251,17 @@ namespace OpenSim.Data.MSSQL
|
|||
TestTables();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Database provider version.
|
||||
/// </summary>
|
||||
override public string Version
|
||||
{
|
||||
// get { return database.getVersion(); }
|
||||
get { return database.getVersion(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of this DB provider.
|
||||
/// </summary>
|
||||
override public string Name
|
||||
{
|
||||
get { return "MSSQL Asset storage engine"; }
|
||||
|
|
|
@ -39,6 +39,9 @@ using OpenSim.Region.Environment.Scenes;
|
|||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// A MSSQL Interface for the Region Server.
|
||||
/// </summary>
|
||||
public class MSSQLDataStore : IRegionDataStore
|
||||
{
|
||||
// private static FileSystemDataStore Instance = new FileSystemDataStore();
|
||||
|
@ -67,7 +70,7 @@ namespace OpenSim.Data.MSSQL
|
|||
private DataTable m_landTable;
|
||||
private DataTable m_landAccessListTable;
|
||||
|
||||
// Temporary attribute while this is experimental
|
||||
/// <summary>Temporary attribute while this is experimental</summary>
|
||||
private bool persistPrimInventories;
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -76,7 +79,11 @@ namespace OpenSim.Data.MSSQL
|
|||
*
|
||||
**********************************************************************/
|
||||
|
||||
// see IRegionDataStore
|
||||
/// <summary>
|
||||
/// see IRegionDataStore
|
||||
/// </summary>
|
||||
/// <param name="connectionString"></param>
|
||||
/// <param name="persistPrimInventories"></param>
|
||||
public void Initialise(string connectionString, bool persistPrimInventories)
|
||||
{
|
||||
// Instance.Initialise("", true);
|
||||
|
@ -144,6 +151,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="regionUUID"></param>
|
||||
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
|
||||
{
|
||||
// Instance.StoreObject(obj, regionUUID);
|
||||
|
@ -169,6 +181,11 @@ namespace OpenSim.Data.MSSQL
|
|||
Commit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="regionUUID"></param>
|
||||
public void RemoveObject(LLUUID obj, LLUUID regionUUID)
|
||||
{
|
||||
// Instance.RemoveObject(obj, regionUUID);
|
||||
|
@ -209,6 +226,7 @@ namespace OpenSim.Data.MSSQL
|
|||
/// Remove all persisted items of the given prim.
|
||||
/// The caller must acquire the necessrary synchronization locks and commit or rollback changes.
|
||||
/// </summary>
|
||||
/// <param name="uuid">The item UUID</param>
|
||||
private void RemoveItems(LLUUID uuid)
|
||||
{
|
||||
String sql = String.Format("primID = '{0}'", uuid);
|
||||
|
@ -223,6 +241,7 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <summary>
|
||||
/// Load persisted objects from region storage.
|
||||
/// </summary>
|
||||
/// <param name="regionUUID">The region UUID</param>
|
||||
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
|
||||
{
|
||||
// return Instance.LoadObjects(regionUUID);
|
||||
|
@ -341,6 +360,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Store a terrain revision in region storage.
|
||||
/// </summary>
|
||||
/// <param name="ter">HeightField data</param>
|
||||
/// <param name="regionID">Region UUID</param>
|
||||
public void StoreTerrain(double[,] ter, LLUUID regionID)
|
||||
{
|
||||
int revision = Util.UnixTimeSinceEpoch();
|
||||
|
@ -361,6 +385,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the latest terrain revision from region storage.
|
||||
/// </summary>
|
||||
/// <param name="regionID">The Region UUID</param>
|
||||
/// <returns>HeightField Data</returns>
|
||||
public double[,] LoadTerrain(LLUUID regionID)
|
||||
{
|
||||
double[,] terret = new double[256, 256];
|
||||
|
@ -407,6 +436,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return terret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="globalID"></param>
|
||||
public void RemoveLandObject(LLUUID globalID)
|
||||
{
|
||||
// Instance.RemoveLandObject(globalID);
|
||||
|
@ -429,6 +462,10 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="parcel"></param>
|
||||
public void StoreLandObject(ILandObject parcel)
|
||||
{
|
||||
lock (m_dataSet)
|
||||
|
@ -467,6 +504,11 @@ namespace OpenSim.Data.MSSQL
|
|||
Commit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="regionUUID">The region UUID</param>
|
||||
/// <returns></returns>
|
||||
public List<LandData> LoadLandObjects(LLUUID regionUUID)
|
||||
{
|
||||
List<LandData> landDataForRegion = new List<LandData>();
|
||||
|
@ -492,22 +534,38 @@ namespace OpenSim.Data.MSSQL
|
|||
return landDataForRegion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load (fetch?) the region banlist
|
||||
/// </summary>
|
||||
/// <param name="regionUUID">the region UUID</param>
|
||||
/// <returns>the banlist list</returns>
|
||||
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
|
||||
{
|
||||
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
|
||||
return regionbanlist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// STUB, add an item into region banlist
|
||||
/// </summary>
|
||||
/// <param name="item">the item</param>
|
||||
public void AddToRegionBanlist(RegionBanListItem item)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// STUB, remove an item from region banlist
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void RemoveFromRegionBanlist(RegionBanListItem item)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Commit
|
||||
/// </summary>
|
||||
public void Commit()
|
||||
{
|
||||
if (m_connection.State != ConnectionState.Open)
|
||||
|
@ -535,6 +593,9 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// See <see cref="Commit"/>
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
Commit();
|
||||
|
@ -548,6 +609,13 @@ namespace OpenSim.Data.MSSQL
|
|||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <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)
|
||||
{
|
||||
DataColumn col = new DataColumn(name, type);
|
||||
|
@ -555,6 +623,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return col;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the "terrain" table
|
||||
/// </summary>
|
||||
/// <returns>the datatable</returns>
|
||||
private static DataTable createTerrainTable()
|
||||
{
|
||||
DataTable terrain = new DataTable("terrain");
|
||||
|
@ -566,6 +638,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return terrain;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the "prims" table
|
||||
/// </summary>
|
||||
/// <returns>the datatable</returns>
|
||||
private static DataTable createPrimTable()
|
||||
{
|
||||
DataTable prims = new DataTable("prims");
|
||||
|
@ -630,6 +706,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return prims;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the "land" table
|
||||
/// </summary>
|
||||
/// <returns>the datatable</returns>
|
||||
private static DataTable createLandTable()
|
||||
{
|
||||
DataTable land = new DataTable("land");
|
||||
|
@ -673,6 +753,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return land;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create "landacceslist" table
|
||||
/// </summary>
|
||||
/// <returns>the datatable</returns>
|
||||
private static DataTable createLandAccessListTable()
|
||||
{
|
||||
DataTable landaccess = new DataTable("landaccesslist");
|
||||
|
@ -683,6 +767,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return landaccess;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create "primsshapes" table
|
||||
/// </summary>
|
||||
/// <returns>the datatable</returns>
|
||||
private static DataTable createShapeTable()
|
||||
{
|
||||
DataTable shapes = new DataTable("primshapes");
|
||||
|
@ -725,6 +813,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return shapes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create "primitems" table
|
||||
/// </summary>
|
||||
/// <returns>the datatable</returns>
|
||||
private static DataTable createItemsTable()
|
||||
{
|
||||
DataTable items = new DataTable("primitems");
|
||||
|
@ -766,6 +858,11 @@ namespace OpenSim.Data.MSSQL
|
|||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private SceneObjectPart buildPrim(DataRow row)
|
||||
{
|
||||
SceneObjectPart prim = new SceneObjectPart();
|
||||
|
@ -891,6 +988,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return taskItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private static LandData buildLandData(DataRow row)
|
||||
{
|
||||
LandData newData = new LandData();
|
||||
|
@ -936,6 +1038,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return newData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
|
@ -945,6 +1052,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return entry;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize terrain HeightField
|
||||
/// </summary>
|
||||
/// <param name="val">the terrain heightfield</param>
|
||||
/// <returns></returns>
|
||||
private static Array serializeTerrain(double[,] val)
|
||||
{
|
||||
MemoryStream str = new MemoryStream(65536 * sizeof(double));
|
||||
|
@ -958,6 +1070,13 @@ namespace OpenSim.Data.MSSQL
|
|||
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)
|
||||
{
|
||||
row["UUID"] = prim.UUID;
|
||||
|
@ -1034,6 +1153,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="taskItem"></param>
|
||||
private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
|
||||
{
|
||||
row["itemID"] = taskItem.ItemID;
|
||||
|
@ -1059,6 +1183,12 @@ namespace OpenSim.Data.MSSQL
|
|||
// 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)
|
||||
{
|
||||
row["UUID"] = land.globalID.UUID;
|
||||
|
@ -1097,6 +1227,12 @@ namespace OpenSim.Data.MSSQL
|
|||
row["UserLookAtZ"] = land.userLookAt.Z;
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
row["LandUUID"] = parcelID.UUID;
|
||||
|
@ -1104,6 +1240,11 @@ namespace OpenSim.Data.MSSQL
|
|||
row["Flags"] = entry.Flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private static PrimitiveBaseShape buildShape(DataRow row)
|
||||
{
|
||||
PrimitiveBaseShape s = new PrimitiveBaseShape();
|
||||
|
@ -1143,6 +1284,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="prim"></param>
|
||||
private static void fillShapeRow(DataRow row, SceneObjectPart prim)
|
||||
{
|
||||
PrimitiveBaseShape s = prim.Shape;
|
||||
|
@ -1179,6 +1325,12 @@ namespace OpenSim.Data.MSSQL
|
|||
row["ExtraParams"] = s.ExtraParams;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="prim"></param>
|
||||
/// <param name="sceneGroupID"></param>
|
||||
/// <param name="regionUUID"></param>
|
||||
private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
|
||||
{
|
||||
DataTable prims = m_dataSet.Tables["prims"];
|
||||
|
@ -1209,7 +1361,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
// see IRegionDatastore
|
||||
/// <summary>
|
||||
/// See <see cref="IRegionDatastore"/>
|
||||
/// </summary>
|
||||
/// <param name="primID"></param>
|
||||
/// <param name="items"></param>
|
||||
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
|
||||
{
|
||||
if (!persistPrimInventories)
|
||||
|
@ -1250,6 +1406,12 @@ namespace OpenSim.Data.MSSQL
|
|||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Create an Insert command
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns>the sql command</returns>
|
||||
private static SqlCommand createInsertCommand(string table, DataTable dt)
|
||||
{
|
||||
/**
|
||||
|
@ -1285,6 +1447,13 @@ namespace OpenSim.Data.MSSQL
|
|||
return cmd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an update command
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="pk"></param>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns>the sql command</returns>
|
||||
private static SqlCommand createUpdateCommand(string table, string pk, DataTable dt)
|
||||
{
|
||||
string sql = "update " + table + " set ";
|
||||
|
@ -1312,6 +1481,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return cmd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns></returns>
|
||||
private static string defineTable(DataTable dt)
|
||||
{
|
||||
string sql = "create table " + dt.TableName + "(";
|
||||
|
@ -1345,14 +1519,18 @@ namespace OpenSim.Data.MSSQL
|
|||
**********************************************************************/
|
||||
|
||||
///<summary>
|
||||
/// <para>
|
||||
/// This is a convenience function that collapses 5 repetitive
|
||||
/// lines for defining SqlParameters to 2 parameters:
|
||||
/// column name and database type.
|
||||
///
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// It assumes certain conventions like :param as the param
|
||||
/// name to replace in parametrized queries, and that source
|
||||
/// version is always current version, both of which are fine
|
||||
/// for us.
|
||||
/// </para>
|
||||
///</summary>
|
||||
///<returns>a built Sql parameter</returns>
|
||||
private static SqlParameter createSqlParameter(string name, Type type)
|
||||
|
@ -1365,6 +1543,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return param;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void setupPrimCommands(SqlDataAdapter da, SqlConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("prims", m_dataSet.Tables["prims"]);
|
||||
|
@ -1379,6 +1562,11 @@ namespace OpenSim.Data.MSSQL
|
|||
da.DeleteCommand = delete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void SetupItemsCommands(SqlDataAdapter da, SqlConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("primitems", m_itemsTable);
|
||||
|
@ -1393,12 +1581,22 @@ namespace OpenSim.Data.MSSQL
|
|||
da.DeleteCommand = delete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void setupTerrainCommands(SqlDataAdapter da, SqlConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]);
|
||||
da.InsertCommand.Connection = conn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void setupLandCommands(SqlDataAdapter da, SqlConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]);
|
||||
|
@ -1408,12 +1606,22 @@ namespace OpenSim.Data.MSSQL
|
|||
da.UpdateCommand.Connection = conn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void setupLandAccessCommands(SqlDataAdapter da, SqlConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]);
|
||||
da.InsertCommand.Connection = conn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void setupShapeCommands(SqlDataAdapter da, SqlConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]);
|
||||
|
@ -1428,6 +1636,10 @@ namespace OpenSim.Data.MSSQL
|
|||
da.DeleteCommand = delete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="conn"></param>
|
||||
private static void InitDB(SqlConnection conn)
|
||||
{
|
||||
string createPrims = defineTable(createPrimTable());
|
||||
|
@ -1501,6 +1713,11 @@ namespace OpenSim.Data.MSSQL
|
|||
conn.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="conn"></param>
|
||||
/// <returns></returns>
|
||||
private bool TestTables(SqlConnection conn)
|
||||
{
|
||||
SqlCommand primSelectCmd = new SqlCommand(m_primSelect, conn);
|
||||
|
@ -1601,6 +1818,11 @@ namespace OpenSim.Data.MSSQL
|
|||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Type conversion function
|
||||
/// </summary>
|
||||
/// <param name="type">a Type</param>
|
||||
/// <returns>a DbType</returns>
|
||||
private static DbType dbtypeFromType(Type type)
|
||||
{
|
||||
if (type == typeof(String))
|
||||
|
|
|
@ -37,7 +37,7 @@ using log4net;
|
|||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// A grid data interface for Microsoft SQL Server
|
||||
/// A grid data interface for MSSQL Server
|
||||
/// </summary>
|
||||
public class MSSQLGridData : GridDataBase
|
||||
{
|
||||
|
@ -53,6 +53,8 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
/// <param name="connect">connect string</param>
|
||||
/// <remarks>use mssql_connection.ini</remarks>
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
// TODO: make the connect string actually do something
|
||||
|
@ -77,6 +79,9 @@ namespace OpenSim.Data.MSSQL
|
|||
TestTables();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private void TestTables()
|
||||
{
|
||||
IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>());
|
||||
|
@ -102,7 +107,7 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the storage system name
|
||||
/// The name of this DB provider.
|
||||
/// </summary>
|
||||
/// <returns>A string containing the storage system name</returns>
|
||||
override public string getName()
|
||||
|
@ -111,7 +116,7 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the storage system version
|
||||
/// Database provider version.
|
||||
/// </summary>
|
||||
/// <returns>A string containing the storage system version</returns>
|
||||
override public string getVersion()
|
||||
|
@ -120,13 +125,15 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// NOT IMPLEMENTED,
|
||||
/// Returns a list of regions within the specified ranges
|
||||
/// </summary>
|
||||
/// <param name="a">minimum X coordinate</param>
|
||||
/// <param name="b">minimum Y coordinate</param>
|
||||
/// <param name="c">maximum X coordinate</param>
|
||||
/// <param name="d">maximum Y coordinate</param>
|
||||
/// <returns>An array of region profiles</returns>
|
||||
/// <returns>null</returns>
|
||||
/// <remarks>always return null</remarks>
|
||||
override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
|
||||
{
|
||||
return null;
|
||||
|
@ -240,6 +247,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the specified region in the database
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile to update</param>
|
||||
/// <returns>A dataresponse enum indicating success</returns>
|
||||
public override DataResponse UpdateProfile(RegionProfileData profile)
|
||||
{
|
||||
if (updateRegionRow(profile))
|
||||
|
@ -252,6 +264,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the specified region in the database
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile to update</param>
|
||||
/// <returns>success ?</returns>
|
||||
public bool updateRegionRow(RegionProfileData profile)
|
||||
{
|
||||
//Insert new region
|
||||
|
@ -425,6 +442,12 @@ namespace OpenSim.Data.MSSQL
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NOT IMPLEMENTED
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns>null</returns>
|
||||
override public ReservationData GetReservationAtPoint(uint x, uint y)
|
||||
{
|
||||
return null;
|
||||
|
|
|
@ -37,7 +37,7 @@ using OpenSim.Framework;
|
|||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
/// <summary>
|
||||
/// A MySQL interface for the inventory server
|
||||
/// A MSSQL interface for the inventory server
|
||||
/// </summary>
|
||||
public class MSSQLInventoryData : IInventoryData
|
||||
{
|
||||
|
@ -59,6 +59,11 @@ namespace OpenSim.Data.MSSQL
|
|||
/// </summary>
|
||||
private MSSQLManager database;
|
||||
|
||||
/// <summary>
|
||||
/// Loads and initialises the MSSQL inventory storage interface
|
||||
/// </summary>
|
||||
/// <param name="connect">connect string</param>
|
||||
/// <remarks>use mssql_connection.ini</remarks>
|
||||
public void Initialise(string connect)
|
||||
{
|
||||
// TODO: actually use the provided connect string
|
||||
|
@ -77,6 +82,10 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
#region Test and initialization code
|
||||
|
||||
/// <summary>
|
||||
/// Execute "CreateFoldersTable.sql" if tableName == null
|
||||
/// </summary>
|
||||
/// <param name="tableName">the table name</param>
|
||||
private void UpgradeFoldersTable(string tableName)
|
||||
{
|
||||
// null as the version, indicates that the table didn't exist
|
||||
|
@ -88,6 +97,10 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute "CreateItemsTable.sql" if tableName = null
|
||||
/// </summary>
|
||||
/// <param name="tableName">the table name</param>
|
||||
private void UpgradeItemsTable(string tableName)
|
||||
{
|
||||
// null as the version, indicates that the table didn't exist
|
||||
|
@ -99,6 +112,9 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private void TestTables()
|
||||
{
|
||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||
|
@ -117,7 +133,7 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <summary>
|
||||
/// The name of this DB provider
|
||||
/// </summary>
|
||||
/// <returns>Name of DB provider</returns>
|
||||
/// <returns>A string containing the name of the DB provider</returns>
|
||||
public string getName()
|
||||
{
|
||||
return "MSSQL Inventory Data Interface";
|
||||
|
@ -215,7 +231,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
// see InventoryItemBase.getUserRootFolder
|
||||
/// <summary>
|
||||
/// see InventoryItemBase.getUserRootFolder
|
||||
/// </summary>
|
||||
/// <param name="user">the User UUID</param>
|
||||
/// <returns></returns>
|
||||
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
||||
{
|
||||
try
|
||||
|
@ -549,9 +569,9 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Delete an item in inventory database
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="item">the item UUID</param>
|
||||
public void deleteInventoryItem(LLUUID itemID)
|
||||
{
|
||||
try
|
||||
|
@ -690,6 +710,10 @@ namespace OpenSim.Data.MSSQL
|
|||
return folders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a folder in inventory databasae
|
||||
/// </summary>
|
||||
/// <param name="folderID">the folder UUID</param>
|
||||
protected void deleteOneFolder(LLUUID folderID)
|
||||
{
|
||||
try
|
||||
|
@ -708,6 +732,10 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete an item in inventory database
|
||||
/// </summary>
|
||||
/// <param name="folderID">the item ID</param>
|
||||
protected void deleteItemsInFolder(LLUUID folderID)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -108,12 +108,23 @@ namespace OpenSim.Data.MSSQL
|
|||
// return regions;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="type"></param>
|
||||
protected static void createCol(DataTable dt, string name, Type type)
|
||||
{
|
||||
DataColumn col = new DataColumn(name, type);
|
||||
dt.Columns.Add(col);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns></returns>
|
||||
protected static string defineTable(DataTable dt)
|
||||
{
|
||||
string sql = "create table " + dt.TableName + "(";
|
||||
|
@ -137,9 +148,12 @@ namespace OpenSim.Data.MSSQL
|
|||
return sql;
|
||||
}
|
||||
|
||||
|
||||
// this is something we'll need to implement for each db
|
||||
// slightly differently.
|
||||
/// <summary>
|
||||
/// Type conversion function
|
||||
/// </summary>
|
||||
/// <param name="type">a type</param>
|
||||
/// <returns>a sqltype</returns>
|
||||
/// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
|
||||
public static string SqlType(Type type)
|
||||
{
|
||||
if (type == typeof(String))
|
||||
|
@ -375,6 +389,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return retval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <returns></returns>
|
||||
public AssetBase getAssetRow(IDataReader reader)
|
||||
{
|
||||
AssetBase asset = new AssetBase();
|
||||
|
@ -446,7 +465,7 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <summary>
|
||||
/// Execute a SQL statement stored in a resource, as a string
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="name">the ressource string</param>
|
||||
public void ExecuteResourceSql(string name)
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon);
|
||||
|
@ -454,6 +473,10 @@ namespace OpenSim.Data.MSSQL
|
|||
cmd.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>The actual SqlConnection</returns>
|
||||
public SqlConnection getConnection()
|
||||
{
|
||||
return (SqlConnection)dbcon;
|
||||
|
@ -491,6 +514,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
private string getResourceString(string name)
|
||||
{
|
||||
Assembly assem = GetType().Assembly;
|
||||
|
|
|
@ -53,8 +53,10 @@ namespace OpenSim.Data.MSSQL
|
|||
private string m_userFriendsTableName;
|
||||
|
||||
/// <summary>
|
||||
/// Loads and initialises the MySQL storage plugin
|
||||
/// Loads and initialises the MSSQL storage plugin
|
||||
/// </summary>
|
||||
/// <param name="connect">TODO: do something with the connect string instead of ignoring it.</param>
|
||||
/// <remarks>use mssql_connection.ini</remarks>
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
// TODO: do something with the connect string instead of
|
||||
|
@ -92,6 +94,10 @@ namespace OpenSim.Data.MSSQL
|
|||
TestTables();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool TestTables()
|
||||
{
|
||||
IDbCommand cmd;
|
||||
|
@ -128,6 +134,7 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches the database for a specified user profile by name components
|
||||
/// </summary>
|
||||
|
@ -166,6 +173,12 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
#region User Friends List Data
|
||||
|
||||
/// <summary>
|
||||
/// Add a new friend in the friendlist
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">UUID of the friendlist owner</param>
|
||||
/// <param name="friend">Friend's UUID</param>
|
||||
/// <param name="perms">Permission flag</param>
|
||||
override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
int dtvalue = Util.UnixTimeSinceEpoch();
|
||||
|
@ -209,6 +222,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove an friend from the friendlist
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">UUID of the friendlist owner</param>
|
||||
/// <param name="friend">UUID of the not-so-friendly user to remove from the list</param>
|
||||
override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
|
@ -242,6 +260,12 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update friendlist permission flag for a friend
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">UUID of the friendlist owner</param>
|
||||
/// <param name="friend">UUID of the friend</param>
|
||||
/// <param name="perms">new permission flag</param>
|
||||
override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
|
@ -272,7 +296,11 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get (fetch?) the user's friendlist
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">UUID of the friendlist owner</param>
|
||||
/// <returns>Friendlist list</returns>
|
||||
override public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
|
||||
{
|
||||
List<FriendListItem> Lfli = new List<FriendListItem>();
|
||||
|
@ -321,13 +349,23 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// STUB ! Update current region
|
||||
/// </summary>
|
||||
/// <param name="avatarid">avatar uuid</param>
|
||||
/// <param name="regionuuid">region uuid</param>
|
||||
/// <param name="regionhandle">region handle</param>
|
||||
override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
|
||||
{
|
||||
//m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="queryID"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
||||
{
|
||||
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
|
||||
|
@ -407,7 +445,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return returnlist;
|
||||
}
|
||||
|
||||
// See IUserData
|
||||
/// <summary>
|
||||
/// See IUserData
|
||||
/// </summary>
|
||||
/// <param name="uuid"></param>
|
||||
/// <returns></returns>
|
||||
override public UserProfileData GetUserByUUID(LLUUID uuid)
|
||||
{
|
||||
try
|
||||
|
@ -490,6 +532,13 @@ namespace OpenSim.Data.MSSQL
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Store a weblogin key
|
||||
/// </summary>
|
||||
/// <param name="AgentID">The agent UUID</param>
|
||||
/// <param name="WebLoginKey">the WebLogin Key</param>
|
||||
/// <remarks>unused ?</remarks>
|
||||
override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
|
||||
{
|
||||
UserProfileData user = GetUserByUUID(AgentID);
|
||||
|
@ -626,7 +675,11 @@ namespace OpenSim.Data.MSSQL
|
|||
// Do nothing.
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// update a user profile
|
||||
/// </summary>
|
||||
/// <param name="user">the profile to update</param>
|
||||
/// <returns></returns>
|
||||
override public bool UpdateUserProfile(UserProfileData user)
|
||||
{
|
||||
SqlCommand command = new SqlCommand("UPDATE " + m_usersTableName + " set UUID = @uuid, " +
|
||||
|
@ -726,7 +779,7 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <param name="from">The senders account ID</param>
|
||||
/// <param name="to">The receivers account ID</param>
|
||||
/// <param name="amount">The amount to transfer</param>
|
||||
/// <returns>Success?</returns>
|
||||
/// <returns>false</returns>
|
||||
override public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
|
||||
{
|
||||
return false;
|
||||
|
@ -739,7 +792,7 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <param name="from">The senders account ID</param>
|
||||
/// <param name="to">The receivers account ID</param>
|
||||
/// <param name="item">The item to transfer</param>
|
||||
/// <returns>Success?</returns>
|
||||
/// <returns>false</returns>
|
||||
override public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
|
||||
{
|
||||
return false;
|
||||
|
@ -832,6 +885,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update a user appearence into database
|
||||
/// </summary>
|
||||
/// <param name="user">the used UUID</param>
|
||||
/// <param name="appearance">the appearence</param>
|
||||
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
{
|
||||
string sql = String.Empty;
|
||||
|
@ -893,16 +951,32 @@ namespace OpenSim.Data.MSSQL
|
|||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add an attachement to an avatar
|
||||
/// </summary>
|
||||
/// <param name="user">the avatar UUID</param>
|
||||
/// <param name="item">the item UUID</param>
|
||||
override public void AddAttachment(LLUUID user, LLUUID item)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove an attachement from an avatar
|
||||
/// </summary>
|
||||
/// <param name="user">the avatar UUID</param>
|
||||
/// <param name="item">the item UUID</param>
|
||||
override public void RemoveAttachment(LLUUID user, LLUUID item)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get (fetch?) all attached item to an avatar
|
||||
/// </summary>
|
||||
/// <param name="user">the avatar UUID</param>
|
||||
/// <returns>List of attached item</returns>
|
||||
/// <remarks>return an empty list</remarks>
|
||||
override public List<LLUUID> GetAttachments(LLUUID user)
|
||||
{
|
||||
return new List<LLUUID>();
|
||||
|
|
Loading…
Reference in New Issue