* Updated MSSQL to reflect resend changes 
* Added the new columns in prims table.
* Created a implementation for getting gestures.
* Remove configurable table names for user. 
* Thanks Ruud Lathorp
0.6.0-stable
Justin Clarke Casey 2008-09-29 15:22:48 +00:00
parent 104039b6c6
commit 4daaac662f
6 changed files with 105 additions and 73 deletions

View File

@ -163,7 +163,7 @@ namespace OpenSim.Data.MSSQL
/// <returns>A string containing the storage system name</returns> /// <returns>A string containing the storage system name</returns>
override public string Name override public string Name
{ {
get { return "Sql OpenGridData"; } get { return "MSSQL OpenGridData"; }
} }
/// <summary> /// <summary>

View File

@ -611,6 +611,32 @@ namespace OpenSim.Data.MSSQL
} }
} }
/// <summary>
/// Returns all activated gesture-items in the inventory of the specified avatar.
/// </summary>
/// <param name="avatarID">The <see cref="UUID"/> of the avatar</param>
/// <returns>
/// The list of gestures (<see cref="InventoryItemBase"/>s)
/// </returns>
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
{
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM inventoryitems WHERE avatarId = @uuid AND assetType = @assetType and flags = 1"))
{
command.Parameters.Add(database.CreateParameter("uuid", avatarID));
command.Parameters.Add(database.CreateParameter("assetType", (int)AssetType.Gesture));
using (IDataReader reader = command.ExecuteReader())
{
List<InventoryItemBase> gestureList = new List<InventoryItemBase>();
while (reader.Read())
{
gestureList.Add(readInventoryItem(reader));
}
return gestureList;
}
}
}
#endregion #endregion
#region Private methods #region Private methods
@ -799,10 +825,6 @@ namespace OpenSim.Data.MSSQL
} }
} }
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
{
return null;
}
#endregion #endregion
} }
} }

View File

