From 4daaac662ff5e952cf13ac093688f56045821250 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 29 Sep 2008 15:22:48 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2295 * 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 --- OpenSim/Data/MSSQL/MSSQLGridData.cs | 2 +- OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 30 ++++++++-- OpenSim/Data/MSSQL/MSSQLRegionData.cs | 97 +++++++++++++++++--------------- OpenSim/Data/MSSQL/MSSQLUserData.cs | 46 ++++++++------- OpenSim/Grid/GridServer/GridManager.cs | 2 +- 5 files changed, 104 insertions(+), 73 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index 552dc04..443116a 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs @@ -163,7 +163,7 @@ namespace OpenSim.Data.MSSQL /// A string containing the storage system name override public string Name { - get { return "Sql OpenGridData"; } + get { return "MSSQL OpenGridData"; } } /// diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 2b9913c..79bab3b 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs @@ -611,6 +611,32 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Returns all activated gesture-items in the inventory of the specified avatar. + /// + /// The of the avatar + /// + /// The list of gestures (s) + /// + public List 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 gestureList = new List(); + while (reader.Read()) + { + gestureList.Add(readInventoryItem(reader)); + } + return gestureList; + } + } + } + #endregion #region Private methods @@ -799,10 +825,6 @@ namespace OpenSim.Data.MSSQL } } - public List fetchActiveGestures (UUID avatarID) - { - return null; - } #endregion } } diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 65f301f..5a53f9b 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; +using System.Drawing; using System.IO; using System.Reflection; using OpenMetaverse; @@ -932,6 +933,10 @@ VALUES prim.Name = (String)row["Name"]; // various text fields 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.SitName = (String)row["SitName"]; prim.TouchName = (String)row["TouchName"]; @@ -948,48 +953,47 @@ VALUES prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); // vectors prim.OffsetPosition = new Vector3( - Convert.ToSingle(row["PositionX"]), - Convert.ToSingle(row["PositionY"]), - Convert.ToSingle(row["PositionZ"]) - ); + Convert.ToSingle(row["PositionX"]), + Convert.ToSingle(row["PositionY"]), + Convert.ToSingle(row["PositionZ"])); + prim.GroupPosition = new Vector3( - Convert.ToSingle(row["GroupPositionX"]), - Convert.ToSingle(row["GroupPositionY"]), - Convert.ToSingle(row["GroupPositionZ"]) - ); + Convert.ToSingle(row["GroupPositionX"]), + Convert.ToSingle(row["GroupPositionY"]), + Convert.ToSingle(row["GroupPositionZ"])); + prim.Velocity = new Vector3( - Convert.ToSingle(row["VelocityX"]), - Convert.ToSingle(row["VelocityY"]), - Convert.ToSingle(row["VelocityZ"]) - ); + Convert.ToSingle(row["VelocityX"]), + Convert.ToSingle(row["VelocityY"]), + Convert.ToSingle(row["VelocityZ"])); + prim.AngularVelocity = new Vector3( - Convert.ToSingle(row["AngularVelocityX"]), - Convert.ToSingle(row["AngularVelocityY"]), - Convert.ToSingle(row["AngularVelocityZ"]) - ); + Convert.ToSingle(row["AngularVelocityX"]), + Convert.ToSingle(row["AngularVelocityY"]), + Convert.ToSingle(row["AngularVelocityZ"])); + prim.Acceleration = new Vector3( - Convert.ToSingle(row["AccelerationX"]), - Convert.ToSingle(row["AccelerationY"]), - Convert.ToSingle(row["AccelerationZ"]) - ); + Convert.ToSingle(row["AccelerationX"]), + Convert.ToSingle(row["AccelerationY"]), + Convert.ToSingle(row["AccelerationZ"])); + // quaternions prim.RotationOffset = new Quaternion( - Convert.ToSingle(row["RotationX"]), - Convert.ToSingle(row["RotationY"]), - Convert.ToSingle(row["RotationZ"]), - Convert.ToSingle(row["RotationW"]) - ); + Convert.ToSingle(row["RotationX"]), + Convert.ToSingle(row["RotationY"]), + Convert.ToSingle(row["RotationZ"]), + Convert.ToSingle(row["RotationW"])); + prim.SitTargetPositionLL = new Vector3( - Convert.ToSingle(row["SitTargetOffsetX"]), - Convert.ToSingle(row["SitTargetOffsetY"]), - Convert.ToSingle(row["SitTargetOffsetZ"]) - ); + Convert.ToSingle(row["SitTargetOffsetX"]), + Convert.ToSingle(row["SitTargetOffsetY"]), + Convert.ToSingle(row["SitTargetOffsetZ"])); + prim.SitTargetOrientationLL = new Quaternion( - Convert.ToSingle(row["SitTargetOrientX"]), - Convert.ToSingle(row["SitTargetOrientY"]), - Convert.ToSingle(row["SitTargetOrientZ"]), - Convert.ToSingle(row["SitTargetOrientW"]) - ); + Convert.ToSingle(row["SitTargetOrientX"]), + Convert.ToSingle(row["SitTargetOrientY"]), + Convert.ToSingle(row["SitTargetOrientZ"]), + Convert.ToSingle(row["SitTargetOrientW"])); prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); @@ -1001,17 +1005,15 @@ VALUES prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); 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"]; + if (!row.IsNull("ParticleSystem")) + prim.ParticleSystem = (Byte[])row["ParticleSystem"]; prim.RotationalVelocity = new Vector3( - Convert.ToSingle(row["OmegaX"]), - Convert.ToSingle(row["OmegaY"]), - Convert.ToSingle(row["OmegaZ"]) - ); - - // TODO: Rotation - // OmegaX, OmegaY, OmegaZ + Convert.ToSingle(row["OmegaX"]), + Convert.ToSingle(row["OmegaY"]), + Convert.ToSingle(row["OmegaZ"])); prim.SetCameraEyeOffset(new Vector3( Convert.ToSingle(row["CameraEyeOffsetX"]), @@ -1039,6 +1041,9 @@ VALUES prim.SalePrice = Convert.ToInt32(row["SalePrice"]); prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); + if (!row.IsNull("ClickAction")) + prim.ClickAction = Convert.ToByte(row["ClickAction"]); + return prim; } @@ -1051,10 +1056,10 @@ VALUES { PrimitiveBaseShape s = new PrimitiveBaseShape(); s.Scale = new Vector3( - Convert.ToSingle(row["ScaleX"]), - Convert.ToSingle(row["ScaleY"]), - Convert.ToSingle(row["ScaleZ"]) - ); + Convert.ToSingle(row["ScaleX"]), + Convert.ToSingle(row["ScaleY"]), + Convert.ToSingle(row["ScaleZ"])); + // paths s.PCode = Convert.ToByte(row["PCode"]); s.PathBegin = Convert.ToUInt16(row["PathBegin"]); diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index cbb7368..ee7765f 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs @@ -51,9 +51,9 @@ namespace OpenSim.Data.MSSQL /// public MSSQLManager database; - private string m_agentsTableName; - private string m_usersTableName; - private string m_userFriendsTableName; + private const string m_agentsTableName = "agents"; + private const string m_usersTableName = "users"; + private const string m_userFriendsTableName = "userfriends"; override public void Initialise() { @@ -68,7 +68,6 @@ namespace OpenSim.Data.MSSQL /// use mssql_connection.ini override public void Initialise(string connect) { - IniFile iniFile = new IniFile("mssql_connection.ini"); if (string.IsNullOrEmpty(connect)) { @@ -76,6 +75,8 @@ namespace OpenSim.Data.MSSQL } else { + IniFile iniFile = new IniFile("mssql_connection.ini"); + string settingDataSource = iniFile.ParseFileReadValue("data_source"); string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog"); string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info"); @@ -85,23 +86,23 @@ namespace OpenSim.Data.MSSQL database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); } - m_usersTableName = iniFile.ParseFileReadValue("userstablename"); - if (m_usersTableName == null) - { - m_usersTableName = "users"; - } - - m_userFriendsTableName = iniFile.ParseFileReadValue("userfriendstablename"); - if (m_userFriendsTableName == null) - { - m_userFriendsTableName = "userfriends"; - } - - m_agentsTableName = iniFile.ParseFileReadValue("agentstablename"); - if (m_agentsTableName == null) - { - m_agentsTableName = "agents"; - } +// m_usersTableName = iniFile.ParseFileReadValue("userstablename"); +// if (m_usersTableName == null) +// { +// m_usersTableName = "users"; +// } +// +// m_userFriendsTableName = iniFile.ParseFileReadValue("userfriendstablename"); +// if (m_userFriendsTableName == null) +// { +// m_userFriendsTableName = "userfriends"; +// } +// +// m_agentsTableName = iniFile.ParseFileReadValue("agentstablename"); +// if (m_agentsTableName == null) +// { +// m_agentsTableName = "agents"; +// } //TODO this can be removed at one time!!!!! TestTables(); @@ -110,6 +111,9 @@ namespace OpenSim.Data.MSSQL database.CheckMigration(_migrationStore); } + /// + /// Releases unmanaged and - optionally - managed resources + /// override public void Dispose() { } /// diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index f2440ff..ed474c5 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -802,7 +802,7 @@ namespace OpenSim.Grid.GridServer response.Value = responseData; 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) { -- cgit v1.1