aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/AssetDataBase.cs2
-rw-r--r--OpenSim/Data/IAssetData.cs2
-rw-r--r--OpenSim/Data/IProfilesData.cs2
-rw-r--r--OpenSim/Data/IUserAccountData.cs1
-rw-r--r--OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs97
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs40
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs73
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs320
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs40
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs24
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs2
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations24
-rw-r--r--OpenSim/Data/MySQL/Resources/UserAccount.migrations7
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs20
-rw-r--r--OpenSim/Data/Null/NullSimulationData.cs5
-rw-r--r--OpenSim/Data/Null/NullUserAccountData.cs5
-rw-r--r--OpenSim/Data/PGSQL/PGSQLAssetData.cs3
-rw-r--r--OpenSim/Data/PGSQL/PGSQLSimulationData.cs5
-rw-r--r--OpenSim/Data/PGSQL/PGSQLUserAccountData.cs5
-rw-r--r--OpenSim/Data/PGSQL/Resources/UserProfiles.migrations2
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations22
-rw-r--r--OpenSim/Data/SQLite/Resources/UserAccount.migrations8
-rw-r--r--OpenSim/Data/SQLite/Resources/UserProfiles.migrations2
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs46
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserAccountData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserProfilesData.cs1
29 files changed, 557 insertions, 219 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs
index 1bb432c..9593a25 100644
--- a/OpenSim/Data/AssetDataBase.cs
+++ b/OpenSim/Data/AssetDataBase.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Data
37 public abstract class AssetDataBase : IAssetDataPlugin 37 public abstract class AssetDataBase : IAssetDataPlugin
38 { 38 {
39 public abstract AssetBase GetAsset(UUID uuid); 39 public abstract AssetBase GetAsset(UUID uuid);
40 public abstract void StoreAsset(AssetBase asset); 40 public abstract bool StoreAsset(AssetBase asset);
41 public abstract bool[] AssetsExist(UUID[] uuids); 41 public abstract bool[] AssetsExist(UUID[] uuids);
42 42
43 public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); 43 public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs
index a41e310..febab5d 100644
--- a/OpenSim/Data/IAssetData.cs
+++ b/OpenSim/Data/IAssetData.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Data
34 public interface IAssetDataPlugin : IPlugin 34 public interface IAssetDataPlugin : IPlugin
35 { 35 {
36 AssetBase GetAsset(UUID uuid); 36 AssetBase GetAsset(UUID uuid);
37 void StoreAsset(AssetBase asset); 37 bool StoreAsset(AssetBase asset);
38 bool[] AssetsExist(UUID[] uuids); 38 bool[] AssetsExist(UUID[] uuids);
39 List<AssetMetadata> FetchAssetMetadataSet(int start, int count); 39 List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
40 void Initialise(string connect); 40 void Initialise(string connect);
diff --git a/OpenSim/Data/IProfilesData.cs b/OpenSim/Data/IProfilesData.cs
index 7fb075d..a4a32a9 100644
--- a/OpenSim/Data/IProfilesData.cs
+++ b/OpenSim/Data/IProfilesData.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Data
48 bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result); 48 bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result);
49 bool UpdateAvatarInterests(UserProfileProperties up, ref string result); 49 bool UpdateAvatarInterests(UserProfileProperties up, ref string result);
50 bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result); 50 bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result);
51 bool UpdateUserPreferences(ref UserPreferences pref, ref string result); 51 bool UpdateUserPreferences(ref UserPreferences pref, ref string result);
52 bool GetUserPreferences(ref UserPreferences pref, ref string result); 52 bool GetUserPreferences(ref UserPreferences pref, ref string result);
53 bool GetUserAppData(ref UserAppData props, ref string result); 53 bool GetUserAppData(ref UserAppData props, ref string result);
54 bool SetUserAppData(UserAppData props, ref string result); 54 bool SetUserAppData(UserAppData props, ref string result);
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs
index 906ba6c..bc7eda7 100644
--- a/OpenSim/Data/IUserAccountData.cs
+++ b/OpenSim/Data/IUserAccountData.cs
@@ -50,5 +50,6 @@ namespace OpenSim.Data
50 bool Store(UserAccountData data); 50 bool Store(UserAccountData data);
51 bool Delete(string field, string val); 51 bool Delete(string field, string val);
52 UserAccountData[] GetUsers(UUID scopeID, string query); 52 UserAccountData[] GetUsers(UUID scopeID, string query);
53 UserAccountData[] GetUsersWhere(UUID scopeID, string where);
53 } 54 }
54} 55}
diff --git a/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs b/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs
index ed0ab98..17f1374 100644
--- a/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs
+++ b/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 5d8da17..1488e1a 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -154,63 +154,59 @@ namespace OpenSim.Data.MySQL
154 /// </summary> 154 /// </summary>
155 /// <param name="asset">Asset UUID to create</param> 155 /// <param name="asset">Asset UUID to create</param>
156 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> 156 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
157 override public void StoreAsset(AssetBase asset) 157 override public bool StoreAsset(AssetBase asset)
158 { 158 {
159 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 159 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
160 { 160 {
161 dbcon.Open(); 161 dbcon.Open();
162 162
163 string assetName = asset.Name;
164 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
165 {
166 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
167 m_log.WarnFormat(
168 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
169 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
170 }
171
172 string assetDescription = asset.Description;
173 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
174 {
175 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
176 m_log.WarnFormat(
177 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
178 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
179 }
180
163 using (MySqlCommand cmd = 181 using (MySqlCommand cmd =
164 new MySqlCommand( 182 new MySqlCommand(
165 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + 183 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
166 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)", 184 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
167 dbcon)) 185 dbcon))
168 { 186 {
169 string assetName = asset.Name;
170 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
171 {
172 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
173 m_log.WarnFormat(
174 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
175 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
176 }
177
178 string assetDescription = asset.Description;
179 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
180 {
181 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
182 m_log.WarnFormat(
183 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
184 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
185 }
186
187 try 187 try
188 { 188 {
189 using (cmd) 189 // create unix epoch time
190 { 190 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
191 // create unix epoch time 191 cmd.Parameters.AddWithValue("?id", asset.ID);
192 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); 192 cmd.Parameters.AddWithValue("?name", assetName);
193 cmd.Parameters.AddWithValue("?id", asset.ID); 193 cmd.Parameters.AddWithValue("?description", assetDescription);
194 cmd.Parameters.AddWithValue("?name", assetName); 194 cmd.Parameters.AddWithValue("?assetType", asset.Type);
195 cmd.Parameters.AddWithValue("?description", assetDescription); 195 cmd.Parameters.AddWithValue("?local", asset.Local);
196 cmd.Parameters.AddWithValue("?assetType", asset.Type); 196 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
197 cmd.Parameters.AddWithValue("?local", asset.Local); 197 cmd.Parameters.AddWithValue("?create_time", now);
198 cmd.Parameters.AddWithValue("?temporary", asset.Temporary); 198 cmd.Parameters.AddWithValue("?access_time", now);
199 cmd.Parameters.AddWithValue("?create_time", now); 199 cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
200 cmd.Parameters.AddWithValue("?access_time", now); 200 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
201 cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); 201 cmd.Parameters.AddWithValue("?data", asset.Data);
202 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); 202 cmd.ExecuteNonQuery();
203 cmd.Parameters.AddWithValue("?data", asset.Data); 203 return true;
204 cmd.ExecuteNonQuery();
205 }
206 } 204 }
207 catch (Exception e) 205 catch (Exception e)
208 { 206 {
209 m_log.Error( 207 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
210 string.Format( 208 asset.FullID, asset.Name, e.Message);
211 "[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ", 209 return false;
212 asset.FullID, asset.Name)
213 , e);
214 } 210 }
215 } 211 }
216 } 212 }
@@ -227,21 +223,18 @@ namespace OpenSim.Data.MySQL
227 { 223 {
228 try 224 try
229 { 225 {
230 using (cmd) 226 // create unix epoch time
231 { 227 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
232 // create unix epoch time 228 cmd.Parameters.AddWithValue("?id", asset.ID);
233 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); 229 cmd.Parameters.AddWithValue("?access_time", now);
234 cmd.Parameters.AddWithValue("?id", asset.ID); 230 cmd.ExecuteNonQuery();
235 cmd.Parameters.AddWithValue("?access_time", now);
236 cmd.ExecuteNonQuery();
237 }
238 } 231 }
239 catch (Exception e) 232 catch (Exception e)
240 { 233 {
241 m_log.Error( 234 m_log.Error(
242 string.Format( 235 string.Format(
243 "[ASSETS DB]: Failure updating access_time for asset {0} with name {1}. Exception ", 236 "[ASSETS DB]: Failure updating access_time for asset {0} with name {1}. Exception ",
244 asset.FullID, asset.Name), 237 asset.FullID, asset.Name),
245 e); 238 e);
246 } 239 }
247 } 240 }
@@ -364,4 +357,4 @@ namespace OpenSim.Data.MySQL
364 357
365 #endregion 358 #endregion
366 } 359 }
367} \ No newline at end of file 360}
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index 5820a90..34791cf 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -45,27 +45,45 @@ namespace OpenSim.Data.MySQL
45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected string m_connectionString; 47 protected string m_connectionString;
48 protected object m_dbLock = new object();
48 49
49 protected MySqlFramework(string connectionString) 50 protected MySqlFramework(string connectionString)
50 { 51 {
51 m_connectionString = connectionString; 52 m_connectionString = connectionString;
52 } 53 }
53 54
55 //////////////////////////////////////////////////////////////
56 //
57 // All non queries are funneled through one connection
58 // to increase performance a little
59 //
54 protected int ExecuteNonQuery(MySqlCommand cmd) 60 protected int ExecuteNonQuery(MySqlCommand cmd)
55 { 61 {
56 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 62 lock (m_dbLock)
57 { 63 {
58 dbcon.Open(); 64 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
59 cmd.Connection = dbcon;
60
61 try
62 {
63 return cmd.ExecuteNonQuery();
64 }
65 catch (Exception e)
66 { 65 {
67 m_log.Error(e.Message, e); 66 try
68 return 0; 67 {
68 dbcon.Open();
69 cmd.Connection = dbcon;
70
71 try
72 {
73 return cmd.ExecuteNonQuery();
74 }
75 catch (Exception e)
76 {
77 m_log.Error(e.Message, e);
78 m_log.Error(Environment.StackTrace.ToString());
79 return 0;
80 }
81 }
82 catch (Exception e)
83 {
84 m_log.Error(e.Message, e);
85 return 0;
86 }
69 } 87 }
70 } 88 }
71 } 89 }
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 35fa89f..dc657c8 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -175,6 +175,11 @@ namespace OpenSim.Data.MySQL
175 int v = Convert.ToInt32(reader[name]); 175 int v = Convert.ToInt32(reader[name]);
176 m_Fields[name].SetValue(row, v); 176 m_Fields[name].SetValue(row, v);
177 } 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 }
178 else 183 else
179 { 184 {
180 m_Fields[name].SetValue(row, reader[name]); 185 m_Fields[name].SetValue(row, reader[name]);
@@ -362,4 +367,4 @@ namespace OpenSim.Data.MySQL
362 } 367 }
363 368
364 } 369 }
365} \ No newline at end of file 370}
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 2ad7590..3dc049b 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Data.MySQL
82 82
83 public RegionData Get(int posX, int posY, UUID scopeID) 83 public RegionData Get(int posX, int posY, UUID scopeID)
84 { 84 {
85/* fixed size regions
85 string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY"; 86 string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
86 if (scopeID != UUID.Zero) 87 if (scopeID != UUID.Zero)
87 command += " and ScopeID = ?scopeID"; 88 command += " and ScopeID = ?scopeID";
@@ -98,6 +99,45 @@ namespace OpenSim.Data.MySQL
98 99
99 return ret[0]; 100 return ret[0];
100 } 101 }
102*/
103 // extend database search for maximum region size area
104 string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
105 if (scopeID != UUID.Zero)
106 command += " and ScopeID = ?scopeID";
107
108 int startX = posX - (int)Constants.MaximumRegionSize;
109 int startY = posY - (int)Constants.MaximumRegionSize;
110 int endX = posX;
111 int endY = posY;
112
113 List<RegionData> ret;
114 using (MySqlCommand cmd = new MySqlCommand(command))
115 {
116 cmd.Parameters.AddWithValue("?startX", startX.ToString());
117 cmd.Parameters.AddWithValue("?startY", startY.ToString());
118 cmd.Parameters.AddWithValue("?endX", endX.ToString());
119 cmd.Parameters.AddWithValue("?endY", endY.ToString());
120 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
121
122 ret = RunCommand(cmd);
123 }
124
125 if (ret.Count == 0)
126 return null;
127
128 // find the first that contains pos
129 RegionData rg = null;
130 foreach (RegionData r in ret)
131 {
132 if (posX >= r.posX && posX < r.posX + r.sizeX
133 && posY >= r.posY && posY < r.posY + r.sizeY)
134 {
135 rg = r;
136 break;
137 }
138 }
139
140 return rg;
101 } 141 }
102 142
103 public RegionData Get(UUID regionID, UUID scopeID) 143 public RegionData Get(UUID regionID, UUID scopeID)
@@ -121,6 +161,7 @@ namespace OpenSim.Data.MySQL
121 161
122 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) 162 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
123 { 163 {
164/* fix size regions
124 string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY"; 165 string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY";
125 if (scopeID != UUID.Zero) 166 if (scopeID != UUID.Zero)
126 command += " and ScopeID = ?scopeID"; 167 command += " and ScopeID = ?scopeID";
@@ -135,6 +176,38 @@ namespace OpenSim.Data.MySQL
135 176
136 return RunCommand(cmd); 177 return RunCommand(cmd);
137 } 178 }
179 */
180 string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
181 if (scopeID != UUID.Zero)
182 command += " and ScopeID = ?scopeID";
183
184 int qstartX = startX - (int)Constants.MaximumRegionSize;
185 int qstartY = startY - (int)Constants.MaximumRegionSize;
186
187 List<RegionData> dbret;
188 using (MySqlCommand cmd = new MySqlCommand(command))
189 {
190 cmd.Parameters.AddWithValue("?startX", qstartX.ToString());
191 cmd.Parameters.AddWithValue("?startY", qstartY.ToString());
192 cmd.Parameters.AddWithValue("?endX", endX.ToString());
193 cmd.Parameters.AddWithValue("?endY", endY.ToString());
194 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
195
196 dbret = RunCommand(cmd);
197 }
198
199 List<RegionData> ret = new List<RegionData>();
200
201 if (dbret.Count == 0)
202 return ret;
203
204 foreach (RegionData r in dbret)
205 {
206 if (r.posX + r.sizeX > startX && r.posX <= endX
207 && r.posY + r.sizeX > startY && r.posY <= endY)
208 ret.Add(r);
209 }
210 return ret;
138 } 211 }
139 212
140 public List<RegionData> RunCommand(MySqlCommand cmd) 213 public List<RegionData> RunCommand(MySqlCommand cmd)
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index bb0ab75..46364a5 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Data.MySQL
76 Initialise(connectionString); 76 Initialise(connectionString);
77 } 77 }
78 78
79 public void Initialise(string connectionString) 79 public virtual void Initialise(string connectionString)
80 { 80 {
81 m_connectionString = connectionString; 81 m_connectionString = connectionString;
82 82
@@ -123,7 +123,7 @@ namespace OpenSim.Data.MySQL
123 123
124 public void Dispose() {} 124 public void Dispose() {}
125 125
126 public void StoreObject(SceneObjectGroup obj, UUID regionUUID) 126 public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
127 { 127 {
128 uint flags = obj.RootPart.GetEffectiveObjectFlags(); 128 uint flags = obj.RootPart.GetEffectiveObjectFlags();
129 129
@@ -183,10 +183,12 @@ namespace OpenSim.Data.MySQL
183 "ParticleSystem, ClickAction, Material, " + 183 "ParticleSystem, ClickAction, Material, " +
184 "CollisionSound, CollisionSoundVolume, " + 184 "CollisionSound, CollisionSoundVolume, " +
185 "PassTouches, " + 185 "PassTouches, " +
186 "LinkNumber, MediaURL, AttachedPosX, " + 186 "PassCollisions, " +
187 "AttachedPosY, AttachedPosZ, KeyframeMotion, " + 187 "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
188 "AttachedPosY, AttachedPosZ, " +
188 "PhysicsShapeType, Density, GravityModifier, " + 189 "PhysicsShapeType, Density, GravityModifier, " +
189 "Friction, Restitution, DynAttrs " + 190 "Friction, Restitution, Vehicle, DynAttrs, " +
191 "RotationAxisLocks" +
190 ") values (" + "?UUID, " + 192 ") values (" + "?UUID, " +
191 "?CreationDate, ?Name, ?Text, " + 193 "?CreationDate, ?Name, ?Text, " +
192 "?Description, ?SitName, ?TouchName, " + 194 "?Description, ?SitName, ?TouchName, " +
@@ -218,11 +220,12 @@ namespace OpenSim.Data.MySQL
218 "?SaleType, ?ColorR, ?ColorG, " + 220 "?SaleType, ?ColorR, ?ColorG, " +
219 "?ColorB, ?ColorA, ?ParticleSystem, " + 221 "?ColorB, ?ColorA, ?ParticleSystem, " +
220 "?ClickAction, ?Material, ?CollisionSound, " + 222 "?ClickAction, ?Material, ?CollisionSound, " +
221 "?CollisionSoundVolume, ?PassTouches, " + 223 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
222 "?LinkNumber, ?MediaURL, ?AttachedPosX, " + 224 "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
223 "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " + 225 "?AttachedPosY, ?AttachedPosZ, " +
224 "?PhysicsShapeType, ?Density, ?GravityModifier, " + 226 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
225 "?Friction, ?Restitution, ?DynAttrs)"; 227 "?Friction, ?Restitution, ?Vehicle, ?DynAttrs," +
228 "?RotationAxisLocks)";
226 229
227 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 230 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
228 231
@@ -262,7 +265,7 @@ namespace OpenSim.Data.MySQL
262 } 265 }
263 } 266 }
264 267
265 public void RemoveObject(UUID obj, UUID regionUUID) 268 public virtual void RemoveObject(UUID obj, UUID regionUUID)
266 { 269 {
267// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); 270// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
268 271
@@ -317,7 +320,8 @@ namespace OpenSim.Data.MySQL
317 /// <param name="uuid">the Item UUID</param> 320 /// <param name="uuid">the Item UUID</param>
318 private void RemoveItems(UUID uuid) 321 private void RemoveItems(UUID uuid)
319 { 322 {
320 lock (m_dbLock) 323 // locked by caller
324// lock (m_dbLock)
321 { 325 {
322 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 326 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
323 { 327 {
@@ -411,7 +415,7 @@ namespace OpenSim.Data.MySQL
411 } 415 }
412 } 416 }
413 417
414 public List<SceneObjectGroup> LoadObjects(UUID regionID) 418 public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
415 { 419 {
416 const int ROWS_PER_QUERY = 5000; 420 const int ROWS_PER_QUERY = 5000;
417 421
@@ -590,40 +594,53 @@ namespace OpenSim.Data.MySQL
590 594
591 public void StoreTerrain(TerrainData terrData, UUID regionID) 595 public void StoreTerrain(TerrainData terrData, UUID regionID)
592 { 596 {
593 lock (m_dbLock) 597 Util.FireAndForget(delegate(object x)
594 { 598 {
595 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 599 m_log.Info("[REGION DB]: Storing terrain");
596 {
597 dbcon.Open();
598 600
599 using (MySqlCommand cmd = dbcon.CreateCommand()) 601 lock (m_dbLock)
602 {
603 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
600 { 604 {
601 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; 605 dbcon.Open();
602 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
603
604 ExecuteNonQuery(cmd);
605 606
606 int terrainDBRevision; 607 using (MySqlCommand cmd = dbcon.CreateCommand())
607 Array terrainDBblob; 608 {
608 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); 609 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
610 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
609 611
610 m_log.InfoFormat("{0} Storing terrain. X={1}, Y={2}, rev={3}", 612 using (MySqlCommand cmd2 = dbcon.CreateCommand())
611 LogHeader, terrData.SizeX, terrData.SizeY, terrainDBRevision); 613 {
614 try
615 {
616 cmd2.CommandText = "insert into terrain (RegionUUID, " +
617 "Revision, Heightfield) values (?RegionUUID, " +
618 "?Revision, ?Heightfield)";
612 619
613 cmd.CommandText = "insert into terrain (RegionUUID, Revision, Heightfield)" 620 int terrainDBRevision;
614 + "values (?RegionUUID, ?Revision, ?Heightfield)"; 621 Array terrainDBblob;
622 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
615 623
616 cmd.Parameters.AddWithValue("Revision", terrainDBRevision); 624 cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
617 cmd.Parameters.AddWithValue("Heightfield", terrainDBblob); 625 cmd2.Parameters.AddWithValue("Revision", terrainDBRevision);
626 cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob);
618 627
619 ExecuteNonQuery(cmd); 628 ExecuteNonQuery(cmd);
629 ExecuteNonQuery(cmd2);
630 }
631 catch (Exception e)
632 {
633 m_log.ErrorFormat(e.ToString());
634 }
635 }
636 }
620 } 637 }
621 } 638 }
622 } 639 });
623 } 640 }
624 641
625 // Legacy region loading 642 // Legacy region loading
626 public double[,] LoadTerrain(UUID regionID) 643 public virtual double[,] LoadTerrain(UUID regionID)
627 { 644 {
628 double[,] ret = null; 645 double[,] ret = null;
629 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); 646 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
@@ -655,8 +672,11 @@ namespace OpenSim.Data.MySQL
655 while (reader.Read()) 672 while (reader.Read())
656 { 673 {
657 int rev = Convert.ToInt32(reader["Revision"]); 674 int rev = Convert.ToInt32(reader["Revision"]);
658 byte[] blob = (byte[])reader["Heightfield"]; 675 if ((reader["Heightfield"] != DBNull.Value))
659 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); 676 {
677 byte[] blob = (byte[])reader["Heightfield"];
678 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
679 }
660 } 680 }
661 } 681 }
662 } 682 }
@@ -666,7 +686,7 @@ namespace OpenSim.Data.MySQL
666 return terrData; 686 return terrData;
667 } 687 }
668 688
669 public void RemoveLandObject(UUID globalID) 689 public virtual void RemoveLandObject(UUID globalID)
670 { 690 {
671 lock (m_dbLock) 691 lock (m_dbLock)
672 { 692 {
@@ -685,7 +705,7 @@ namespace OpenSim.Data.MySQL
685 } 705 }
686 } 706 }
687 707
688 public void StoreLandObject(ILandObject parcel) 708 public virtual void StoreLandObject(ILandObject parcel)
689 { 709 {
690 lock (m_dbLock) 710 lock (m_dbLock)
691 { 711 {
@@ -705,7 +725,8 @@ namespace OpenSim.Data.MySQL
705 "UserLocationX, UserLocationY, UserLocationZ, " + 725 "UserLocationX, UserLocationY, UserLocationZ, " +
706 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 726 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
707 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + 727 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
708 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + 728 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
729 "SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
709 "?UUID, ?RegionUUID, " + 730 "?UUID, ?RegionUUID, " +
710 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 731 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
711 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + 732 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@@ -716,7 +737,8 @@ namespace OpenSim.Data.MySQL
716 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 737 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
717 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 738 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
718 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ 739 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
719 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; 740 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " +
741 "?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)";
720 742
721 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 743 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
722 744
@@ -742,7 +764,7 @@ namespace OpenSim.Data.MySQL
742 } 764 }
743 } 765 }
744 766
745 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) 767 public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
746 { 768 {
747 RegionLightShareData nWP = new RegionLightShareData(); 769 RegionLightShareData nWP = new RegionLightShareData();
748 nWP.OnSave += StoreRegionWindlightSettings; 770 nWP.OnSave += StoreRegionWindlightSettings;
@@ -840,7 +862,7 @@ namespace OpenSim.Data.MySQL
840 return nWP; 862 return nWP;
841 } 863 }
842 864
843 public RegionSettings LoadRegionSettings(UUID regionUUID) 865 public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
844 { 866 {
845 RegionSettings rs = null; 867 RegionSettings rs = null;
846 868
@@ -880,7 +902,7 @@ namespace OpenSim.Data.MySQL
880 return rs; 902 return rs;
881 } 903 }
882 904
883 public void StoreRegionWindlightSettings(RegionLightShareData wl) 905 public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
884 { 906 {
885 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 907 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
886 { 908 {
@@ -983,7 +1005,7 @@ namespace OpenSim.Data.MySQL
983 } 1005 }
984 } 1006 }
985 1007
986 public void RemoveRegionWindlightSettings(UUID regionID) 1008 public virtual void RemoveRegionWindlightSettings(UUID regionID)
987 { 1009 {
988 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1010 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
989 { 1011 {
@@ -1060,7 +1082,7 @@ namespace OpenSim.Data.MySQL
1060 } 1082 }
1061 #endregion 1083 #endregion
1062 1084
1063 public void StoreRegionSettings(RegionSettings rs) 1085 public virtual void StoreRegionSettings(RegionSettings rs)
1064 { 1086 {
1065 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1087 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1066 { 1088 {
@@ -1069,52 +1091,51 @@ namespace OpenSim.Data.MySQL
1069 using (MySqlCommand cmd = dbcon.CreateCommand()) 1091 using (MySqlCommand cmd = dbcon.CreateCommand())
1070 { 1092 {
1071 cmd.CommandText = "replace into regionsettings (regionUUID, " + 1093 cmd.CommandText = "replace into regionsettings (regionUUID, " +
1072 "block_terraform, block_fly, allow_damage, " + 1094 "block_terraform, block_fly, allow_damage, " +
1073 "restrict_pushing, allow_land_resell, " + 1095 "restrict_pushing, allow_land_resell, " +
1074 "allow_land_join_divide, block_show_in_search, " + 1096 "allow_land_join_divide, block_show_in_search, " +
1075 "agent_limit, object_bonus, maturity, " + 1097 "agent_limit, object_bonus, maturity, " +
1076 "disable_scripts, disable_collisions, " + 1098 "disable_scripts, disable_collisions, " +
1077 "disable_physics, terrain_texture_1, " + 1099 "disable_physics, terrain_texture_1, " +
1078 "terrain_texture_2, terrain_texture_3, " + 1100 "terrain_texture_2, terrain_texture_3, " +
1079 "terrain_texture_4, elevation_1_nw, " + 1101 "terrain_texture_4, elevation_1_nw, " +
1080 "elevation_2_nw, elevation_1_ne, " + 1102 "elevation_2_nw, elevation_1_ne, " +
1081 "elevation_2_ne, elevation_1_se, " + 1103 "elevation_2_ne, elevation_1_se, " +
1082 "elevation_2_se, elevation_1_sw, " + 1104 "elevation_2_se, elevation_1_sw, " +
1083 "elevation_2_sw, water_height, " + 1105 "elevation_2_sw, water_height, " +
1084 "terrain_raise_limit, terrain_lower_limit, " + 1106 "terrain_raise_limit, terrain_lower_limit, " +
1085 "use_estate_sun, fixed_sun, sun_position, " + 1107 "use_estate_sun, fixed_sun, sun_position, " +
1086 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + 1108 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1087 "sunvectorz, loaded_creation_datetime, " + 1109 "sunvectorz, loaded_creation_datetime, " +
1088 "loaded_creation_id, map_tile_ID, " + 1110 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1089 "TelehubObject, parcel_tile_ID) " + 1111 "TelehubObject, parcel_tile_ID) " +
1090 "values (?RegionUUID, ?BlockTerraform, " + 1112 "values (?RegionUUID, ?BlockTerraform, " +
1091 "?BlockFly, ?AllowDamage, ?RestrictPushing, " + 1113 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
1092 "?AllowLandResell, ?AllowLandJoinDivide, " + 1114 "?AllowLandResell, ?AllowLandJoinDivide, " +
1093 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + 1115 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
1094 "?Maturity, ?DisableScripts, ?DisableCollisions, " + 1116 "?Maturity, ?DisableScripts, ?DisableCollisions, " +
1095 "?DisablePhysics, ?TerrainTexture1, " + 1117 "?DisablePhysics, ?TerrainTexture1, " +
1096 "?TerrainTexture2, ?TerrainTexture3, " + 1118 "?TerrainTexture2, ?TerrainTexture3, " +
1097 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + 1119 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
1098 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + 1120 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
1099 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + 1121 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
1100 "?WaterHeight, ?TerrainRaiseLimit, " + 1122 "?WaterHeight, ?TerrainRaiseLimit, " +
1101 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + 1123 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
1102 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + 1124 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1103 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1125 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1104 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1126 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1105 "?TerrainImageID, " + 1127 "?TerrainImageID, ?block_search, ?casino, " +
1106 "?TelehubObject, ?ParcelImageID)"; 1128 "?TelehubObject, ?ParcelImageID)";
1107 1129
1108 FillRegionSettingsCommand(cmd, rs); 1130 FillRegionSettingsCommand(cmd, rs);
1109
1110 ExecuteNonQuery(cmd); 1131 ExecuteNonQuery(cmd);
1111 } 1132 }
1112 }
1113 1133
1114 SaveSpawnPoints(rs); 1134 SaveSpawnPoints(rs);
1135 }
1115 } 1136 }
1116 1137
1117 public List<LandData> LoadLandObjects(UUID regionUUID) 1138 public virtual List<LandData> LoadLandObjects(UUID regionUUID)
1118 { 1139 {
1119 List<LandData> landData = new List<LandData>(); 1140 List<LandData> landData = new List<LandData>();
1120 1141
@@ -1296,6 +1317,7 @@ namespace OpenSim.Data.MySQL
1296 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; 1317 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
1297 1318
1298 prim.PassTouches = ((sbyte)row["PassTouches"] != 0); 1319 prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
1320 prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
1299 prim.LinkNum = (int)row["LinkNumber"]; 1321 prim.LinkNum = (int)row["LinkNumber"];
1300 1322
1301 if (!(row["MediaURL"] is System.DBNull)) 1323 if (!(row["MediaURL"] is System.DBNull))
@@ -1333,7 +1355,17 @@ namespace OpenSim.Data.MySQL
1333 prim.GravityModifier = (float)(double)row["GravityModifier"]; 1355 prim.GravityModifier = (float)(double)row["GravityModifier"];
1334 prim.Friction = (float)(double)row["Friction"]; 1356 prim.Friction = (float)(double)row["Friction"];
1335 prim.Restitution = (float)(double)row["Restitution"]; 1357 prim.Restitution = (float)(double)row["Restitution"];
1336 1358 prim.RotationAxisLocks = (byte)Convert.ToInt32(row["RotationAxisLocks"].ToString());
1359
1360 SOPVehicle vehicle = null;
1361
1362 if (row["Vehicle"].ToString() != String.Empty)
1363 {
1364 vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
1365 if (vehicle != null)
1366 prim.VehicleParams = vehicle;
1367 }
1368
1337 return prim; 1369 return prim;
1338 } 1370 }
1339 1371
@@ -1344,32 +1376,40 @@ namespace OpenSim.Data.MySQL
1344 /// <returns></returns> 1376 /// <returns></returns>
1345 private static TaskInventoryItem BuildItem(IDataReader row) 1377 private static TaskInventoryItem BuildItem(IDataReader row)
1346 { 1378 {
1347 TaskInventoryItem taskItem = new TaskInventoryItem(); 1379 try
1348 1380 {
1349 taskItem.ItemID = DBGuid.FromDB(row["itemID"]); 1381 TaskInventoryItem taskItem = new TaskInventoryItem();
1350 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); 1382
1351 taskItem.AssetID = DBGuid.FromDB(row["assetID"]); 1383 taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
1352 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); 1384 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
1353 1385 taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
1354 taskItem.InvType = Convert.ToInt32(row["invType"]); 1386 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
1355 taskItem.Type = Convert.ToInt32(row["assetType"]); 1387
1356 1388 taskItem.InvType = Convert.ToInt32(row["invType"]);
1357 taskItem.Name = (String)row["name"]; 1389 taskItem.Type = Convert.ToInt32(row["assetType"]);
1358 taskItem.Description = (String)row["description"]; 1390
1359 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); 1391 taskItem.Name = (String)row["name"];
1360 taskItem.CreatorIdentification = (String)row["creatorID"]; 1392 taskItem.Description = (String)row["description"];
1361 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); 1393 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
1362 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); 1394 taskItem.CreatorIdentification = (String)row["creatorID"];
1363 taskItem.GroupID = DBGuid.FromDB(row["groupID"]); 1395 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
1364 1396 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
1365 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); 1397 taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
1366 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); 1398
1367 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); 1399 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
1368 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); 1400 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
1369 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); 1401 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
1370 taskItem.Flags = Convert.ToUInt32(row["flags"]); 1402 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
1371 1403 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
1372 return taskItem; 1404 taskItem.Flags = Convert.ToUInt32(row["flags"]);
1405
1406 return taskItem;
1407 }
1408 catch
1409 {
1410 m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString());
1411 throw;
1412 }
1373 } 1413 }
1374 1414
1375 private static RegionSettings BuildRegionSettings(IDataReader row) 1415 private static RegionSettings BuildRegionSettings(IDataReader row)
@@ -1427,6 +1467,9 @@ namespace OpenSim.Data.MySQL
1427 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); 1467 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
1428 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); 1468 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
1429 1469
1470 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
1471 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1472
1430 return newSettings; 1473 return newSettings;
1431 } 1474 }
1432 1475
@@ -1503,6 +1546,13 @@ namespace OpenSim.Data.MySQL
1503 1546
1504 newData.ParcelAccessList = new List<LandAccessEntry>(); 1547 newData.ParcelAccessList = new List<LandAccessEntry>();
1505 1548
1549 if (!(row["SeeAVs"] is System.DBNull))
1550 newData.SeeAVs = Convert.ToInt32(row["SeeAVs"]) != 0 ? true : false;
1551 if (!(row["AnyAVSounds"] is System.DBNull))
1552 newData.AnyAVSounds = Convert.ToInt32(row["AnyAVSounds"]) != 0 ? true : false;
1553 if (!(row["GroupAVSounds"] is System.DBNull))
1554 newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false;
1555
1506 return newData; 1556 return newData;
1507 } 1557 }
1508 1558
@@ -1654,6 +1704,11 @@ namespace OpenSim.Data.MySQL
1654 else 1704 else
1655 cmd.Parameters.AddWithValue("PassTouches", 0); 1705 cmd.Parameters.AddWithValue("PassTouches", 0);
1656 1706
1707 if (prim.PassCollisions)
1708 cmd.Parameters.AddWithValue("PassCollisions", 1);
1709 else
1710 cmd.Parameters.AddWithValue("PassCollisions", 0);
1711
1657 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1712 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1658 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1713 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1659 if (prim.AttachedPos != null) 1714 if (prim.AttachedPos != null)
@@ -1668,6 +1723,11 @@ namespace OpenSim.Data.MySQL
1668 else 1723 else
1669 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); 1724 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1670 1725
1726 if (prim.VehicleParams != null)
1727 cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
1728 else
1729 cmd.Parameters.AddWithValue("Vehicle", String.Empty);
1730
1671 if (prim.DynAttrs.CountNamespaces > 0) 1731 if (prim.DynAttrs.CountNamespaces > 0)
1672 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); 1732 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1673 else 1733 else
@@ -1678,6 +1738,7 @@ namespace OpenSim.Data.MySQL
1678 cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); 1738 cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
1679 cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); 1739 cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
1680 cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); 1740 cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution);
1741 cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks);
1681 } 1742 }
1682 1743
1683 /// <summary> 1744 /// <summary>
@@ -1756,6 +1817,8 @@ namespace OpenSim.Data.MySQL
1756 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1817 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1757 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1818 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1758 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1819 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1820 cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
1821 cmd.Parameters.AddWithValue("casino", settings.Casino);
1759 1822
1760 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1823 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1761 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1824 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
@@ -1813,6 +1876,10 @@ namespace OpenSim.Data.MySQL
1813 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); 1876 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
1814 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); 1877 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
1815 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); 1878 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
1879 cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0);
1880 cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0);
1881 cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0);
1882
1816 } 1883 }
1817 1884
1818 /// <summary> 1885 /// <summary>
@@ -1919,7 +1986,7 @@ namespace OpenSim.Data.MySQL
1919 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); 1986 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
1920 } 1987 }
1921 1988
1922 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1989 public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1923 { 1990 {
1924 lock (m_dbLock) 1991 lock (m_dbLock)
1925 { 1992 {
@@ -1963,6 +2030,37 @@ namespace OpenSim.Data.MySQL
1963 } 2030 }
1964 } 2031 }
1965 2032
2033 public UUID[] GetObjectIDs(UUID regionID)
2034 {
2035 List<UUID> uuids = new List<UUID>();
2036
2037 lock (m_dbLock)
2038 {
2039 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2040 {
2041 dbcon.Open();
2042
2043 using (MySqlCommand cmd = dbcon.CreateCommand())
2044 {
2045 cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID";
2046 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
2047
2048 using (IDataReader reader = ExecuteReader(cmd))
2049 {
2050 while (reader.Read())
2051 {
2052 UUID id = new UUID(reader["UUID"].ToString());
2053
2054 uuids.Add(id);
2055 }
2056 }
2057 }
2058 }
2059 }
2060
2061 return uuids.ToArray();
2062 }
2063
1966 private void LoadSpawnPoints(RegionSettings rs) 2064 private void LoadSpawnPoints(RegionSettings rs)
1967 { 2065 {
1968 rs.ClearSpawnPoints(); 2066 rs.ClearSpawnPoints();
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index e964295..59cfe70 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL
46 { 46 {
47 string[] words = query.Split(new char[] {' '}); 47 string[] words = query.Split(new char[] {' '});
48 48
49 bool valid = false;
50
49 for (int i = 0 ; i < words.Length ; i++) 51 for (int i = 0 ; i < words.Length ; i++)
50 { 52 {
51 if (words[i].Length < 3) 53 if (words[i].Length > 2)
52 { 54 valid = true;
53 if (i != words.Length - 1) 55// if (words[i].Length < 3)
54 Array.Copy(words, i + 1, words, i, words.Length - i - 1); 56// {
55 Array.Resize(ref words, words.Length - 1); 57// if (i != words.Length - 1)
56 } 58// Array.Copy(words, i + 1, words, i, words.Length - i - 1);
59// Array.Resize(ref words, words.Length - 1);
60// }
57 } 61 }
58 62
59 if (words.Length == 0) 63 if ((!valid) || words.Length == 0)
60 return new UserAccountData[0]; 64 return new UserAccountData[0];
61 65
62 if (words.Length > 2) 66 if (words.Length > 2)
@@ -66,13 +70,13 @@ namespace OpenSim.Data.MySQL
66 { 70 {
67 if (words.Length == 1) 71 if (words.Length == 1)
68 { 72 {
69 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm); 73 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm);
70 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); 74 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
71 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 75 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
72 } 76 }
73 else 77 else
74 { 78 {
75 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm); 79 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm);
76 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); 80 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
77 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); 81 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 82 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
@@ -81,5 +85,21 @@ namespace OpenSim.Data.MySQL
81 return DoQuery(cmd); 85 return DoQuery(cmd);
82 } 86 }
83 } 87 }
88
89 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
90 {
91 using (MySqlCommand cmd = new MySqlCommand())
92 {
93 if (scopeID != UUID.Zero)
94 {
95 where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")";
96 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
97 }
98
99 cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm);
100
101 return DoQuery(cmd);
102 }
103 }
84 } 104 }
85} \ No newline at end of file 105}
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index b35595d..295e131 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -631,6 +631,8 @@ namespace OpenSim.Data.MySQL
631 { 631 {
632 if(reader.HasRows) 632 if(reader.HasRows)
633 { 633 {
634 m_log.DebugFormat("[PROFILES_DATA]" +
635 ": Getting data for {0}.", props.UserId);
634 reader.Read(); 636 reader.Read();
635 props.WebUrl = (string)reader["profileURL"]; 637 props.WebUrl = (string)reader["profileURL"];
636 UUID.TryParse((string)reader["profileImage"], out props.ImageId); 638 UUID.TryParse((string)reader["profileImage"], out props.ImageId);
@@ -646,6 +648,9 @@ namespace OpenSim.Data.MySQL
646 } 648 }
647 else 649 else
648 { 650 {
651 m_log.DebugFormat("[PROFILES_DATA]" +
652 ": No data for {0}", props.UserId);
653
649 props.WebUrl = string.Empty; 654 props.WebUrl = string.Empty;
650 props.ImageId = UUID.Zero; 655 props.ImageId = UUID.Zero;
651 props.AboutText = string.Empty; 656 props.AboutText = string.Empty;
@@ -894,13 +899,13 @@ namespace OpenSim.Data.MySQL
894 public bool GetUserPreferences(ref UserPreferences pref, ref string result) 899 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
895 { 900 {
896 string query = string.Empty; 901 string query = string.Empty;
897 902
898 query += "SELECT imviaemail,visible,email FROM "; 903 query += "SELECT imviaemail,visible,email FROM ";
899 query += "usersettings WHERE "; 904 query += "usersettings WHERE ";
900 query += "useruuid = ?Id"; 905 query += "useruuid = ?Id";
901 906
902 OSDArray data = new OSDArray(); 907 OSDArray data = new OSDArray();
903 908
904 try 909 try
905 { 910 {
906 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) 911 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -909,10 +914,9 @@ namespace OpenSim.Data.MySQL
909 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 914 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
910 { 915 {
911 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); 916 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
912
913 using (MySqlDataReader reader = cmd.ExecuteReader()) 917 using (MySqlDataReader reader = cmd.ExecuteReader())
914 { 918 {
915 if(reader.HasRows) 919 if (reader.HasRows)
916 { 920 {
917 reader.Read(); 921 reader.Read();
918 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); 922 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
@@ -923,13 +927,13 @@ namespace OpenSim.Data.MySQL
923 { 927 {
924 dbcon.Close(); 928 dbcon.Close();
925 dbcon.Open(); 929 dbcon.Open();
926 930
927 query = "INSERT INTO usersettings VALUES "; 931 query = "INSERT INTO usersettings VALUES ";
928 query += "(?uuid,'false','false', ?Email)"; 932 query += "(?uuid,'false','false', ?Email)";
929 933
930 using (MySqlCommand put = new MySqlCommand(query, dbcon)) 934 using (MySqlCommand put = new MySqlCommand(query, dbcon))
931 { 935 {
932 936
933 put.Parameters.AddWithValue("?Email", pref.EMail); 937 put.Parameters.AddWithValue("?Email", pref.EMail);
934 put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); 938 put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
935 939
@@ -949,9 +953,9 @@ namespace OpenSim.Data.MySQL
949 } 953 }
950 return true; 954 return true;
951 } 955 }
952 956
953 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) 957 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
954 { 958 {
955 string query = string.Empty; 959 string query = string.Empty;
956 960
957 query += "UPDATE usersettings SET "; 961 query += "UPDATE usersettings SET ";
@@ -959,7 +963,7 @@ namespace OpenSim.Data.MySQL
959 query += "visible=?Visible, "; 963 query += "visible=?Visible, ";
960 query += "email=?EMail "; 964 query += "email=?EMail ";
961 query += "WHERE useruuid=?uuid"; 965 query += "WHERE useruuid=?uuid";
962 966
963 try 967 try
964 { 968 {
965 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) 969 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
index af7e876..68e1a5a 100644
--- a/OpenSim/Data/MySQL/MySQLXAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -500,4 +500,4 @@ namespace OpenSim.Data.MySQL
500 500
501 #endregion 501 #endregion
502 } 502 }
503} \ No newline at end of file 503}
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index ac31380..a3d4b5d 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -717,7 +717,7 @@ ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT
717 717
718COMMIT; 718COMMIT;
719 719
720:VERSION 32 720:VERSION 32 #---------------------
721 721
722BEGIN; 722BEGIN;
723CREATE TABLE `regionwindlight` ( 723CREATE TABLE `regionwindlight` (
@@ -948,3 +948,25 @@ ALTER TABLE land CHANGE COLUMN LandFlags LandFlags int unsigned default null;
948 948
949COMMIT; 949COMMIT;
950 950
951:VERSION 51 #---- avination fields
952
953BEGIN;
954
955ALTER TABLE `prims` ADD COLUMN `PassCollisions` tinyint(4) NOT NULL default '0';
956ALTER TABLE `prims` ADD COLUMN `Vehicle` TEXT default NULL;
957ALTER TABLE `regionsettings` ADD COLUMN `block_search` tinyint(4) NOT NULL default '0';
958ALTER TABLE `regionsettings` ADD COLUMN `casino` tinyint(4) NOT NULL default '0';
959ALTER TABLE `land` ADD COLUMN `SeeAVs` tinyint(4) NOT NULL default '1';
960ALTER TABLE `land` ADD COLUMN `AnyAVSounds` tinyint(4) NOT NULL default '1';
961ALTER TABLE `land` ADD COLUMN `GroupAVSounds` tinyint(4) NOT NULL default '1';
962
963COMMIT;
964
965:VERSION 52 #---- STATUS ROTATION axis locks
966
967BEGIN;
968
969ALTER TABLE `prims` ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0';
970
971COMMIT;
972
diff --git a/OpenSim/Data/MySQL/Resources/UserAccount.migrations b/OpenSim/Data/MySQL/Resources/UserAccount.migrations
index 84011e6..71f1cc4 100644
--- a/OpenSim/Data/MySQL/Resources/UserAccount.migrations
+++ b/OpenSim/Data/MySQL/Resources/UserAccount.migrations
@@ -44,4 +44,11 @@ ALTER TABLE UserAccounts ADD COLUMN UserTitle varchar(64) NOT NULL DEFAULT '';
44 44
45COMMIT; 45COMMIT;
46 46
47:VERSION 5 # -------------------------
48
49BEGIN;
50
51ALTER TABLE `UserAccounts` ADD `active` INT NOT NULL DEFAULT '1';
52
53COMMIT;
47 54
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index d28cd99..595db2f 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -134,21 +134,22 @@ namespace OpenSim.Data.Null
134 if (m_useStaticInstance && Instance != this) 134 if (m_useStaticInstance && Instance != this)
135 return Instance.Get(posX, posY, scopeID); 135 return Instance.Get(posX, posY, scopeID);
136 136
137 List<RegionData> ret = new List<RegionData>(); 137 RegionData ret = null;
138 138
139 lock (m_regionData) 139 lock (m_regionData)
140 { 140 {
141 foreach (RegionData r in m_regionData.Values) 141 foreach (RegionData r in m_regionData.Values)
142 { 142 {
143 if (r.posX == posX && r.posY == posY) 143 if (posX >= r.posX && posX < r.posX + r.sizeX
144 ret.Add(r); 144 && posY >= r.posY && posY < r.posY + r.sizeY)
145 {
146 ret = r;
147 break;
148 }
145 } 149 }
146 } 150 }
147 151
148 if (ret.Count > 0) 152 return ret;
149 return ret[0];
150
151 return null;
152 } 153 }
153 154
154 public RegionData Get(UUID regionID, UUID scopeID) 155 public RegionData Get(UUID regionID, UUID scopeID)
@@ -176,8 +177,9 @@ namespace OpenSim.Data.Null
176 { 177 {
177 foreach (RegionData r in m_regionData.Values) 178 foreach (RegionData r in m_regionData.Values)
178 { 179 {
179 if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY) 180 if (r.posX + r.sizeX > startX && r.posX <= endX
180 ret.Add(r); 181 && r.posY + r.sizeX > startY && r.posY <= endY)
182 ret.Add(r);
181 } 183 }
182 } 184 }
183 185
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
index deeaced..339e7f4 100644
--- a/OpenSim/Data/Null/NullSimulationData.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -184,6 +184,11 @@ namespace OpenSim.Data.Null
184 { 184 {
185 } 185 }
186 186
187 public UUID[] GetObjectIDs(UUID regionID)
188 {
189 return new UUID[0];
190 }
191
187 public void SaveExtra(UUID regionID, string name, string value) 192 public void SaveExtra(UUID regionID, string name, string value)
188 { 193 {
189 } 194 }
diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs
index ec54dba..241616b 100644
--- a/OpenSim/Data/Null/NullUserAccountData.cs
+++ b/OpenSim/Data/Null/NullUserAccountData.cs
@@ -193,5 +193,10 @@ namespace OpenSim.Data.Null
193 193
194 return false; 194 return false;
195 } 195 }
196
197 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
198 {
199 return null;
200 }
196 } 201 }
197} 202}
diff --git a/OpenSim/Data/PGSQL/PGSQLAssetData.cs b/OpenSim/Data/PGSQL/PGSQLAssetData.cs
index 5d8b0a2..81adb03 100644
--- a/OpenSim/Data/PGSQL/PGSQLAssetData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLAssetData.cs
@@ -149,7 +149,7 @@ namespace OpenSim.Data.PGSQL
149 /// Create asset in m_database 149 /// Create asset in m_database
150 /// </summary> 150 /// </summary>
151 /// <param name="asset">the asset</param> 151 /// <param name="asset">the asset</param>
152 override public void StoreAsset(AssetBase asset) 152 override public bool StoreAsset(AssetBase asset)
153 { 153 {
154 154
155 string sql = 155 string sql =
@@ -208,6 +208,7 @@ namespace OpenSim.Data.PGSQL
208 m_log.Error("[ASSET DB]: Error storing item :" + e.Message + " sql "+sql); 208 m_log.Error("[ASSET DB]: Error storing item :" + e.Message + " sql "+sql);
209 } 209 }
210 } 210 }
211 return true;
211 } 212 }
212 213
213 214
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
index 77d87d4..a006c58 100644
--- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
@@ -2227,6 +2227,11 @@ namespace OpenSim.Data.PGSQL
2227 } 2227 }
2228 } 2228 }
2229 2229
2230 public UUID[] GetObjectIDs(UUID regionID)
2231 {
2232 return new UUID[0];
2233 }
2234
2230 public void SaveExtra(UUID regionID, string name, string value) 2235 public void SaveExtra(UUID regionID, string name, string value)
2231 { 2236 {
2232 } 2237 }
diff --git a/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs b/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs
index 0a68b23..a2b5a2a 100644
--- a/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs
@@ -325,5 +325,10 @@ namespace OpenSim.Data.PGSQL
325 return DoQuery(cmd); 325 return DoQuery(cmd);
326 } 326 }
327 } 327 }
328
329 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
330 {
331 return null;
332 }
328 } 333 }
329} 334}
diff --git a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
index a6bd8ca..c1580b2 100644
--- a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
@@ -152,4 +152,4 @@ BEGIN;
152 152
153ALTER TABLE usersettings ALTER COLUMN imviaemail SET DATA TYPE boolean USING CASE WHEN false THEN false ELSE true END; 153ALTER TABLE usersettings ALTER COLUMN imviaemail SET DATA TYPE boolean USING CASE WHEN false THEN false ELSE true END;
154 154
155COMMIT; \ No newline at end of file 155COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index 901068f..f66be34 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -612,3 +612,25 @@ ALTER TABLE primshapes ADD COLUMN LastAttachPoint int not null default '0';
612 612
613COMMIT; 613COMMIT;
614 614
615:VERSION 31 #---- avination fields plus a few others
616
617BEGIN;
618
619ALTER TABLE `prims` ADD COLUMN `PassTouches` BOOLEAN NOT NULL DEFAULT FALSE;
620ALTER TABLE `prims` ADD COLUMN `PassCollisions`BOOLEAN NOT NULL DEFAULT FALSE;
621ALTER TABLE `prims` ADD COLUMN `Vehicle` TEXT default NULL;
622ALTER TABLE `regionsettings` ADD COLUMN `block_search` BOOLEAN NOT NULL DEFAULT FALSE;;
623ALTER TABLE `regionsettings` ADD COLUMN `casino` BOOLEAN NOT NULL DEFAULT FALSE;;
624ALTER TABLE `land` ADD COLUMN `SeeAVs` BOOLEAN NOT NULL DEFAULT TRUE;
625ALTER TABLE `land` ADD COLUMN `AnyAVSounds` BOOLEAN NOT NULL DEFAULT TRUE;
626ALTER TABLE `land` ADD COLUMN `GroupAVSounds` BOOLEAN NOT NULL DEFAULT TRUE;
627
628COMMIT;
629
630:VERSION 32 #---- Rotation axis locks
631
632BEGIN;
633
634ALTER TABLE prims ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0';
635
636COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/UserAccount.migrations b/OpenSim/Data/SQLite/Resources/UserAccount.migrations
index 854fe69..f37a222 100644
--- a/OpenSim/Data/SQLite/Resources/UserAccount.migrations
+++ b/OpenSim/Data/SQLite/Resources/UserAccount.migrations
@@ -25,3 +25,11 @@ BEGIN TRANSACTION;
25INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users; 25INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users;
26 26
27COMMIT; 27COMMIT;
28
29:VERSION 3 # -------------------------
30
31BEGIN;
32
33ALTER TABLE `UserAccounts` ADD `active` BOOLEAN NOT NULL DEFAULT TRUE;
34
35COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
index 86434e8..207dde0 100644
--- a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
@@ -99,4 +99,4 @@ CREATE TABLE IF NOT EXISTS usersettings (
99 email varchar(254) NOT NULL, 99 email varchar(254) NOT NULL,
100 PRIMARY KEY (useruuid) 100 PRIMARY KEY (useruuid)
101) 101)
102commit; \ No newline at end of file 102commit;
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index f0dda64..9c2bd2e 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Data.SQLite
131 /// Create an asset 131 /// Create an asset
132 /// </summary> 132 /// </summary>
133 /// <param name="asset">Asset Base</param> 133 /// <param name="asset">Asset Base</param>
134 override public void StoreAsset(AssetBase asset) 134 override public bool StoreAsset(AssetBase asset)
135 { 135 {
136 string assetName = asset.Name; 136 string assetName = asset.Name;
137 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) 137 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
@@ -171,6 +171,7 @@ namespace OpenSim.Data.SQLite
171 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 171 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
172 172
173 cmd.ExecuteNonQuery(); 173 cmd.ExecuteNonQuery();
174 return true;
174 } 175 }
175 } 176 }
176 } 177 }
@@ -191,6 +192,7 @@ namespace OpenSim.Data.SQLite
191 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 192 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
192 193
193 cmd.ExecuteNonQuery(); 194 cmd.ExecuteNonQuery();
195 return true;
194 } 196 }
195 } 197 }
196 } 198 }
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 6ed3d40..d7b3bbe 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -1246,6 +1246,7 @@ namespace OpenSim.Data.SQLite
1246 createCol(prims, "Restitution", typeof(Double)); 1246 createCol(prims, "Restitution", typeof(Double));
1247 1247
1248 createCol(prims, "KeyframeMotion", typeof(Byte[])); 1248 createCol(prims, "KeyframeMotion", typeof(Byte[]));
1249
1249 // Add in contraints 1250 // Add in contraints
1250 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 1251 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
1251 1252
@@ -1760,7 +1761,18 @@ namespace OpenSim.Data.SQLite
1760 { 1761 {
1761 prim.KeyframeMotion = null; 1762 prim.KeyframeMotion = null;
1762 } 1763 }
1763 1764
1765 prim.PassCollisions = Convert.ToBoolean(row["PassCollisions"]);
1766 prim.PassTouches = Convert.ToBoolean(row["PassTouches"]);
1767 prim.RotationAxisLocks = Convert.ToByte(row["RotationAxisLocks"]);
1768
1769 SOPVehicle vehicle = null;
1770 if (!(row["Vehicle"] is DBNull) && row["Vehicle"].ToString() != String.Empty)
1771 {
1772 vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
1773 if (vehicle != null)
1774 prim.VehicleParams = vehicle;
1775 }
1764 return prim; 1776 return prim;
1765 } 1777 }
1766 1778
@@ -1845,6 +1857,10 @@ namespace OpenSim.Data.SQLite
1845 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); 1857 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
1846 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); 1858 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
1847 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); 1859 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
1860 newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]);
1861 newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
1862 newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
1863
1848 try 1864 try
1849 { 1865 {
1850 newData.UserLocation = 1866 newData.UserLocation =
@@ -1918,7 +1934,8 @@ namespace OpenSim.Data.SQLite
1918 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); 1934 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
1919 newSettings.TelehubObject = new UUID((String)row["TelehubObject"]); 1935 newSettings.TelehubObject = new UUID((String)row["TelehubObject"]);
1920 newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]); 1936 newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]);
1921 1937 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
1938 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1922 return newSettings; 1939 return newSettings;
1923 } 1940 }
1924 1941
@@ -2013,6 +2030,7 @@ namespace OpenSim.Data.SQLite
2013 return entry; 2030 return entry;
2014 } 2031 }
2015 2032
2033
2016 /// <summary> 2034 /// <summary>
2017 /// 2035 ///
2018 /// </summary> 2036 /// </summary>
@@ -2137,7 +2155,6 @@ namespace OpenSim.Data.SQLite
2137 // click action 2155 // click action
2138 row["ClickAction"] = prim.ClickAction; 2156 row["ClickAction"] = prim.ClickAction;
2139 2157
2140 row["SalePrice"] = prim.SalePrice;
2141 row["Material"] = prim.Material; 2158 row["Material"] = prim.Material;
2142 2159
2143 row["CollisionSound"] = prim.CollisionSound.ToString(); 2160 row["CollisionSound"] = prim.CollisionSound.ToString();
@@ -2168,8 +2185,16 @@ namespace OpenSim.Data.SQLite
2168 row["KeyframeMotion"] = prim.KeyframeMotion.Serialize(); 2185 row["KeyframeMotion"] = prim.KeyframeMotion.Serialize();
2169 else 2186 else
2170 row["KeyframeMotion"] = new Byte[0]; 2187 row["KeyframeMotion"] = new Byte[0];
2171 2188
2172 2189 row["PassTouches"] = prim.PassTouches;
2190 row["PassCollisions"] = prim.PassCollisions;
2191 row["RotationAxisLocks"] = prim.RotationAxisLocks;
2192
2193 if (prim.VehicleParams != null)
2194 row["Vehicle"] = prim.VehicleParams.ToXml2();
2195 else
2196 row["Vehicle"] = String.Empty;
2197
2173 } 2198 }
2174 2199
2175 /// <summary> 2200 /// <summary>
@@ -2253,6 +2278,10 @@ namespace OpenSim.Data.SQLite
2253 row["MediaLoop"] = land.MediaLoop; 2278 row["MediaLoop"] = land.MediaLoop;
2254 row["ObscureMusic"] = land.ObscureMusic; 2279 row["ObscureMusic"] = land.ObscureMusic;
2255 row["ObscureMedia"] = land.ObscureMedia; 2280 row["ObscureMedia"] = land.ObscureMedia;
2281 row["SeeAVs"] = land.SeeAVs;
2282 row["AnyAVSounds"] = land.AnyAVSounds;
2283 row["GroupAVSounds"] = land.GroupAVSounds;
2284
2256 } 2285 }
2257 2286
2258 /// <summary> 2287 /// <summary>
@@ -2311,6 +2340,8 @@ namespace OpenSim.Data.SQLite
2311 row["map_tile_ID"] = settings.TerrainImageID.ToString(); 2340 row["map_tile_ID"] = settings.TerrainImageID.ToString();
2312 row["TelehubObject"] = settings.TelehubObject.ToString(); 2341 row["TelehubObject"] = settings.TelehubObject.ToString();
2313 row["parcel_tile_ID"] = settings.ParcelImageID.ToString(); 2342 row["parcel_tile_ID"] = settings.ParcelImageID.ToString();
2343 row["block_search"] = settings.GodBlockSearch;
2344 row["casino"] = settings.Casino;
2314 } 2345 }
2315 2346
2316 /// <summary> 2347 /// <summary>
@@ -2944,6 +2975,11 @@ namespace OpenSim.Data.SQLite
2944 } 2975 }
2945 } 2976 }
2946 2977
2978 public UUID[] GetObjectIDs(UUID regionID)
2979 {
2980 return new UUID[0];
2981 }
2982
2947 public void SaveExtra(UUID regionID, string name, string value) 2983 public void SaveExtra(UUID regionID, string name, string value)
2948 { 2984 {
2949 } 2985 }
diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
index f98d376..91d62ce 100644
--- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
@@ -82,5 +82,10 @@ namespace OpenSim.Data.SQLite
82 return DoQuery(cmd); 82 return DoQuery(cmd);
83 } 83 }
84 } 84 }
85
86 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
87 {
88 return null;
89 }
85 } 90 }
86} 91}
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
index cd3e8b6..2dfdba3 100644
--- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
@@ -741,6 +741,7 @@ namespace OpenSim.Data.SQLite
741 return true; 741 return true;
742 } 742 }
743 743
744
744 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) 745 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
745 { 746 {
746 string query = string.Empty; 747 string query = string.Empty;