diff options
Diffstat (limited to '')
23 files changed, 294 insertions, 103 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index e1a810c..b4ae913 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Data | |||
38 | { | 38 | { |
39 | public abstract AssetBase GetAsset(UUID uuid); | 39 | public abstract AssetBase GetAsset(UUID uuid); |
40 | 40 | ||
41 | public abstract void StoreAsset(AssetBase asset); | 41 | public abstract bool StoreAsset(AssetBase asset); |
42 | public abstract bool ExistsAsset(UUID uuid); | 42 | public abstract bool ExistsAsset(UUID uuid); |
43 | 43 | ||
44 | public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); | 44 | public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); |
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs index f31b215c..0c8eadd 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 ExistsAsset(UUID uuid); | 38 | bool ExistsAsset(UUID uuid); |
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/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/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index c7488d8..c882555 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -143,7 +143,7 @@ namespace OpenSim.Data.MSSQL | |||
143 | /// Create asset in m_database | 143 | /// Create asset in m_database |
144 | /// </summary> | 144 | /// </summary> |
145 | /// <param name="asset">the asset</param> | 145 | /// <param name="asset">the asset</param> |
146 | override public void StoreAsset(AssetBase asset) | 146 | override public bool StoreAsset(AssetBase asset) |
147 | { | 147 | { |
148 | 148 | ||
149 | string sql = | 149 | string sql = |
@@ -192,10 +192,12 @@ namespace OpenSim.Data.MSSQL | |||
192 | try | 192 | try |
193 | { | 193 | { |
194 | command.ExecuteNonQuery(); | 194 | command.ExecuteNonQuery(); |
195 | return true; | ||
195 | } | 196 | } |
196 | catch(Exception e) | 197 | catch(Exception e) |
197 | { | 198 | { |
198 | m_log.Error("[ASSET DB]: Error storing item :" + e.Message); | 199 | m_log.Error("[ASSET DB]: Error storing item :" + e.Message); |
200 | return false; | ||
199 | } | 201 | } |
200 | } | 202 | } |
201 | } | 203 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLAvatarData.cs b/OpenSim/Data/MSSQL/MSSQLAvatarData.cs index 301b424..49a6b09 100644 --- a/OpenSim/Data/MSSQL/MSSQLAvatarData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAvatarData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL | |||
43 | public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>, | 43 | public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>, |
44 | IAvatarData | 44 | IAvatarData |
45 | { | 45 | { |
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | public MSSQLAvatarData(string connectionString, string realm) : | 48 | public MSSQLAvatarData(string connectionString, string realm) : |
49 | base(connectionString, realm, "Avatar") | 49 | base(connectionString, realm, "Avatar") |
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs index 4145d95..8f471c4 100644 --- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs +++ b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | |||
@@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL | |||
40 | { | 40 | { |
41 | public class MSSQLGenericTableHandler<T> where T : class, new() | 41 | public class MSSQLGenericTableHandler<T> where T : class, new() |
42 | { | 42 | { |
43 | // private static readonly ILog m_log = | 43 | private static readonly ILog m_log = |
44 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected string m_ConnectionString; | 46 | protected string m_ConnectionString; |
47 | protected MSSQLManager m_database; //used for parameter type translation | 47 | protected MSSQLManager m_database; //used for parameter type translation |
diff --git a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs index 9e215f9..1870273 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL | |||
43 | public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>, | 43 | public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>, |
44 | IGridUserData | 44 | IGridUserData |
45 | { | 45 | { |
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | public MSSQLGridUserData(string connectionString, string realm) : | 48 | public MSSQLGridUserData(string connectionString, string realm) : |
49 | base(connectionString, realm, "GridUserStore") | 49 | base(connectionString, realm, "GridUserStore") |
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index 9a0015c..62c38d3 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Data.MSSQL | |||
41 | /// </summary> | 41 | /// </summary> |
42 | public class MSSQLManager | 42 | public class MSSQLManager |
43 | { | 43 | { |
44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Connection string for ADO.net | 47 | /// Connection string for ADO.net |
@@ -185,6 +185,8 @@ namespace OpenSim.Data.MSSQL | |||
185 | return parameter; | 185 | return parameter; |
186 | } | 186 | } |
187 | 187 | ||
188 | private static readonly Dictionary<string, string> emptyDictionary = new Dictionary<string, string>(); | ||
189 | |||
188 | /// <summary> | 190 | /// <summary> |
189 | /// Checks if we need to do some migrations to the database | 191 | /// Checks if we need to do some migrations to the database |
190 | /// </summary> | 192 | /// </summary> |
diff --git a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs b/OpenSim/Data/MSSQL/MSSQLPresenceData.cs index 8068d23..e7b3d9c 100644 --- a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs +++ b/OpenSim/Data/MSSQL/MSSQLPresenceData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL | |||
43 | public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>, | 43 | public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>, |
44 | IPresenceData | 44 | IPresenceData |
45 | { | 45 | { |
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | public MSSQLPresenceData(string connectionString, string realm) : | 48 | public MSSQLPresenceData(string connectionString, string realm) : |
49 | base(connectionString, realm, "Presence") | 49 | base(connectionString, realm, "Presence") |
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 3f29f5b..47fb6d7 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -2202,5 +2202,10 @@ VALUES | |||
2202 | } | 2202 | } |
2203 | } | 2203 | } |
2204 | } | 2204 | } |
2205 | |||
2206 | public UUID[] GetObjectIDs(UUID regionID) | ||
2207 | { | ||
2208 | return new UUID[0]; | ||
2209 | } | ||
2205 | } | 2210 | } |
2206 | } | 2211 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs index 7feec91..dd0689c 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs | |||
@@ -242,5 +242,10 @@ namespace OpenSim.Data.MSSQL | |||
242 | return DoQuery(cmd); | 242 | return DoQuery(cmd); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | |||
246 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
247 | { | ||
248 | return null; | ||
249 | } | ||
245 | } | 250 | } |
246 | } | 251 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs index b19a0da..a1069c6 100644 --- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs | |||
@@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL | |||
40 | { | 40 | { |
41 | public class MSSQLXInventoryData : IXInventoryData | 41 | public class MSSQLXInventoryData : IXInventoryData |
42 | { | 42 | { |
43 | // private static readonly ILog m_log = LogManager.GetLogger( | 43 | private static readonly ILog m_log = LogManager.GetLogger( |
44 | // MethodBase.GetCurrentMethod().DeclaringType); | 44 | MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private MSSQLGenericTableHandler<XInventoryFolder> m_Folders; | 46 | private MSSQLGenericTableHandler<XInventoryFolder> m_Folders; |
47 | private MSSQLItemHandler m_Items; | 47 | private MSSQLItemHandler m_Items; |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 73de64b..20df234 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -155,7 +155,7 @@ namespace OpenSim.Data.MySQL | |||
155 | /// </summary> | 155 | /// </summary> |
156 | /// <param name="asset">Asset UUID to create</param> | 156 | /// <param name="asset">Asset UUID to create</param> |
157 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 157 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
158 | override public void StoreAsset(AssetBase asset) | 158 | override public bool StoreAsset(AssetBase asset) |
159 | { | 159 | { |
160 | lock (m_dbLock) | 160 | lock (m_dbLock) |
161 | { | 161 | { |
@@ -201,12 +201,14 @@ namespace OpenSim.Data.MySQL | |||
201 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 201 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); |
202 | cmd.Parameters.AddWithValue("?data", asset.Data); | 202 | cmd.Parameters.AddWithValue("?data", asset.Data); |
203 | cmd.ExecuteNonQuery(); | 203 | cmd.ExecuteNonQuery(); |
204 | return true; | ||
204 | } | 205 | } |
205 | } | 206 | } |
206 | catch (Exception e) | 207 | catch (Exception e) |
207 | { | 208 | { |
208 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", | 209 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", |
209 | asset.FullID, asset.Name, e.Message); | 210 | asset.FullID, asset.Name, e.Message); |
211 | return false; | ||
210 | } | 212 | } |
211 | } | 213 | } |
212 | } | 214 | } |
@@ -370,4 +372,4 @@ namespace OpenSim.Data.MySQL | |||
370 | 372 | ||
371 | #endregion | 373 | #endregion |
372 | } | 374 | } |
373 | } \ No newline at end of file | 375 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index da8e958..86367a1 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]); |
@@ -296,4 +301,4 @@ namespace OpenSim.Data.MySQL | |||
296 | } | 301 | } |
297 | } | 302 | } |
298 | } | 303 | } |
299 | } \ No newline at end of file | 304 | } |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 1a2e113..29bd6b6 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Data.MySQL | |||
66 | Initialise(connectionString); | 66 | Initialise(connectionString); |
67 | } | 67 | } |
68 | 68 | ||
69 | public void Initialise(string connectionString) | 69 | public virtual void Initialise(string connectionString) |
70 | { | 70 | { |
71 | m_connectionString = connectionString; | 71 | m_connectionString = connectionString; |
72 | 72 | ||
@@ -113,14 +113,16 @@ namespace OpenSim.Data.MySQL | |||
113 | 113 | ||
114 | public void Dispose() {} | 114 | public void Dispose() {} |
115 | 115 | ||
116 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 116 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
117 | { | 117 | { |
118 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 118 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
119 | 119 | ||
120 | // Eligibility check | 120 | // Eligibility check |
121 | // | 121 | // |
122 | if ((flags & (uint)PrimFlags.Temporary) != 0) | 122 | // PrimFlags.Temporary is not used in OpenSim code and cannot |
123 | return; | 123 | // be guaranteed to always be clear. Don't check it. |
124 | // if ((flags & (uint)PrimFlags.Temporary) != 0) | ||
125 | // return; | ||
124 | if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) | 126 | if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) |
125 | return; | 127 | return; |
126 | 128 | ||
@@ -135,7 +137,7 @@ namespace OpenSim.Data.MySQL | |||
135 | foreach (SceneObjectPart prim in obj.Parts) | 137 | foreach (SceneObjectPart prim in obj.Parts) |
136 | { | 138 | { |
137 | cmd.Parameters.Clear(); | 139 | cmd.Parameters.Clear(); |
138 | 140 | ||
139 | cmd.CommandText = "replace into prims (" + | 141 | cmd.CommandText = "replace into prims (" + |
140 | "UUID, CreationDate, " + | 142 | "UUID, CreationDate, " + |
141 | "Name, Text, Description, " + | 143 | "Name, Text, Description, " + |
@@ -171,7 +173,11 @@ namespace OpenSim.Data.MySQL | |||
171 | "ParticleSystem, ClickAction, Material, " + | 173 | "ParticleSystem, ClickAction, Material, " + |
172 | "CollisionSound, CollisionSoundVolume, " + | 174 | "CollisionSound, CollisionSoundVolume, " + |
173 | "PassTouches, " + | 175 | "PassTouches, " + |
174 | "LinkNumber, MediaURL) values (" + "?UUID, " + | 176 | "PassCollisions, " + |
177 | "LinkNumber, MediaURL, KeyframeMotion, " + | ||
178 | "PhysicsShapeType, Density, GravityModifier, " + | ||
179 | "Friction, Restitution, Vehicle " + | ||
180 | ") values (" + "?UUID, " + | ||
175 | "?CreationDate, ?Name, ?Text, " + | 181 | "?CreationDate, ?Name, ?Text, " + |
176 | "?Description, ?SitName, ?TouchName, " + | 182 | "?Description, ?SitName, ?TouchName, " + |
177 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + | 183 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + |
@@ -202,14 +208,17 @@ namespace OpenSim.Data.MySQL | |||
202 | "?SaleType, ?ColorR, ?ColorG, " + | 208 | "?SaleType, ?ColorR, ?ColorG, " + |
203 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 209 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
204 | "?ClickAction, ?Material, ?CollisionSound, " + | 210 | "?ClickAction, ?Material, ?CollisionSound, " + |
205 | "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; | 211 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
206 | 212 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + | |
213 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | ||
214 | "?Friction, ?Restitution, ?Vehicle)"; | ||
215 | |||
207 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 216 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
208 | 217 | ||
209 | ExecuteNonQuery(cmd); | 218 | ExecuteNonQuery(cmd); |
210 | 219 | ||
211 | cmd.Parameters.Clear(); | 220 | cmd.Parameters.Clear(); |
212 | 221 | ||
213 | cmd.CommandText = "replace into primshapes (" + | 222 | cmd.CommandText = "replace into primshapes (" + |
214 | "UUID, Shape, ScaleX, ScaleY, " + | 223 | "UUID, Shape, ScaleX, ScaleY, " + |
215 | "ScaleZ, PCode, PathBegin, PathEnd, " + | 224 | "ScaleZ, PCode, PathBegin, PathEnd, " + |
@@ -231,9 +240,9 @@ namespace OpenSim.Data.MySQL | |||
231 | "?ProfileEnd, ?ProfileCurve, " + | 240 | "?ProfileEnd, ?ProfileCurve, " + |
232 | "?ProfileHollow, ?Texture, ?ExtraParams, " + | 241 | "?ProfileHollow, ?Texture, ?ExtraParams, " + |
233 | "?State, ?Media)"; | 242 | "?State, ?Media)"; |
234 | 243 | ||
235 | FillShapeCommand(cmd, prim); | 244 | FillShapeCommand(cmd, prim); |
236 | 245 | ||
237 | ExecuteNonQuery(cmd); | 246 | ExecuteNonQuery(cmd); |
238 | } | 247 | } |
239 | } | 248 | } |
@@ -241,7 +250,7 @@ namespace OpenSim.Data.MySQL | |||
241 | } | 250 | } |
242 | } | 251 | } |
243 | 252 | ||
244 | public void RemoveObject(UUID obj, UUID regionUUID) | 253 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
245 | { | 254 | { |
246 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 255 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
247 | 256 | ||
@@ -390,7 +399,7 @@ namespace OpenSim.Data.MySQL | |||
390 | } | 399 | } |
391 | } | 400 | } |
392 | 401 | ||
393 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 402 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
394 | { | 403 | { |
395 | const int ROWS_PER_QUERY = 5000; | 404 | const int ROWS_PER_QUERY = 5000; |
396 | 405 | ||
@@ -446,7 +455,11 @@ namespace OpenSim.Data.MySQL | |||
446 | foreach (SceneObjectPart prim in prims.Values) | 455 | foreach (SceneObjectPart prim in prims.Values) |
447 | { | 456 | { |
448 | if (prim.ParentUUID == UUID.Zero) | 457 | if (prim.ParentUUID == UUID.Zero) |
458 | { | ||
449 | objects[prim.UUID] = new SceneObjectGroup(prim); | 459 | objects[prim.UUID] = new SceneObjectGroup(prim); |
460 | if (prim.KeyframeMotion != null) | ||
461 | prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]); | ||
462 | } | ||
450 | } | 463 | } |
451 | 464 | ||
452 | // Add all of the children objects to the SOGs | 465 | // Add all of the children objects to the SOGs |
@@ -559,36 +572,51 @@ namespace OpenSim.Data.MySQL | |||
559 | } | 572 | } |
560 | } | 573 | } |
561 | 574 | ||
562 | public void StoreTerrain(double[,] ter, UUID regionID) | 575 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
563 | { | 576 | { |
564 | m_log.Info("[REGION DB]: Storing terrain"); | 577 | Util.FireAndForget(delegate(object x) |
565 | |||
566 | lock (m_dbLock) | ||
567 | { | 578 | { |
568 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 579 | double[,] oldTerrain = LoadTerrain(regionID); |
569 | { | ||
570 | dbcon.Open(); | ||
571 | 580 | ||
572 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 581 | m_log.Info("[REGION DB]: Storing terrain"); |
582 | |||
583 | lock (m_dbLock) | ||
584 | { | ||
585 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
573 | { | 586 | { |
574 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 587 | dbcon.Open(); |
575 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
576 | 588 | ||
577 | ExecuteNonQuery(cmd); | 589 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
590 | { | ||
591 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | ||
592 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
578 | 593 | ||
579 | cmd.CommandText = "insert into terrain (RegionUUID, " + | 594 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
580 | "Revision, Heightfield) values (?RegionUUID, " + | 595 | { |
581 | "1, ?Heightfield)"; | 596 | try |
597 | { | ||
598 | cmd2.CommandText = "insert into terrain (RegionUUID, " + | ||
599 | "Revision, Heightfield) values (?RegionUUID, " + | ||
600 | "1, ?Heightfield)"; | ||
582 | 601 | ||
583 | cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); | 602 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
603 | cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain)); | ||
584 | 604 | ||
585 | ExecuteNonQuery(cmd); | 605 | ExecuteNonQuery(cmd); |
606 | ExecuteNonQuery(cmd2); | ||
607 | } | ||
608 | catch (Exception e) | ||
609 | { | ||
610 | m_log.ErrorFormat(e.ToString()); | ||
611 | } | ||
612 | } | ||
613 | } | ||
586 | } | 614 | } |
587 | } | 615 | } |
588 | } | 616 | }); |
589 | } | 617 | } |
590 | 618 | ||
591 | public double[,] LoadTerrain(UUID regionID) | 619 | public virtual double[,] LoadTerrain(UUID regionID) |
592 | { | 620 | { |
593 | double[,] terrain = null; | 621 | double[,] terrain = null; |
594 | 622 | ||
@@ -638,7 +666,7 @@ namespace OpenSim.Data.MySQL | |||
638 | return terrain; | 666 | return terrain; |
639 | } | 667 | } |
640 | 668 | ||
641 | public void RemoveLandObject(UUID globalID) | 669 | public virtual void RemoveLandObject(UUID globalID) |
642 | { | 670 | { |
643 | lock (m_dbLock) | 671 | lock (m_dbLock) |
644 | { | 672 | { |
@@ -657,7 +685,7 @@ namespace OpenSim.Data.MySQL | |||
657 | } | 685 | } |
658 | } | 686 | } |
659 | 687 | ||
660 | public void StoreLandObject(ILandObject parcel) | 688 | public virtual void StoreLandObject(ILandObject parcel) |
661 | { | 689 | { |
662 | lock (m_dbLock) | 690 | lock (m_dbLock) |
663 | { | 691 | { |
@@ -714,7 +742,7 @@ namespace OpenSim.Data.MySQL | |||
714 | } | 742 | } |
715 | } | 743 | } |
716 | 744 | ||
717 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 745 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
718 | { | 746 | { |
719 | RegionLightShareData nWP = new RegionLightShareData(); | 747 | RegionLightShareData nWP = new RegionLightShareData(); |
720 | nWP.OnSave += StoreRegionWindlightSettings; | 748 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -736,7 +764,7 @@ namespace OpenSim.Data.MySQL | |||
736 | { | 764 | { |
737 | //No result, so store our default windlight profile and return it | 765 | //No result, so store our default windlight profile and return it |
738 | nWP.regionID = regionUUID; | 766 | nWP.regionID = regionUUID; |
739 | StoreRegionWindlightSettings(nWP); | 767 | // StoreRegionWindlightSettings(nWP); |
740 | return nWP; | 768 | return nWP; |
741 | } | 769 | } |
742 | else | 770 | else |
@@ -811,7 +839,7 @@ namespace OpenSim.Data.MySQL | |||
811 | return nWP; | 839 | return nWP; |
812 | } | 840 | } |
813 | 841 | ||
814 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 842 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
815 | { | 843 | { |
816 | RegionSettings rs = null; | 844 | RegionSettings rs = null; |
817 | 845 | ||
@@ -851,7 +879,7 @@ namespace OpenSim.Data.MySQL | |||
851 | return rs; | 879 | return rs; |
852 | } | 880 | } |
853 | 881 | ||
854 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 882 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
855 | { | 883 | { |
856 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 884 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
857 | { | 885 | { |
@@ -954,7 +982,7 @@ namespace OpenSim.Data.MySQL | |||
954 | } | 982 | } |
955 | } | 983 | } |
956 | 984 | ||
957 | public void RemoveRegionWindlightSettings(UUID regionID) | 985 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
958 | { | 986 | { |
959 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 987 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
960 | { | 988 | { |
@@ -1031,7 +1059,7 @@ namespace OpenSim.Data.MySQL | |||
1031 | } | 1059 | } |
1032 | #endregion | 1060 | #endregion |
1033 | 1061 | ||
1034 | public void StoreRegionSettings(RegionSettings rs) | 1062 | public virtual void StoreRegionSettings(RegionSettings rs) |
1035 | { | 1063 | { |
1036 | lock (m_dbLock) | 1064 | lock (m_dbLock) |
1037 | { | 1065 | { |
@@ -1058,7 +1086,7 @@ namespace OpenSim.Data.MySQL | |||
1058 | "use_estate_sun, fixed_sun, sun_position, " + | 1086 | "use_estate_sun, fixed_sun, sun_position, " + |
1059 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1087 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1060 | "sunvectorz, loaded_creation_datetime, " + | 1088 | "sunvectorz, loaded_creation_datetime, " + |
1061 | "loaded_creation_id, map_tile_ID, " + | 1089 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1062 | "TelehubObject, parcel_tile_ID) " + | 1090 | "TelehubObject, parcel_tile_ID) " + |
1063 | "values (?RegionUUID, ?BlockTerraform, " + | 1091 | "values (?RegionUUID, ?BlockTerraform, " + |
1064 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1092 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
@@ -1075,7 +1103,8 @@ namespace OpenSim.Data.MySQL | |||
1075 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1103 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1076 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1104 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1077 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1105 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1078 | "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; | 1106 | "?TerrainImageID, ?block_search, ?casino, " + |
1107 | "?TelehubObject, ?ParcelImageID)"; | ||
1079 | 1108 | ||
1080 | FillRegionSettingsCommand(cmd, rs); | 1109 | FillRegionSettingsCommand(cmd, rs); |
1081 | 1110 | ||
@@ -1086,7 +1115,7 @@ namespace OpenSim.Data.MySQL | |||
1086 | SaveSpawnPoints(rs); | 1115 | SaveSpawnPoints(rs); |
1087 | } | 1116 | } |
1088 | 1117 | ||
1089 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1118 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1090 | { | 1119 | { |
1091 | List<LandData> landData = new List<LandData>(); | 1120 | List<LandData> landData = new List<LandData>(); |
1092 | 1121 | ||
@@ -1268,11 +1297,40 @@ namespace OpenSim.Data.MySQL | |||
1268 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1297 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1269 | 1298 | ||
1270 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1299 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1300 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1271 | prim.LinkNum = (int)row["LinkNumber"]; | 1301 | prim.LinkNum = (int)row["LinkNumber"]; |
1272 | 1302 | ||
1273 | if (!(row["MediaURL"] is System.DBNull)) | 1303 | if (!(row["MediaURL"] is System.DBNull)) |
1274 | prim.MediaUrl = (string)row["MediaURL"]; | 1304 | prim.MediaUrl = (string)row["MediaURL"]; |
1275 | 1305 | ||
1306 | if (!(row["KeyframeMotion"] is DBNull)) | ||
1307 | { | ||
1308 | Byte[] data = (byte[])row["KeyframeMotion"]; | ||
1309 | if (data.Length > 0) | ||
1310 | prim.KeyframeMotion = KeyframeMotion.FromData(null, data); | ||
1311 | else | ||
1312 | prim.KeyframeMotion = null; | ||
1313 | } | ||
1314 | else | ||
1315 | { | ||
1316 | prim.KeyframeMotion = null; | ||
1317 | } | ||
1318 | |||
1319 | prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString()); | ||
1320 | prim.Density = (float)(double)row["Density"]; | ||
1321 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | ||
1322 | prim.Friction = (float)(double)row["Friction"]; | ||
1323 | prim.Bounciness = (float)(double)row["Restitution"]; | ||
1324 | |||
1325 | SOPVehicle vehicle = null; | ||
1326 | |||
1327 | if (row["Vehicle"].ToString() != String.Empty) | ||
1328 | { | ||
1329 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1330 | if (vehicle != null) | ||
1331 | prim.VehicleParams = vehicle; | ||
1332 | } | ||
1333 | |||
1276 | return prim; | 1334 | return prim; |
1277 | } | 1335 | } |
1278 | 1336 | ||
@@ -1283,32 +1341,40 @@ namespace OpenSim.Data.MySQL | |||
1283 | /// <returns></returns> | 1341 | /// <returns></returns> |
1284 | private static TaskInventoryItem BuildItem(IDataReader row) | 1342 | private static TaskInventoryItem BuildItem(IDataReader row) |
1285 | { | 1343 | { |
1286 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1344 | try |
1287 | 1345 | { | |
1288 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1346 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1289 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1347 | |
1290 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1348 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1291 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1349 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1292 | 1350 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1293 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1351 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1294 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1352 | |
1295 | 1353 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1296 | taskItem.Name = (String)row["name"]; | 1354 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1297 | taskItem.Description = (String)row["description"]; | 1355 | |
1298 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1356 | taskItem.Name = (String)row["name"]; |
1299 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1357 | taskItem.Description = (String)row["description"]; |
1300 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1358 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1301 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1359 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1302 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1360 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1303 | 1361 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1304 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1362 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1305 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1363 | |
1306 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1364 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1307 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1365 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1308 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1366 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1309 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1367 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1310 | 1368 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1311 | return taskItem; | 1369 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1370 | |||
1371 | return taskItem; | ||
1372 | } | ||
1373 | catch | ||
1374 | { | ||
1375 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1376 | throw; | ||
1377 | } | ||
1312 | } | 1378 | } |
1313 | 1379 | ||
1314 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1380 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1366,6 +1432,9 @@ namespace OpenSim.Data.MySQL | |||
1366 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1432 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1367 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1433 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1368 | 1434 | ||
1435 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1436 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1437 | |||
1369 | return newSettings; | 1438 | return newSettings; |
1370 | } | 1439 | } |
1371 | 1440 | ||
@@ -1463,7 +1532,7 @@ namespace OpenSim.Data.MySQL | |||
1463 | /// </summary> | 1532 | /// </summary> |
1464 | /// <param name="val"></param> | 1533 | /// <param name="val"></param> |
1465 | /// <returns></returns> | 1534 | /// <returns></returns> |
1466 | private static Array SerializeTerrain(double[,] val) | 1535 | private static Array SerializeTerrain(double[,] val, double[,] oldTerrain) |
1467 | { | 1536 | { |
1468 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); | 1537 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1469 | BinaryWriter bw = new BinaryWriter(str); | 1538 | BinaryWriter bw = new BinaryWriter(str); |
@@ -1472,7 +1541,11 @@ namespace OpenSim.Data.MySQL | |||
1472 | for (int x = 0; x < (int)Constants.RegionSize; x++) | 1541 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1473 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 1542 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1474 | { | 1543 | { |
1475 | double height = val[x, y]; | 1544 | double height = 20.0; |
1545 | if (oldTerrain != null) | ||
1546 | height = oldTerrain[x, y]; | ||
1547 | if (!double.IsNaN(val[x, y])) | ||
1548 | height = val[x, y]; | ||
1476 | if (height == 0.0) | 1549 | if (height == 0.0) |
1477 | height = double.Epsilon; | 1550 | height = double.Epsilon; |
1478 | 1551 | ||
@@ -1616,8 +1689,29 @@ namespace OpenSim.Data.MySQL | |||
1616 | else | 1689 | else |
1617 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1690 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1618 | 1691 | ||
1692 | if (prim.PassCollisions) | ||
1693 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1694 | else | ||
1695 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1696 | |||
1619 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1697 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1620 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1698 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1699 | |||
1700 | if (prim.KeyframeMotion != null) | ||
1701 | cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize()); | ||
1702 | else | ||
1703 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | ||
1704 | |||
1705 | cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType); | ||
1706 | cmd.Parameters.AddWithValue("Density", (double)prim.Density); | ||
1707 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); | ||
1708 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | ||
1709 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness); | ||
1710 | |||
1711 | if (prim.VehicleParams != null) | ||
1712 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1713 | else | ||
1714 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1621 | } | 1715 | } |
1622 | 1716 | ||
1623 | /// <summary> | 1717 | /// <summary> |
@@ -1696,6 +1790,9 @@ namespace OpenSim.Data.MySQL | |||
1696 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1790 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1697 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1791 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1698 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1792 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1793 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1794 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1795 | |||
1699 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1796 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1700 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1797 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
1701 | } | 1798 | } |
@@ -1856,7 +1953,7 @@ namespace OpenSim.Data.MySQL | |||
1856 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1953 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1857 | } | 1954 | } |
1858 | 1955 | ||
1859 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1956 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1860 | { | 1957 | { |
1861 | lock (m_dbLock) | 1958 | lock (m_dbLock) |
1862 | { | 1959 | { |
@@ -1900,6 +1997,37 @@ namespace OpenSim.Data.MySQL | |||
1900 | } | 1997 | } |
1901 | } | 1998 | } |
1902 | 1999 | ||
2000 | public UUID[] GetObjectIDs(UUID regionID) | ||
2001 | { | ||
2002 | List<UUID> uuids = new List<UUID>(); | ||
2003 | |||
2004 | lock (m_dbLock) | ||
2005 | { | ||
2006 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2007 | { | ||
2008 | dbcon.Open(); | ||
2009 | |||
2010 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2011 | { | ||
2012 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID"; | ||
2013 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2014 | |||
2015 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2016 | { | ||
2017 | while (reader.Read()) | ||
2018 | { | ||
2019 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2020 | |||
2021 | uuids.Add(id); | ||
2022 | } | ||
2023 | } | ||
2024 | } | ||
2025 | } | ||
2026 | } | ||
2027 | |||
2028 | return uuids.ToArray(); | ||
2029 | } | ||
2030 | |||
1903 | private void LoadSpawnPoints(RegionSettings rs) | 2031 | private void LoadSpawnPoints(RegionSettings rs) |
1904 | { | 2032 | { |
1905 | rs.ClearSpawnPoints(); | 2033 | rs.ClearSpawnPoints(); |
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index e964295..4ff3175 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,20 +70,36 @@ 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()); |
79 | } | 83 | } |
80 | 84 | ||
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/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index e6ac22e..9a50373 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -497,4 +497,4 @@ namespace OpenSim.Data.MySQL | |||
497 | 497 | ||
498 | #endregion | 498 | #endregion |
499 | } | 499 | } |
500 | } \ No newline at end of file | 500 | } |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 4a925fb..db0d0ec 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 | ||
718 | COMMIT; | 718 | COMMIT; |
719 | 719 | ||
720 | :VERSION 32 | 720 | :VERSION 32 #--------------------- |
721 | 721 | ||
722 | BEGIN; | 722 | BEGIN; |
723 | CREATE TABLE `regionwindlight` ( | 723 | CREATE TABLE `regionwindlight` ( |
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 8f2314f..a39ef0b 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs | |||
@@ -151,5 +151,10 @@ namespace OpenSim.Data.Null | |||
151 | public void Shutdown() | 151 | public void Shutdown() |
152 | { | 152 | { |
153 | } | 153 | } |
154 | |||
155 | public UUID[] GetObjectIDs(UUID regionID) | ||
156 | { | ||
157 | return new UUID[0]; | ||
158 | } | ||
154 | } | 159 | } |
155 | } | 160 | } |
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/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index d0e24c3..7f7059b 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 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 136 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
137 | if (ExistsAsset(asset.FullID)) | 137 | if (ExistsAsset(asset.FullID)) |
@@ -153,6 +153,7 @@ namespace OpenSim.Data.SQLite | |||
153 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | 153 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); |
154 | 154 | ||
155 | cmd.ExecuteNonQuery(); | 155 | cmd.ExecuteNonQuery(); |
156 | return true; | ||
156 | } | 157 | } |
157 | } | 158 | } |
158 | } | 159 | } |
@@ -173,6 +174,7 @@ namespace OpenSim.Data.SQLite | |||
173 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | 174 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); |
174 | 175 | ||
175 | cmd.ExecuteNonQuery(); | 176 | cmd.ExecuteNonQuery(); |
177 | return true; | ||
176 | } | 178 | } |
177 | } | 179 | } |
178 | } | 180 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index f40e866..9175a8f 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -2890,5 +2890,9 @@ namespace OpenSim.Data.SQLite | |||
2890 | } | 2890 | } |
2891 | } | 2891 | } |
2892 | 2892 | ||
2893 | public UUID[] GetObjectIDs(UUID regionID) | ||
2894 | { | ||
2895 | return new UUID[0]; | ||
2896 | } | ||
2893 | } | 2897 | } |
2894 | } | 2898 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs index 7a5de50..4d580c0 100644 --- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs | |||
@@ -81,5 +81,10 @@ namespace OpenSim.Data.SQLite | |||
81 | 81 | ||
82 | return DoQuery(cmd); | 82 | return DoQuery(cmd); |
83 | } | 83 | } |
84 | |||
85 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
86 | { | ||
87 | return null; | ||
88 | } | ||
84 | } | 89 | } |
85 | } | 90 | } |