aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs75
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs163
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs14
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations6
-rwxr-xr-xOpenSim/Data/PGSQL/PGSQLGroupsData.cs4
-rwxr-xr-xOpenSim/Data/PGSQL/PGSQLSimulationData.cs46
-rw-r--r--OpenSim/Data/PGSQL/Resources/RegionStore.migrations16
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations6
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs11
9 files changed, 248 insertions, 93 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index 34791cf..93662db 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -36,7 +36,7 @@ using MySql.Data.MySqlClient;
36namespace OpenSim.Data.MySQL 36namespace OpenSim.Data.MySQL
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// A database interface class to a user profile storage system 39 /// Common code for a number of database modules
40 /// </summary> 40 /// </summary>
41 public class MySqlFramework 41 public class MySqlFramework
42 { 42 {
@@ -44,14 +44,24 @@ namespace OpenSim.Data.MySQL
44 log4net.LogManager.GetLogger( 44 log4net.LogManager.GetLogger(
45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected string m_connectionString; 47 protected string m_connectionString = String.Empty;
48 protected object m_dbLock = new object(); 48 protected MySqlTransaction m_trans = null;
49 49
50 // Constructor using a connection string. Instances constructed
51 // this way will open a new connection for each call.
50 protected MySqlFramework(string connectionString) 52 protected MySqlFramework(string connectionString)
51 { 53 {
52 m_connectionString = connectionString; 54 m_connectionString = connectionString;
53 } 55 }
54 56
57 // Constructor using a connection object. Instances constructed
58 // this way will use the connection object and never create
59 // new connections.
60 protected MySqlFramework(MySqlTransaction trans)
61 {
62 m_trans = trans;
63 }
64
55 ////////////////////////////////////////////////////////////// 65 //////////////////////////////////////////////////////////////
56 // 66 //
57 // All non queries are funneled through one connection 67 // All non queries are funneled through one connection
@@ -59,33 +69,48 @@ namespace OpenSim.Data.MySQL
59 // 69 //
60 protected int ExecuteNonQuery(MySqlCommand cmd) 70 protected int ExecuteNonQuery(MySqlCommand cmd)
61 { 71 {
62 lock (m_dbLock) 72 if (m_trans == null)
63 { 73 {
64 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 74 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
65 { 75 {
66 try 76 dbcon.Open();
67 { 77 return ExecuteNonQueryWithConnection(cmd, dbcon);
68 dbcon.Open(); 78 }
69 cmd.Connection = dbcon; 79 }
80 else
81 {
82 return ExecuteNonQueryWithTransaction(cmd, m_trans);
83 }
84 }
70 85
71 try 86 private int ExecuteNonQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
72 { 87 {
73 return cmd.ExecuteNonQuery(); 88 cmd.Transaction = trans;
74 } 89 return ExecuteNonQueryWithConnection(cmd, trans.Connection);
75 catch (Exception e) 90 }
76 { 91
77 m_log.Error(e.Message, e); 92 private int ExecuteNonQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
78 m_log.Error(Environment.StackTrace.ToString()); 93 {
79 return 0; 94 try
80 } 95 {
81 } 96 cmd.Connection = dbcon;
82 catch (Exception e) 97
83 { 98 try
84 m_log.Error(e.Message, e); 99 {
85 return 0; 100 return cmd.ExecuteNonQuery();
86 }
87 } 101 }
102 catch (Exception e)
103 {
104 m_log.Error(e.Message, e);
105 m_log.Error(Environment.StackTrace.ToString());
106 return 0;
107 }
108 }
109 catch (Exception e)
110 {
111 m_log.Error(e.Message, e);
112 return 0;
88 } 113 }
89 } 114 }
90 } 115 }
91} \ No newline at end of file 116}
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 6aae9c6..bd8bbd5 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -53,14 +53,27 @@ namespace OpenSim.Data.MySQL
53 get { return GetType().Assembly; } 53 get { return GetType().Assembly; }
54 } 54 }
55 55
56 public MySQLGenericTableHandler(MySqlTransaction trans,
57 string realm, string storeName) : base(trans)
58 {
59 m_Realm = realm;
60
61 CommonConstruct(storeName);
62 }
63
56 public MySQLGenericTableHandler(string connectionString, 64 public MySQLGenericTableHandler(string connectionString,
57 string realm, string storeName) : base(connectionString) 65 string realm, string storeName) : base(connectionString)
58 { 66 {
59 m_Realm = realm; 67 m_Realm = realm;
60 m_connectionString = connectionString;
61 68
69 CommonConstruct(storeName);
70 }
71
72 protected void CommonConstruct(string storeName)
73 {
62 if (storeName != String.Empty) 74 if (storeName != String.Empty)
63 { 75 {
76 // We always use a new connection for any Migrations
64 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 77 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
65 { 78 {
66 dbcon.Open(); 79 dbcon.Open();
@@ -111,6 +124,11 @@ namespace OpenSim.Data.MySQL
111 124
112 public virtual T[] Get(string[] fields, string[] keys) 125 public virtual T[] Get(string[] fields, string[] keys)
113 { 126 {
127 return Get(fields, keys, String.Empty);
128 }
129
130 public virtual T[] Get(string[] fields, string[] keys, string options)
131 {
114 if (fields.Length != keys.Length) 132 if (fields.Length != keys.Length)
115 return new T[0]; 133 return new T[0];
116 134
@@ -126,8 +144,8 @@ namespace OpenSim.Data.MySQL
126 144
127 string where = String.Join(" and ", terms.ToArray()); 145 string where = String.Join(" and ", terms.ToArray());
128 146
129 string query = String.Format("select * from {0} where {1}", 147 string query = String.Format("select * from {0} where {1} {2}",
130 m_Realm, where); 148 m_Realm, where, options);
131 149
132 cmd.CommandText = query; 150 cmd.CommandText = query;
133 151
@@ -137,72 +155,92 @@ namespace OpenSim.Data.MySQL
137 155
138 protected T[] DoQuery(MySqlCommand cmd) 156 protected T[] DoQuery(MySqlCommand cmd)
139 { 157 {
158 if (m_trans == null)
159 {
160 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
161 {
162 dbcon.Open();
163
164 return DoQueryWithConnection(cmd, dbcon);
165 }
166 }
167 else
168 {
169 return DoQueryWithTransaction(cmd, m_trans);
170 }
171 }
172
173 protected T[] DoQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
174 {
175 cmd.Transaction = trans;
176
177 return DoQueryWithConnection(cmd, trans.Connection);
178 }
179
180 protected T[] DoQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
181 {
140 List<T> result = new List<T>(); 182 List<T> result = new List<T>();
141 183
142 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 184 cmd.Connection = dbcon;
185
186 using (IDataReader reader = cmd.ExecuteReader())
143 { 187 {
144 dbcon.Open(); 188 if (reader == null)
145 cmd.Connection = dbcon; 189 return new T[0];
146 190
147 using (IDataReader reader = cmd.ExecuteReader()) 191 CheckColumnNames(reader);
148 {
149 if (reader == null)
150 return new T[0];
151 192
152 CheckColumnNames(reader); 193 while (reader.Read())
194 {
195 T row = new T();
153 196
154 while (reader.Read()) 197 foreach (string name in m_Fields.Keys)
155 { 198 {
156 T row = new T(); 199 if (reader[name] is DBNull)
157
158 foreach (string name in m_Fields.Keys)
159 { 200 {
160 if (reader[name] is DBNull) 201 continue;
161 {
162 continue;
163 }
164 if (m_Fields[name].FieldType == typeof(bool))
165 {
166 int v = Convert.ToInt32(reader[name]);
167 m_Fields[name].SetValue(row, v != 0 ? true : false);
168 }
169 else if (m_Fields[name].FieldType == typeof(UUID))
170 {
171 m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name]));
172 }
173 else if (m_Fields[name].FieldType == typeof(int))
174 {
175 int v = Convert.ToInt32(reader[name]);
176 m_Fields[name].SetValue(row, v);
177 }
178 else if (m_Fields[name].FieldType == typeof(uint))
179 {
180 uint v = Convert.ToUInt32(reader[name]);
181 m_Fields[name].SetValue(row, v);
182 }
183 else
184 {
185 m_Fields[name].SetValue(row, reader[name]);
186 }
187 } 202 }
188 203 if (m_Fields[name].FieldType == typeof(bool))
189 if (m_DataField != null) 204 {
205 int v = Convert.ToInt32(reader[name]);
206 m_Fields[name].SetValue(row, v != 0 ? true : false);
207 }
208 else if (m_Fields[name].FieldType == typeof(UUID))
209 {
210 m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name]));
211 }
212 else if (m_Fields[name].FieldType == typeof(int))
213 {
214 int v = Convert.ToInt32(reader[name]);
215 m_Fields[name].SetValue(row, v);
216 }
217 else if (m_Fields[name].FieldType == typeof(uint))
218 {
219 uint v = Convert.ToUInt32(reader[name]);
220 m_Fields[name].SetValue(row, v);
221 }
222 else
190 { 223 {
191 Dictionary<string, string> data = 224 m_Fields[name].SetValue(row, reader[name]);
192 new Dictionary<string, string>(); 225 }
226 }
193 227
194 foreach (string col in m_ColumnNames) 228 if (m_DataField != null)
195 { 229 {
196 data[col] = reader[col].ToString(); 230 Dictionary<string, string> data =
197 if (data[col] == null) 231 new Dictionary<string, string>();
198 data[col] = String.Empty;
199 }
200 232
201 m_DataField.SetValue(row, data); 233 foreach (string col in m_ColumnNames)
234 {
235 data[col] = reader[col].ToString();
236 if (data[col] == null)
237 data[col] = String.Empty;
202 } 238 }
203 239
204 result.Add(row); 240 m_DataField.SetValue(row, data);
205 } 241 }
242
243 result.Add(row);
206 } 244 }
207 } 245 }
208 246
@@ -357,14 +395,23 @@ namespace OpenSim.Data.MySQL
357 395
358 public object DoQueryScalar(MySqlCommand cmd) 396 public object DoQueryScalar(MySqlCommand cmd)
359 { 397 {
360 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 398 if (m_trans == null)
361 { 399 {
362 dbcon.Open(); 400 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
363 cmd.Connection = dbcon; 401 {
402 dbcon.Open();
403 cmd.Connection = dbcon;
404
405 return cmd.ExecuteScalar();
406 }
407 }
408 else
409 {
410 cmd.Connection = m_trans.Connection;
411 cmd.Transaction = m_trans;
364 412
365 return cmd.ExecuteScalar(); 413 return cmd.ExecuteScalar();
366 } 414 }
367 } 415 }
368
369 } 416 }
370} 417}
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 8278c0e..5740b91 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -187,7 +187,7 @@ namespace OpenSim.Data.MySQL
187 "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " + 187 "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
188 "AttachedPosY, AttachedPosZ, " + 188 "AttachedPosY, AttachedPosZ, " +
189 "PhysicsShapeType, Density, GravityModifier, " + 189 "PhysicsShapeType, Density, GravityModifier, " +
190 "Friction, Restitution, Vehicle, DynAttrs, " + 190 "Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
191 "RotationAxisLocks" + 191 "RotationAxisLocks" +
192 ") values (" + "?UUID, " + 192 ") values (" + "?UUID, " +
193 "?CreationDate, ?Name, ?Text, " + 193 "?CreationDate, ?Name, ?Text, " +
@@ -224,7 +224,7 @@ namespace OpenSim.Data.MySQL
224 "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " + 224 "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
225 "?AttachedPosY, ?AttachedPosZ, " + 225 "?AttachedPosY, ?AttachedPosZ, " +
226 "?PhysicsShapeType, ?Density, ?GravityModifier, " + 226 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
227 "?Friction, ?Restitution, ?Vehicle, ?DynAttrs," + 227 "?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
228 "?RotationAxisLocks)"; 228 "?RotationAxisLocks)";
229 229
230 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 230 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
@@ -1452,6 +1452,11 @@ namespace OpenSim.Data.MySQL
1452 prim.VehicleParams = vehicle; 1452 prim.VehicleParams = vehicle;
1453 } 1453 }
1454 1454
1455 PhysicsInertiaData pdata = null;
1456 if (row["PhysInertia"].ToString() != String.Empty)
1457 pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
1458 prim.PhysicsInertia = pdata;
1459
1455 return prim; 1460 return prim;
1456 } 1461 }
1457 1462
@@ -1810,6 +1815,11 @@ namespace OpenSim.Data.MySQL
1810 else 1815 else
1811 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); 1816 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1812 1817
1818 if (prim.PhysicsInertia != null)
1819 cmd.Parameters.AddWithValue("PhysInertia", prim.PhysicsInertia.ToXml2());
1820 else
1821 cmd.Parameters.AddWithValue("PhysInertia", String.Empty);
1822
1813 if (prim.VehicleParams != null) 1823 if (prim.VehicleParams != null)
1814 cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); 1824 cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
1815 else 1825 else
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index c63cc95..0577392 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -461,3 +461,9 @@ BEGIN;
461ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL; 461ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
462 462
463COMMIT; 463COMMIT;
464
465:VERSION 57 #----- Add physics inertia data
466
467BEGIN;
468ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
469COMMIT;
diff --git a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
index 6ef576b..f398256 100755
--- a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
@@ -435,7 +435,7 @@ namespace OpenSim.Data.PGSQL
435 435
436 using (NpgsqlCommand cmd = new NpgsqlCommand()) 436 using (NpgsqlCommand cmd = new NpgsqlCommand())
437 { 437 {
438 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); 438 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
439 439
440 ExecuteNonQuery(cmd); 440 ExecuteNonQuery(cmd);
441 } 441 }
@@ -461,7 +461,7 @@ namespace OpenSim.Data.PGSQL
461 461
462 using (NpgsqlCommand cmd = new NpgsqlCommand()) 462 using (NpgsqlCommand cmd = new NpgsqlCommand())
463 { 463 {
464 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); 464 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
465 465
466 ExecuteNonQuery(cmd); 466 ExecuteNonQuery(cmd);
467 } 467 }
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
index 33d12bd..625120b 100755
--- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
@@ -350,10 +350,11 @@ namespace OpenSim.Data.PGSQL
350 ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX, 350 ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
351 ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook, 351 ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
352 ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice, 352 ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
353 ""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem, 353 ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution,
354 ""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
354 ""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches, 355 ""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
355 ""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, 356 ""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
356 ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution 357 ""PhysInertia"" = :PhysInertia
357 WHERE ""UUID"" = :UUID ; 358 WHERE ""UUID"" = :UUID ;
358 359
359 INSERT INTO 360 INSERT INTO
@@ -367,7 +368,7 @@ namespace OpenSim.Data.PGSQL
367 ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"", 368 ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
368 ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"", 369 ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
369 ""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"", 370 ""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
370 ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"" 371 ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""PhysInertia""
371 ) Select 372 ) Select
372 :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask, 373 :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
373 :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX, 374 :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
@@ -378,7 +379,7 @@ namespace OpenSim.Data.PGSQL
378 :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ, 379 :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
379 :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA, 380 :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
380 :ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs, 381 :ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
381 :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution 382 :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :PhysInertia
382 where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID); 383 where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
383 "; 384 ";
384 385
@@ -1678,6 +1679,12 @@ namespace OpenSim.Data.PGSQL
1678 prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); 1679 prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
1679 prim.GroupID = new UUID((Guid)primRow["GroupID"]); 1680 prim.GroupID = new UUID((Guid)primRow["GroupID"]);
1680 prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); 1681 prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
1682
1683 if (primRow["RezzerID"] != DBNull.Value)
1684 prim.RezzerID = new UUID((Guid)primRow["RezzerID"]);
1685 else
1686 prim.RezzerID = UUID.Zero;
1687
1681 prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]); 1688 prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
1682 prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]); 1689 prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
1683 prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]); 1690 prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
@@ -1796,6 +1803,13 @@ namespace OpenSim.Data.PGSQL
1796 prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]); 1803 prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
1797 prim.Friction = Convert.ToSingle(primRow["Friction"]); 1804 prim.Friction = Convert.ToSingle(primRow["Friction"]);
1798 prim.Restitution = Convert.ToSingle(primRow["Restitution"]); 1805 prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
1806 prim.RotationAxisLocks = Convert.ToByte(primRow["RotationAxisLocks"]);
1807
1808
1809 PhysicsInertiaData pdata = null;
1810 if (!(primRow["PhysInertia"] is System.DBNull))
1811 pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
1812 prim.PhysicsInertia = pdata;
1799 1813
1800 return prim; 1814 return prim;
1801 } 1815 }
@@ -2097,6 +2111,7 @@ namespace OpenSim.Data.PGSQL
2097 parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID)); 2111 parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
2098 parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID)); 2112 parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
2099 parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID)); 2113 parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
2114 parameters.Add(_Database.CreateParameter("RezzerID", prim.RezzerID));
2100 parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask)); 2115 parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
2101 parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask)); 2116 parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
2102 parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask)); 2117 parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
@@ -2196,10 +2211,28 @@ namespace OpenSim.Data.PGSQL
2196 parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); 2211 parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
2197 parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); 2212 parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
2198 2213
2199 parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches)); 2214 parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
2215 parameters.Add(_Database.CreateParameter("PassCollisions", prim.PassCollisions));
2216
2217
2218 if (prim.PassTouches)
2219 parameters.Add(_Database.CreateParameter("PassTouches", true));
2220 else
2221 parameters.Add(_Database.CreateParameter("PassTouches", false));
2222
2223 if (prim.PassCollisions)
2224 parameters.Add(_Database.CreateParameter("PassCollisions", 1));
2225 else
2226 parameters.Add(_Database.CreateParameter("PassCollisions", 0));
2200 2227
2201 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); 2228 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
2202 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); 2229 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
2230
2231 if (prim.PhysicsInertia != null)
2232 parameters.Add(_Database.CreateParameter("PhysInertia", prim.PhysicsInertia.ToXml2()));
2233 else
2234 parameters.Add(_Database.CreateParameter("PhysInertia", String.Empty));
2235
2203 2236
2204 if (prim.DynAttrs.CountNamespaces > 0) 2237 if (prim.DynAttrs.CountNamespaces > 0)
2205 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); 2238 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
@@ -2211,12 +2244,13 @@ namespace OpenSim.Data.PGSQL
2211 parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier)); 2244 parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
2212 parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction)); 2245 parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
2213 parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution)); 2246 parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
2247 parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
2214 2248
2215 return parameters.ToArray(); 2249 return parameters.ToArray();
2216 } 2250 }
2217 2251
2218 /// <summary> 2252 /// <summary>
2219 /// Creates the primshape parameters for stroing in DB. 2253 /// Creates the primshape parameters for storing in DB.
2220 /// </summary> 2254 /// </summary>
2221 /// <param name="prim">Basic data of SceneObjectpart prim.</param> 2255 /// <param name="prim">Basic data of SceneObjectpart prim.</param>
2222 /// <param name="sceneGroupID">The scene group ID.</param> 2256 /// <param name="sceneGroupID">The scene group ID.</param>
diff --git a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
index c085939..948d177 100644
--- a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
@@ -1195,3 +1195,19 @@ CREATE TABLE bakedterrain
1195 ); 1195 );
1196 1196
1197COMMIT; 1197COMMIT;
1198
1199:VERSION 45 #---- Add RezzerID filed in table prims
1200
1201BEGIN TRANSACTION;
1202
1203ALTER TABLE prims ADD "RezzerID" uuid NULL;
1204
1205COMMIT;
1206
1207:VERSION 46 #---- Add physics inertia data to table prims
1208
1209BEGIN TRANSACTION;
1210
1211ALTER TABLE prims ADD "PhysInertia" TEXT;
1212
1213COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index eef14d6..fb154cf 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -371,3 +371,9 @@ BEGIN;
371ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL; 371ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
372 372
373COMMIT; 373COMMIT;
374
375:VERSION 36 #----- Add physics inertia data
376
377BEGIN;
378ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
379COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index eec386f..19880de 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -1843,6 +1843,12 @@ namespace OpenSim.Data.SQLite
1843 if (vehicle != null) 1843 if (vehicle != null)
1844 prim.VehicleParams = vehicle; 1844 prim.VehicleParams = vehicle;
1845 } 1845 }
1846
1847 PhysicsInertiaData pdata = null;
1848 if (!(row["PhysInertia"] is DBNull) && row["PhysInertia"].ToString() != String.Empty)
1849 pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
1850 prim.PhysicsInertia = pdata;
1851
1846 return prim; 1852 return prim;
1847 } 1853 }
1848 1854
@@ -2266,6 +2272,11 @@ namespace OpenSim.Data.SQLite
2266 else 2272 else
2267 row["Vehicle"] = String.Empty; 2273 row["Vehicle"] = String.Empty;
2268 2274
2275 if (prim.PhysicsInertia != null)
2276 row["PhysInertia"] = prim.PhysicsInertia.ToXml2();
2277 else
2278 row["PhysInertia"] = String.Empty;
2279
2269 } 2280 }
2270 2281
2271 /// <summary> 2282 /// <summary>