@ -29,6 +29,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Drawing;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using OpenMetaverse; using OpenMetaverse;
@ -932,6 +933,10 @@ VALUES
prim.Name = (String)row["Name"]; prim.Name = (String)row["Name"];
// various text fields // various text fields
prim.Text = (String)row["Text"]; prim.Text = (String)row["Text"];
prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
Convert.ToInt32(row["ColorR"]),
Convert.ToInt32(row["ColorG"]),
Convert.ToInt32(row["ColorB"]));
prim.Description = (String)row["Description"]; prim.Description = (String)row["Description"];
prim.SitName = (String)row["SitName"]; prim.SitName = (String)row["SitName"];
prim.TouchName = (String)row["TouchName"]; prim.TouchName = (String)row["TouchName"];
@ -948,48 +953,47 @@ VALUES
prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
// vectors // vectors
prim.OffsetPosition = new Vector3( prim.OffsetPosition = new Vector3(
Convert.ToSingle(row["PositionX"]), Convert.ToSingle(row["PositionX"]),
Convert.ToSingle(row["PositionY"]), Convert.ToSingle(row["PositionY"]),
Convert.ToSingle(row["PositionZ"]) Convert.ToSingle(row["PositionZ"]));
);
prim.GroupPosition = new Vector3( prim.GroupPosition = new Vector3(
Convert.ToSingle(row["GroupPositionX"]), Convert.ToSingle(row["GroupPositionX"]),
Convert.ToSingle(row["GroupPositionY"]), Convert.ToSingle(row["GroupPositionY"]),
Convert.ToSingle(row["GroupPositionZ"]) Convert.ToSingle(row["GroupPositionZ"]));
);
prim.Velocity = new Vector3( prim.Velocity = new Vector3(
Convert.ToSingle(row["VelocityX"]), Convert.ToSingle(row["VelocityX"]),
Convert.ToSingle(row["VelocityY"]), Convert.ToSingle(row["VelocityY"]),
Convert.ToSingle(row["VelocityZ"]) Convert.ToSingle(row["VelocityZ"]));
);
prim.AngularVelocity = new Vector3( prim.AngularVelocity = new Vector3(
Convert.ToSingle(row["AngularVelocityX"]), Convert.ToSingle(row["AngularVelocityX"]),
Convert.ToSingle(row["AngularVelocityY"]), Convert.ToSingle(row["AngularVelocityY"]),
Convert.ToSingle(row["AngularVelocityZ"]) Convert.ToSingle(row["AngularVelocityZ"]));
);
prim.Acceleration = new Vector3( prim.Acceleration = new Vector3(
Convert.ToSingle(row["AccelerationX"]), Convert.ToSingle(row["AccelerationX"]),
Convert.ToSingle(row["AccelerationY"]), Convert.ToSingle(row["AccelerationY"]),
Convert.ToSingle(row["AccelerationZ"]) Convert.ToSingle(row["AccelerationZ"]));
);
// quaternions // quaternions
prim.RotationOffset = new Quaternion( prim.RotationOffset = new Quaternion(
Convert.ToSingle(row["RotationX"]), Convert.ToSingle(row["RotationX"]),
Convert.ToSingle(row["RotationY"]), Convert.ToSingle(row["RotationY"]),
Convert.ToSingle(row["RotationZ"]), Convert.ToSingle(row["RotationZ"]),
Convert.ToSingle(row["RotationW"]) Convert.ToSingle(row["RotationW"]));
);
prim.SitTargetPositionLL = new Vector3( prim.SitTargetPositionLL = new Vector3(
Convert.ToSingle(row["SitTargetOffsetX"]), Convert.ToSingle(row["SitTargetOffsetX"]),
Convert.ToSingle(row["SitTargetOffsetY"]), Convert.ToSingle(row["SitTargetOffsetY"]),
Convert.ToSingle(row["SitTargetOffsetZ"]) Convert.ToSingle(row["SitTargetOffsetZ"]));
);
prim.SitTargetOrientationLL = new Quaternion( prim.SitTargetOrientationLL = new Quaternion(
Convert.ToSingle(row["SitTargetOrientX"]), Convert.ToSingle(row["SitTargetOrientX"]),
Convert.ToSingle(row["SitTargetOrientY"]), Convert.ToSingle(row["SitTargetOrientY"]),
Convert.ToSingle(row["SitTargetOrientZ"]), Convert.ToSingle(row["SitTargetOrientZ"]),
Convert.ToSingle(row["SitTargetOrientW"]) Convert.ToSingle(row["SitTargetOrientW"]));
);
prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]);
@ -1001,17 +1005,15 @@ VALUES
prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]);
prim.SoundFlags = 1; // If it's persisted at all, it's looped prim.SoundFlags = 1; // If it's persisted at all, it's looped
if (row["TextureAnimation"] != null && row["TextureAnimation"] != DBNull.Value) if (!row.IsNull("TextureAnimation") && row["TextureAnimation"] != DBNull.Value)
prim.TextureAnimation = (Byte[])row["TextureAnimation"]; prim.TextureAnimation = (Byte[])row["TextureAnimation"];
if (!row.IsNull("ParticleSystem"))
prim.ParticleSystem = (Byte[])row["ParticleSystem"];
prim.RotationalVelocity = new Vector3( prim.RotationalVelocity = new Vector3(
Convert.ToSingle(row["OmegaX"]), Convert.ToSingle(row["OmegaX"]),
Convert.ToSingle(row["OmegaY"]), Convert.ToSingle(row["OmegaY"]),
Convert.ToSingle(row["OmegaZ"]) Convert.ToSingle(row["OmegaZ"]));
);
// TODO: Rotation
// OmegaX, OmegaY, OmegaZ
prim.SetCameraEyeOffset(new Vector3( prim.SetCameraEyeOffset(new Vector3(
Convert.ToSingle(row["CameraEyeOffsetX"]), Convert.ToSingle(row["CameraEyeOffsetX"]),
@ -1039,6 +1041,9 @@ VALUES
prim.SalePrice = Convert.ToInt32(row["SalePrice"]); prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
if (!row.IsNull("ClickAction"))
prim.ClickAction = Convert.ToByte(row["ClickAction"]);
return prim; return prim;
} }
@ -1051,10 +1056,10 @@ VALUES
{ {
PrimitiveBaseShape s = new PrimitiveBaseShape(); PrimitiveBaseShape s = new PrimitiveBaseShape();
s.Scale = new Vector3( s.Scale = new Vector3(
Convert.ToSingle(row["ScaleX"]), Convert.ToSingle(row["ScaleX"]),
Convert.ToSingle(row["ScaleY"]), Convert.ToSingle(row["ScaleY"]),
Convert.ToSingle(row["ScaleZ"]) Convert.ToSingle(row["ScaleZ"]));
);
// paths // paths
s.PCode = Convert.ToByte(row["PCode"]); s.PCode = Convert.ToByte(row["PCode"]);
s.PathBegin = Convert.ToUInt16(row["PathBegin"]); s.PathBegin = Convert.ToUInt16(row["PathBegin"]);

View File

@ -51,9 +51,9 @@ namespace OpenSim.Data.MSSQL
/// </summary> /// </summary>
public MSSQLManager database; public MSSQLManager database;
private string m_agentsTableName; private const string m_agentsTableName = "agents";
private string m_usersTableName; private const string m_usersTableName = "users";
private string m_userFriendsTableName; private const string m_userFriendsTableName = "userfriends";
override public void Initialise() override public void Initialise()
{ {
@ -68,7 +68,6 @@ namespace OpenSim.Data.MSSQL
/// <remarks>use mssql_connection.ini</remarks> /// <remarks>use mssql_connection.ini</remarks>
override public void Initialise(string connect) override public void Initialise(string connect)
{ {
IniFile iniFile = new IniFile("mssql_connection.ini");
if (string.IsNullOrEmpty(connect)) if (string.IsNullOrEmpty(connect))
{ {
@ -76,6 +75,8 @@ namespace OpenSim.Data.MSSQL
} }
else else
{ {
IniFile iniFile = new IniFile("mssql_connection.ini");
string settingDataSource = iniFile.ParseFileReadValue("data_source"); string settingDataSource = iniFile.ParseFileReadValue("data_source");
string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog"); string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info"); string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
@ -85,23 +86,23 @@ namespace OpenSim.Data.MSSQL
database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword);
} }
m_usersTableName = iniFile.ParseFileReadValue("userstablename"); // m_usersTableName = iniFile.ParseFileReadValue("userstablename");
if (m_usersTableName == null) // if (m_usersTableName == null)
{ // {
m_usersTableName = "users"; // m_usersTableName = "users";
} // }
//
m_userFriendsTableName = iniFile.ParseFileReadValue("userfriendstablename"); // m_userFriendsTableName = iniFile.ParseFileReadValue("userfriendstablename");
if (m_userFriendsTableName == null) // if (m_userFriendsTableName == null)
{ // {
m_userFriendsTableName = "userfriends"; // m_userFriendsTableName = "userfriends";
} // }
//
m_agentsTableName = iniFile.ParseFileReadValue("agentstablename"); // m_agentsTableName = iniFile.ParseFileReadValue("agentstablename");
if (m_agentsTableName == null) // if (m_agentsTableName == null)
{ // {
m_agentsTableName = "agents"; // m_agentsTableName = "agents";
} // }
//TODO this can be removed at one time!!!!! //TODO this can be removed at one time!!!!!
TestTables(); TestTables();
@ -110,6 +111,9 @@ namespace OpenSim.Data.MSSQL
database.CheckMigration(_migrationStore); database.CheckMigration(_migrationStore);
} }
/// <summary>
/// Releases unmanaged and - optionally - managed resources
/// </summary>
override public void Dispose() { } override public void Dispose() { }
/// <summary> /// <summary>

View File

@ -802,7 +802,7 @@ namespace OpenSim.Grid.GridServer
response.Value = responseData; response.Value = responseData;
IList simProfileList = new ArrayList(); IList simProfileList = new ArrayList();
bool fastMode = (Config.DatabaseProvider == "OpenSim.Data.MySQL.dll"); bool fastMode = (Config.DatabaseProvider == "OpenSim.Data.MySQL.dll" || Config.DatabaseProvider == "OpenSim.Data.MSSQL.dll");
if (fastMode) if (fastMode)
{ {

View File

@ -1488,6 +1488,7 @@
<Reference name="System" localCopy="false"/> <Reference name="System" localCopy="false"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Data"/> <Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Region.Environment"/> <Reference name="OpenSim.Region.Environment"/>