aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-29 15:22:48 +0000
committerJustin Clarke Casey2008-09-29 15:22:48 +0000
commit4daaac662ff5e952cf13ac093688f56045821250 (patch)
tree466f08a3acbb7514659f4fa2a267fbe75c56ab16 /OpenSim/Data/MSSQL
parent* reactor: move inventory archive classes into separate Inventory/Archiver di... (diff)
downloadopensim-SC_OLD-4daaac662ff5e952cf13ac093688f56045821250.zip
opensim-SC_OLD-4daaac662ff5e952cf13ac093688f56045821250.tar.gz
opensim-SC_OLD-4daaac662ff5e952cf13ac093688f56045821250.tar.bz2
opensim-SC_OLD-4daaac662ff5e952cf13ac093688f56045821250.tar.xz
* 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
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs30
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs97
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs46
4 files changed, 103 insertions, 72 deletions
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
163 /// <returns>A string containing the storage system name</returns> 163 /// <returns>A string containing the storage system name</returns>
164 override public string Name 164 override public string Name
165 { 165 {
166 get { return "Sql OpenGridData"; } 166 get { return "MSSQL OpenGridData"; }
167 } 167 }
168 168
169 /// <summary> 169 /// <summary>
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
611 } 611 }
612 } 612 }
613 613
614 /// <summary>
615 /// Returns all activated gesture-items in the inventory of the specified avatar.
616 /// </summary>
617 /// <param name="avatarID">The <see cref="UUID"/> of the avatar</param>
618 /// <returns>
619 /// The list of gestures (<see cref="InventoryItemBase"/>s)
620 /// </returns>
621 public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
622 {
623 using (AutoClosingSqlCommand command = database.Query("SELECT * FROM inventoryitems WHERE avatarId = @uuid AND assetType = @assetType and flags = 1"))
624 {
625 command.Parameters.Add(database.CreateParameter("uuid", avatarID));
626 command.Parameters.Add(database.CreateParameter("assetType", (int)AssetType.Gesture));
627
628 using (IDataReader reader = command.ExecuteReader())
629 {
630 List<InventoryItemBase> gestureList = new List<InventoryItemBase>();
631 while (reader.Read())
632 {
633 gestureList.Add(readInventoryItem(reader));
634 }
635 return gestureList;
636 }
637 }
638 }
639
614 #endregion 640 #endregion
615 641
616 #region Private methods 642 #region Private methods
@@ -799,10 +825,6 @@ namespace OpenSim.Data.MSSQL
799 } 825 }
800 } 826 }
801 827
802 public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
803 {
804 return null;
805 }
806 #endregion 828 #endregion
807 } 829 }
808} 830}
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;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Data.SqlClient; 31using System.Data.SqlClient;
32using System.Drawing;
32using System.IO; 33using System.IO;
33using System.Reflection; 34using System.Reflection;
34using OpenMetaverse; 35using OpenMetaverse;
@@ -932,6 +933,10 @@ VALUES
932 prim.Name = (String)row["Name"]; 933 prim.Name = (String)row["Name"];
933 // various text fields 934 // various text fields
934 prim.Text = (String)row["Text"]; 935 prim.Text = (String)row["Text"];
936 prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
937 Convert.ToInt32(row["ColorR"]),
938 Convert.ToInt32(row["ColorG"]),
939 Convert.ToInt32(row["ColorB"]));
935 prim.Description = (String)row["Description"]; 940 prim.Description = (String)row["Description"];
936 prim.SitName = (String)row["SitName"]; 941 prim.SitName = (String)row["SitName"];
937 prim.TouchName = (String)row["TouchName"]; 942 prim.TouchName = (String)row["TouchName"];
@@ -948,48 +953,47 @@ VALUES
948 prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); 953 prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
949 // vectors 954 // vectors
950 prim.OffsetPosition = new Vector3( 955 prim.OffsetPosition = new Vector3(
951 Convert.ToSingle(row["PositionX"]), 956 Convert.ToSingle(row["PositionX"]),
952 Convert.ToSingle(row["PositionY"]), 957 Convert.ToSingle(row["PositionY"]),
953 Convert.ToSingle(row["PositionZ"]) 958 Convert.ToSingle(row["PositionZ"]));
954 ); 959
955 prim.GroupPosition = new Vector3( 960 prim.GroupPosition = new Vector3(
956 Convert.ToSingle(row["GroupPositionX"]), 961 Convert.ToSingle(row["GroupPositionX"]),
957 Convert.ToSingle(row["GroupPositionY"]), 962 Convert.ToSingle(row["GroupPositionY"]),
958 Convert.ToSingle(row["GroupPositionZ"]) 963 Convert.ToSingle(row["GroupPositionZ"]));
959 ); 964
960 prim.Velocity = new Vector3( 965 prim.Velocity = new Vector3(
961 Convert.ToSingle(row["VelocityX"]), 966 Convert.ToSingle(row["VelocityX"]),
962 Convert.ToSingle(row["VelocityY"]), 967 Convert.ToSingle(row["VelocityY"]),
963 Convert.ToSingle(row["VelocityZ"]) 968 Convert.ToSingle(row["VelocityZ"]));
964 ); 969
965 prim.AngularVelocity = new Vector3( 970 prim.AngularVelocity = new Vector3(
966 Convert.ToSingle(row["AngularVelocityX"]), 971 Convert.ToSingle(row["AngularVelocityX"]),
967 Convert.ToSingle(row["AngularVelocityY"]), 972 Convert.ToSingle(row["AngularVelocityY"]),
968 Convert.ToSingle(row["AngularVelocityZ"]) 973 Convert.ToSingle(row["AngularVelocityZ"]));
969 ); 974
970 prim.Acceleration = new Vector3( 975 prim.Acceleration = new Vector3(
971 Convert.ToSingle(row["AccelerationX"]), 976 Convert.ToSingle(row["AccelerationX"]),
972 Convert.ToSingle(row["AccelerationY"]), 977 Convert.ToSingle(row["AccelerationY"]),
973 Convert.ToSingle(row["AccelerationZ"]) 978 Convert.ToSingle(row["AccelerationZ"]));
974 ); 979
975 // quaternions 980 // quaternions
976 prim.RotationOffset = new Quaternion( 981 prim.RotationOffset = new Quaternion(
977 Convert.ToSingle(row["RotationX"]), 982 Convert.ToSingle(row["RotationX"]),
978 Convert.ToSingle(row["RotationY"]), 983 Convert.ToSingle(row["RotationY"]),
979 Convert.ToSingle(row["RotationZ"]), 984 Convert.ToSingle(row["RotationZ"]),
980 Convert.ToSingle(row["RotationW"]) 985 Convert.ToSingle(row["RotationW"]));
981 ); 986
982 prim.SitTargetPositionLL = new Vector3( 987 prim.SitTargetPositionLL = new Vector3(
983 Convert.ToSingle(row["SitTargetOffsetX"]), 988 Convert.ToSingle(row["SitTargetOffsetX"]),
984 Convert.ToSingle(row["SitTargetOffsetY"]), 989 Convert.ToSingle(row["SitTargetOffsetY"]),
985 Convert.ToSingle(row["SitTargetOffsetZ"]) 990 Convert.ToSingle(row["SitTargetOffsetZ"]));
986 ); 991
987 prim.SitTargetOrientationLL = new Quaternion( 992 prim.SitTargetOrientationLL = new Quaternion(
988 Convert.ToSingle(row["SitTargetOrientX"]), 993 Convert.ToSingle(row["SitTargetOrientX"]),
989 Convert.ToSingle(row["SitTargetOrientY"]), 994 Convert.ToSingle(row["SitTargetOrientY"]),
990 Convert.ToSingle(row["SitTargetOrientZ"]), 995 Convert.ToSingle(row["SitTargetOrientZ"]),
991 Convert.ToSingle(row["SitTargetOrientW"]) 996 Convert.ToSingle(row["SitTargetOrientW"]));
992 );
993 997
994 prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); 998 prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
995 prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); 999 prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]);
@@ -1001,17 +1005,15 @@ VALUES
1001 prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); 1005 prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]);
1002 prim.SoundFlags = 1; // If it's persisted at all, it's looped 1006 prim.SoundFlags = 1; // If it's persisted at all, it's looped
1003 1007
1004 if (row["TextureAnimation"] != null && row["TextureAnimation"] != DBNull.Value) 1008 if (!row.IsNull("TextureAnimation") && row["TextureAnimation"] != DBNull.Value)
1005 prim.TextureAnimation = (Byte[])row["TextureAnimation"]; 1009 prim.TextureAnimation = (Byte[])row["TextureAnimation"];
1010 if (!row.IsNull("ParticleSystem"))
1011 prim.ParticleSystem = (Byte[])row["ParticleSystem"];
1006 1012
1007 prim.RotationalVelocity = new Vector3( 1013 prim.RotationalVelocity = new Vector3(
1008 Convert.ToSingle(row["OmegaX"]), 1014 Convert.ToSingle(row["OmegaX"]),
1009 Convert.ToSingle(row["OmegaY"]), 1015 Convert.ToSingle(row["OmegaY"]),
1010 Convert.ToSingle(row["OmegaZ"]) 1016 Convert.ToSingle(row["OmegaZ"]));
1011 );
1012
1013 // TODO: Rotation
1014 // OmegaX, OmegaY, OmegaZ
1015 1017
1016 prim.SetCameraEyeOffset(new Vector3( 1018 prim.SetCameraEyeOffset(new Vector3(
1017 Convert.ToSingle(row["CameraEyeOffsetX"]), 1019 Convert.ToSingle(row["CameraEyeOffsetX"]),
@@ -1039,6 +1041,9 @@ VALUES
1039 prim.SalePrice = Convert.ToInt32(row["SalePrice"]); 1041 prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
1040 prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); 1042 prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
1041 1043
1044 if (!row.IsNull("ClickAction"))
1045 prim.ClickAction = Convert.ToByte(row["ClickAction"]);
1046
1042 return prim; 1047 return prim;
1043 } 1048 }
1044 1049
@@ -1051,10 +1056,10 @@ VALUES
1051 { 1056 {
1052 PrimitiveBaseShape s = new PrimitiveBaseShape(); 1057 PrimitiveBaseShape s = new PrimitiveBaseShape();
1053 s.Scale = new Vector3( 1058 s.Scale = new Vector3(
1054 Convert.ToSingle(row["ScaleX"]), 1059 Convert.ToSingle(row["ScaleX"]),
1055 Convert.ToSingle(row["ScaleY"]), 1060 Convert.ToSingle(row["ScaleY"]),
1056 Convert.ToSingle(row["ScaleZ"]) 1061 Convert.ToSingle(row["ScaleZ"]));
1057 ); 1062
1058 // paths 1063 // paths
1059 s.PCode = Convert.ToByte(row["PCode"]); 1064 s.PCode = Convert.ToByte(row["PCode"]);
1060 s.PathBegin = Convert.ToUInt16(row["PathBegin"]); 1065 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
51 /// </summary> 51 /// </summary>
52 public MSSQLManager database; 52 public MSSQLManager database;
53 53
54 private string m_agentsTableName; 54 private const string m_agentsTableName = "agents";
55 private string m_usersTableName; 55 private const string m_usersTableName = "users";
56 private string m_userFriendsTableName; 56 private const string m_userFriendsTableName = "userfriends";
57 57
58 override public void Initialise() 58 override public void Initialise()
59 { 59 {
@@ -68,7 +68,6 @@ namespace OpenSim.Data.MSSQL
68 /// <remarks>use mssql_connection.ini</remarks> 68 /// <remarks>use mssql_connection.ini</remarks>
69 override public void Initialise(string connect) 69 override public void Initialise(string connect)
70 { 70 {
71 IniFile iniFile = new IniFile("mssql_connection.ini");
72 71
73 if (string.IsNullOrEmpty(connect)) 72 if (string.IsNullOrEmpty(connect))
74 { 73 {
@@ -76,6 +75,8 @@ namespace OpenSim.Data.MSSQL
76 } 75 }
77 else 76 else
78 { 77 {
78 IniFile iniFile = new IniFile("mssql_connection.ini");
79
79 string settingDataSource = iniFile.ParseFileReadValue("data_source"); 80 string settingDataSource = iniFile.ParseFileReadValue("data_source");
80 string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog"); 81 string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
81 string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info"); 82 string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
@@ -85,23 +86,23 @@ namespace OpenSim.Data.MSSQL
85 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 86 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword);
86 } 87 }
87 88
88 m_usersTableName = iniFile.ParseFileReadValue("userstablename"); 89// m_usersTableName = iniFile.ParseFileReadValue("userstablename");
89 if (m_usersTableName == null) 90// if (m_usersTableName == null)
90 { 91// {
91 m_usersTableName = "users"; 92// m_usersTableName = "users";
92 } 93// }
93 94//
94 m_userFriendsTableName = iniFile.ParseFileReadValue("userfriendstablename"); 95// m_userFriendsTableName = iniFile.ParseFileReadValue("userfriendstablename");
95 if (m_userFriendsTableName == null) 96// if (m_userFriendsTableName == null)
96 { 97// {
97 m_userFriendsTableName = "userfriends"; 98// m_userFriendsTableName = "userfriends";
98 } 99// }
99 100//
100 m_agentsTableName = iniFile.ParseFileReadValue("agentstablename"); 101// m_agentsTableName = iniFile.ParseFileReadValue("agentstablename");
101 if (m_agentsTableName == null) 102// if (m_agentsTableName == null)
102 { 103// {
103 m_agentsTableName = "agents"; 104// m_agentsTableName = "agents";
104 } 105// }
105 106
106 //TODO this can be removed at one time!!!!! 107 //TODO this can be removed at one time!!!!!
107 TestTables(); 108 TestTables();
@@ -110,6 +111,9 @@ namespace OpenSim.Data.MSSQL
110 database.CheckMigration(_migrationStore); 111 database.CheckMigration(_migrationStore);
111 } 112 }
112 113
114 /// <summary>
115 /// Releases unmanaged and - optionally - managed resources
116 /// </summary>
113 override public void Dispose() { } 117 override public void Dispose() { }
114 118
115 /// <summary> 119 /// <summary>