diff options
Diffstat (limited to '')
23 files changed, 267 insertions, 99 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 f3e008d..12f2477 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 = |
@@ -196,10 +196,12 @@ namespace OpenSim.Data.MSSQL | |||
196 | try | 196 | try |
197 | { | 197 | { |
198 | command.ExecuteNonQuery(); | 198 | command.ExecuteNonQuery(); |
199 | return true; | ||
199 | } | 200 | } |
200 | catch(Exception e) | 201 | catch(Exception e) |
201 | { | 202 | { |
202 | m_log.Error("[ASSET DB]: Error storing item :" + e.Message); | 203 | m_log.Error("[ASSET DB]: Error storing item :" + e.Message); |
204 | return false; | ||
203 | } | 205 | } |
204 | } | 206 | } |
205 | } | 207 | } |
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 0c71e79..deff2ed 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 476f57a..00af3a0 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -2226,6 +2226,11 @@ VALUES | |||
2226 | } | 2226 | } |
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | public UUID[] GetObjectIDs(UUID regionID) | ||
2230 | { | ||
2231 | return new UUID[0]; | ||
2232 | } | ||
2233 | |||
2229 | public void SaveExtra(UUID regionID, string name, string value) | 2234 | public void SaveExtra(UUID regionID, string name, string value) |
2230 | { | 2235 | { |
2231 | } | 2236 | } |
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 9164ffe..e261aba 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 MSSQLFolderHandler m_Folders; | 46 | private MSSQLFolderHandler 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 cf80b3d..21dd5aa 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 | { |
@@ -205,12 +205,14 @@ namespace OpenSim.Data.MySQL | |||
205 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 205 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); |
206 | cmd.Parameters.AddWithValue("?data", asset.Data); | 206 | cmd.Parameters.AddWithValue("?data", asset.Data); |
207 | cmd.ExecuteNonQuery(); | 207 | cmd.ExecuteNonQuery(); |
208 | return true; | ||
208 | } | 209 | } |
209 | } | 210 | } |
210 | catch (Exception e) | 211 | catch (Exception e) |
211 | { | 212 | { |
212 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", | 213 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", |
213 | asset.FullID, asset.Name, e.Message); | 214 | asset.FullID, asset.Name, e.Message); |
215 | return false; | ||
214 | } | 216 | } |
215 | } | 217 | } |
216 | } | 218 | } |
@@ -374,4 +376,4 @@ namespace OpenSim.Data.MySQL | |||
374 | 376 | ||
375 | #endregion | 377 | #endregion |
376 | } | 378 | } |
377 | } \ No newline at end of file | 379 | } |
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/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 9cc6f40..5320543 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Data.MySQL | |||
52 | private string m_connectionString; | 52 | private string m_connectionString; |
53 | private object m_dbLock = new object(); | 53 | private object m_dbLock = new object(); |
54 | 54 | ||
55 | protected Assembly Assembly | 55 | protected virtual Assembly Assembly |
56 | { | 56 | { |
57 | get { return GetType().Assembly; } | 57 | get { return GetType().Assembly; } |
58 | } | 58 | } |
@@ -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,7 +113,7 @@ 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 | ||
@@ -173,9 +173,10 @@ namespace OpenSim.Data.MySQL | |||
173 | "ParticleSystem, ClickAction, Material, " + | 173 | "ParticleSystem, ClickAction, Material, " + |
174 | "CollisionSound, CollisionSoundVolume, " + | 174 | "CollisionSound, CollisionSoundVolume, " + |
175 | "PassTouches, " + | 175 | "PassTouches, " + |
176 | "LinkNumber, MediaURL, DynAttrs, " + | 176 | "PassCollisions, " + |
177 | "LinkNumber, MediaURL, KeyframeMotion, " + | ||
177 | "PhysicsShapeType, Density, GravityModifier, " + | 178 | "PhysicsShapeType, Density, GravityModifier, " + |
178 | "Friction, Restitution " + | 179 | "Friction, Restitution, Vehicle, DynAttrs " + |
179 | ") values (" + "?UUID, " + | 180 | ") values (" + "?UUID, " + |
180 | "?CreationDate, ?Name, ?Text, " + | 181 | "?CreationDate, ?Name, ?Text, " + |
181 | "?Description, ?SitName, ?TouchName, " + | 182 | "?Description, ?SitName, ?TouchName, " + |
@@ -207,10 +208,10 @@ namespace OpenSim.Data.MySQL | |||
207 | "?SaleType, ?ColorR, ?ColorG, " + | 208 | "?SaleType, ?ColorR, ?ColorG, " + |
208 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 209 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
209 | "?ClickAction, ?Material, ?CollisionSound, " + | 210 | "?ClickAction, ?Material, ?CollisionSound, " + |
210 | "?CollisionSoundVolume, ?PassTouches, " + | 211 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
211 | "?LinkNumber, ?MediaURL, ?DynAttrs, " + | 212 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + |
212 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 213 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
213 | "?Friction, ?Restitution)"; | 214 | "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)"; |
214 | 215 | ||
215 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 216 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
216 | 217 | ||
@@ -250,7 +251,7 @@ namespace OpenSim.Data.MySQL | |||
250 | } | 251 | } |
251 | } | 252 | } |
252 | 253 | ||
253 | public void RemoveObject(UUID obj, UUID regionUUID) | 254 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
254 | { | 255 | { |
255 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 256 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
256 | 257 | ||
@@ -399,7 +400,7 @@ namespace OpenSim.Data.MySQL | |||
399 | } | 400 | } |
400 | } | 401 | } |
401 | 402 | ||
402 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 403 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
403 | { | 404 | { |
404 | const int ROWS_PER_QUERY = 5000; | 405 | const int ROWS_PER_QUERY = 5000; |
405 | 406 | ||
@@ -455,7 +456,11 @@ namespace OpenSim.Data.MySQL | |||
455 | foreach (SceneObjectPart prim in prims.Values) | 456 | foreach (SceneObjectPart prim in prims.Values) |
456 | { | 457 | { |
457 | if (prim.ParentUUID == UUID.Zero) | 458 | if (prim.ParentUUID == UUID.Zero) |
459 | { | ||
458 | objects[prim.UUID] = new SceneObjectGroup(prim); | 460 | objects[prim.UUID] = new SceneObjectGroup(prim); |
461 | if (prim.KeyframeMotion != null) | ||
462 | prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]); | ||
463 | } | ||
459 | } | 464 | } |
460 | 465 | ||
461 | // Add all of the children objects to the SOGs | 466 | // Add all of the children objects to the SOGs |
@@ -568,36 +573,51 @@ namespace OpenSim.Data.MySQL | |||
568 | } | 573 | } |
569 | } | 574 | } |
570 | 575 | ||
571 | public void StoreTerrain(double[,] ter, UUID regionID) | 576 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
572 | { | 577 | { |
573 | m_log.Info("[REGION DB]: Storing terrain"); | 578 | Util.FireAndForget(delegate(object x) |
574 | |||
575 | lock (m_dbLock) | ||
576 | { | 579 | { |
577 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 580 | double[,] oldTerrain = LoadTerrain(regionID); |
578 | { | ||
579 | dbcon.Open(); | ||
580 | 581 | ||
581 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 582 | m_log.Info("[REGION DB]: Storing terrain"); |
583 | |||
584 | lock (m_dbLock) | ||
585 | { | ||
586 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
582 | { | 587 | { |
583 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 588 | dbcon.Open(); |
584 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
585 | 589 | ||
586 | ExecuteNonQuery(cmd); | 590 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
591 | { | ||
592 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | ||
593 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
587 | 594 | ||
588 | cmd.CommandText = "insert into terrain (RegionUUID, " + | 595 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
589 | "Revision, Heightfield) values (?RegionUUID, " + | 596 | { |
590 | "1, ?Heightfield)"; | 597 | try |
591 | 598 | { | |
592 | cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); | 599 | cmd2.CommandText = "insert into terrain (RegionUUID, " + |
600 | "Revision, Heightfield) values (?RegionUUID, " + | ||
601 | "1, ?Heightfield)"; | ||
593 | 602 | ||
594 | ExecuteNonQuery(cmd); | 603 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
604 | cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain)); | ||
605 | |||
606 | ExecuteNonQuery(cmd); | ||
607 | ExecuteNonQuery(cmd2); | ||
608 | } | ||
609 | catch (Exception e) | ||
610 | { | ||
611 | m_log.ErrorFormat(e.ToString()); | ||
612 | } | ||
613 | } | ||
614 | } | ||
595 | } | 615 | } |
596 | } | 616 | } |
597 | } | 617 | }); |
598 | } | 618 | } |
599 | 619 | ||
600 | public double[,] LoadTerrain(UUID regionID) | 620 | public virtual double[,] LoadTerrain(UUID regionID) |
601 | { | 621 | { |
602 | double[,] terrain = null; | 622 | double[,] terrain = null; |
603 | 623 | ||
@@ -647,7 +667,7 @@ namespace OpenSim.Data.MySQL | |||
647 | return terrain; | 667 | return terrain; |
648 | } | 668 | } |
649 | 669 | ||
650 | public void RemoveLandObject(UUID globalID) | 670 | public virtual void RemoveLandObject(UUID globalID) |
651 | { | 671 | { |
652 | lock (m_dbLock) | 672 | lock (m_dbLock) |
653 | { | 673 | { |
@@ -666,7 +686,7 @@ namespace OpenSim.Data.MySQL | |||
666 | } | 686 | } |
667 | } | 687 | } |
668 | 688 | ||
669 | public void StoreLandObject(ILandObject parcel) | 689 | public virtual void StoreLandObject(ILandObject parcel) |
670 | { | 690 | { |
671 | lock (m_dbLock) | 691 | lock (m_dbLock) |
672 | { | 692 | { |
@@ -723,7 +743,7 @@ namespace OpenSim.Data.MySQL | |||
723 | } | 743 | } |
724 | } | 744 | } |
725 | 745 | ||
726 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 746 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
727 | { | 747 | { |
728 | RegionLightShareData nWP = new RegionLightShareData(); | 748 | RegionLightShareData nWP = new RegionLightShareData(); |
729 | nWP.OnSave += StoreRegionWindlightSettings; | 749 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -824,7 +844,7 @@ namespace OpenSim.Data.MySQL | |||
824 | return nWP; | 844 | return nWP; |
825 | } | 845 | } |
826 | 846 | ||
827 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 847 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
828 | { | 848 | { |
829 | RegionSettings rs = null; | 849 | RegionSettings rs = null; |
830 | 850 | ||
@@ -864,7 +884,7 @@ namespace OpenSim.Data.MySQL | |||
864 | return rs; | 884 | return rs; |
865 | } | 885 | } |
866 | 886 | ||
867 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 887 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
868 | { | 888 | { |
869 | lock (m_dbLock) | 889 | lock (m_dbLock) |
870 | { | 890 | { |
@@ -970,7 +990,7 @@ namespace OpenSim.Data.MySQL | |||
970 | } | 990 | } |
971 | } | 991 | } |
972 | 992 | ||
973 | public void RemoveRegionWindlightSettings(UUID regionID) | 993 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
974 | { | 994 | { |
975 | lock (m_dbLock) | 995 | lock (m_dbLock) |
976 | { | 996 | { |
@@ -1059,7 +1079,7 @@ namespace OpenSim.Data.MySQL | |||
1059 | } | 1079 | } |
1060 | #endregion | 1080 | #endregion |
1061 | 1081 | ||
1062 | public void StoreRegionSettings(RegionSettings rs) | 1082 | public virtual void StoreRegionSettings(RegionSettings rs) |
1063 | { | 1083 | { |
1064 | lock (m_dbLock) | 1084 | lock (m_dbLock) |
1065 | { | 1085 | { |
@@ -1086,7 +1106,7 @@ namespace OpenSim.Data.MySQL | |||
1086 | "use_estate_sun, fixed_sun, sun_position, " + | 1106 | "use_estate_sun, fixed_sun, sun_position, " + |
1087 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1107 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1088 | "sunvectorz, loaded_creation_datetime, " + | 1108 | "sunvectorz, loaded_creation_datetime, " + |
1089 | "loaded_creation_id, map_tile_ID, " + | 1109 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1090 | "TelehubObject, parcel_tile_ID) " + | 1110 | "TelehubObject, parcel_tile_ID) " + |
1091 | "values (?RegionUUID, ?BlockTerraform, " + | 1111 | "values (?RegionUUID, ?BlockTerraform, " + |
1092 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1112 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
@@ -1103,7 +1123,7 @@ namespace OpenSim.Data.MySQL | |||
1103 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1123 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1104 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1124 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1105 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1125 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1106 | "?TerrainImageID, " + | 1126 | "?TerrainImageID, ?block_search, ?casino, " + |
1107 | "?TelehubObject, ?ParcelImageID)"; | 1127 | "?TelehubObject, ?ParcelImageID)"; |
1108 | 1128 | ||
1109 | FillRegionSettingsCommand(cmd, rs); | 1129 | FillRegionSettingsCommand(cmd, rs); |
@@ -1115,7 +1135,7 @@ namespace OpenSim.Data.MySQL | |||
1115 | SaveSpawnPoints(rs); | 1135 | SaveSpawnPoints(rs); |
1116 | } | 1136 | } |
1117 | 1137 | ||
1118 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1138 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1119 | { | 1139 | { |
1120 | List<LandData> landData = new List<LandData>(); | 1140 | List<LandData> landData = new List<LandData>(); |
1121 | 1141 | ||
@@ -1297,6 +1317,7 @@ namespace OpenSim.Data.MySQL | |||
1297 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1317 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1298 | 1318 | ||
1299 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1319 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1320 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1300 | prim.LinkNum = (int)row["LinkNumber"]; | 1321 | prim.LinkNum = (int)row["LinkNumber"]; |
1301 | 1322 | ||
1302 | if (!(row["MediaURL"] is System.DBNull)) | 1323 | if (!(row["MediaURL"] is System.DBNull)) |
@@ -1307,12 +1328,34 @@ namespace OpenSim.Data.MySQL | |||
1307 | else | 1328 | else |
1308 | prim.DynAttrs = new DAMap(); | 1329 | prim.DynAttrs = new DAMap(); |
1309 | 1330 | ||
1331 | if (!(row["KeyframeMotion"] is DBNull)) | ||
1332 | { | ||
1333 | Byte[] data = (byte[])row["KeyframeMotion"]; | ||
1334 | if (data.Length > 0) | ||
1335 | prim.KeyframeMotion = KeyframeMotion.FromData(null, data); | ||
1336 | else | ||
1337 | prim.KeyframeMotion = null; | ||
1338 | } | ||
1339 | else | ||
1340 | { | ||
1341 | prim.KeyframeMotion = null; | ||
1342 | } | ||
1343 | |||
1310 | prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString()); | 1344 | prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString()); |
1311 | prim.Density = (float)(double)row["Density"]; | 1345 | prim.Density = (float)(double)row["Density"]; |
1312 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | 1346 | prim.GravityModifier = (float)(double)row["GravityModifier"]; |
1313 | prim.Friction = (float)(double)row["Friction"]; | 1347 | prim.Friction = (float)(double)row["Friction"]; |
1314 | prim.Restitution = (float)(double)row["Restitution"]; | 1348 | prim.Restitution = (float)(double)row["Restitution"]; |
1315 | 1349 | ||
1350 | SOPVehicle vehicle = null; | ||
1351 | |||
1352 | if (row["Vehicle"].ToString() != String.Empty) | ||
1353 | { | ||
1354 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1355 | if (vehicle != null) | ||
1356 | prim.VehicleParams = vehicle; | ||
1357 | } | ||
1358 | |||
1316 | return prim; | 1359 | return prim; |
1317 | } | 1360 | } |
1318 | 1361 | ||
@@ -1323,32 +1366,40 @@ namespace OpenSim.Data.MySQL | |||
1323 | /// <returns></returns> | 1366 | /// <returns></returns> |
1324 | private static TaskInventoryItem BuildItem(IDataReader row) | 1367 | private static TaskInventoryItem BuildItem(IDataReader row) |
1325 | { | 1368 | { |
1326 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1369 | try |
1327 | 1370 | { | |
1328 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1371 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1329 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1372 | |
1330 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1373 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1331 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1374 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1332 | 1375 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1333 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1376 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1334 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1377 | |
1335 | 1378 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1336 | taskItem.Name = (String)row["name"]; | 1379 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1337 | taskItem.Description = (String)row["description"]; | 1380 | |
1338 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1381 | taskItem.Name = (String)row["name"]; |
1339 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1382 | taskItem.Description = (String)row["description"]; |
1340 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1383 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1341 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1384 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1342 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1385 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1343 | 1386 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1344 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1387 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1345 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1388 | |
1346 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1389 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1347 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1390 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1348 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1391 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1349 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1392 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1350 | 1393 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1351 | return taskItem; | 1394 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1395 | |||
1396 | return taskItem; | ||
1397 | } | ||
1398 | catch | ||
1399 | { | ||
1400 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1401 | throw; | ||
1402 | } | ||
1352 | } | 1403 | } |
1353 | 1404 | ||
1354 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1405 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1406,6 +1457,9 @@ namespace OpenSim.Data.MySQL | |||
1406 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1457 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1407 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1458 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1408 | 1459 | ||
1460 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1461 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1462 | |||
1409 | return newSettings; | 1463 | return newSettings; |
1410 | } | 1464 | } |
1411 | 1465 | ||
@@ -1503,7 +1557,7 @@ namespace OpenSim.Data.MySQL | |||
1503 | /// </summary> | 1557 | /// </summary> |
1504 | /// <param name="val"></param> | 1558 | /// <param name="val"></param> |
1505 | /// <returns></returns> | 1559 | /// <returns></returns> |
1506 | private static Array SerializeTerrain(double[,] val) | 1560 | private static Array SerializeTerrain(double[,] val, double[,] oldTerrain) |
1507 | { | 1561 | { |
1508 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); | 1562 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1509 | BinaryWriter bw = new BinaryWriter(str); | 1563 | BinaryWriter bw = new BinaryWriter(str); |
@@ -1512,7 +1566,11 @@ namespace OpenSim.Data.MySQL | |||
1512 | for (int x = 0; x < (int)Constants.RegionSize; x++) | 1566 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1513 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 1567 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1514 | { | 1568 | { |
1515 | double height = val[x, y]; | 1569 | double height = 20.0; |
1570 | if (oldTerrain != null) | ||
1571 | height = oldTerrain[x, y]; | ||
1572 | if (!double.IsNaN(val[x, y])) | ||
1573 | height = val[x, y]; | ||
1516 | if (height == 0.0) | 1574 | if (height == 0.0) |
1517 | height = double.Epsilon; | 1575 | height = double.Epsilon; |
1518 | 1576 | ||
@@ -1656,9 +1714,23 @@ namespace OpenSim.Data.MySQL | |||
1656 | else | 1714 | else |
1657 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1715 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1658 | 1716 | ||
1717 | if (prim.PassCollisions) | ||
1718 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1719 | else | ||
1720 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1721 | |||
1659 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1722 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1660 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1723 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1661 | 1724 | ||
1725 | if (prim.KeyframeMotion != null) | ||
1726 | cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize()); | ||
1727 | else | ||
1728 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | ||
1729 | |||
1730 | if (prim.VehicleParams != null) | ||
1731 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1732 | else | ||
1733 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1662 | 1734 | ||
1663 | if (prim.DynAttrs.Count > 0) | 1735 | if (prim.DynAttrs.Count > 0) |
1664 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1736 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
@@ -1748,6 +1820,8 @@ namespace OpenSim.Data.MySQL | |||
1748 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1820 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1749 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1821 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1750 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1822 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1823 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1824 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1751 | 1825 | ||
1752 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1826 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1753 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1827 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
@@ -1909,7 +1983,7 @@ namespace OpenSim.Data.MySQL | |||
1909 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1983 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1910 | } | 1984 | } |
1911 | 1985 | ||
1912 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1986 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1913 | { | 1987 | { |
1914 | lock (m_dbLock) | 1988 | lock (m_dbLock) |
1915 | { | 1989 | { |
@@ -1953,6 +2027,37 @@ namespace OpenSim.Data.MySQL | |||
1953 | } | 2027 | } |
1954 | } | 2028 | } |
1955 | 2029 | ||
2030 | public UUID[] GetObjectIDs(UUID regionID) | ||
2031 | { | ||
2032 | List<UUID> uuids = new List<UUID>(); | ||
2033 | |||
2034 | lock (m_dbLock) | ||
2035 | { | ||
2036 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2037 | { | ||
2038 | dbcon.Open(); | ||
2039 | |||
2040 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2041 | { | ||
2042 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID"; | ||
2043 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2044 | |||
2045 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2046 | { | ||
2047 | while (reader.Read()) | ||
2048 | { | ||
2049 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2050 | |||
2051 | uuids.Add(id); | ||
2052 | } | ||
2053 | } | ||
2054 | } | ||
2055 | } | ||
2056 | } | ||
2057 | |||
2058 | return uuids.ToArray(); | ||
2059 | } | ||
2060 | |||
1956 | private void LoadSpawnPoints(RegionSettings rs) | 2061 | private void LoadSpawnPoints(RegionSettings rs) |
1957 | { | 2062 | { |
1958 | rs.ClearSpawnPoints(); | 2063 | 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 8c93825..15ac921 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -518,4 +518,4 @@ namespace OpenSim.Data.MySQL | |||
518 | 518 | ||
519 | #endregion | 519 | #endregion |
520 | } | 520 | } |
521 | } \ No newline at end of file | 521 | } |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 513c784..bda1b6a 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` ( |
@@ -922,4 +922,3 @@ ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; | |||
922 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; | 922 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; |
923 | 923 | ||
924 | COMMIT; | 924 | COMMIT; |
925 | |||
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 4979cf6..e7e5c41 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs | |||
@@ -152,6 +152,11 @@ namespace OpenSim.Data.Null | |||
152 | { | 152 | { |
153 | } | 153 | } |
154 | 154 | ||
155 | public UUID[] GetObjectIDs(UUID regionID) | ||
156 | { | ||
157 | return new UUID[0]; | ||
158 | } | ||
159 | |||
155 | public void SaveExtra(UUID regionID, string name, string value) | 160 | public void SaveExtra(UUID regionID, string name, string value) |
156 | { | 161 | { |
157 | } | 162 | } |
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 c32982e..82320ca 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 > 64) | 137 | if (asset.Name.Length > 64) |
@@ -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 d4734a6..99a6598 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -2940,6 +2940,11 @@ namespace OpenSim.Data.SQLite | |||
2940 | } | 2940 | } |
2941 | } | 2941 | } |
2942 | 2942 | ||
2943 | public UUID[] GetObjectIDs(UUID regionID) | ||
2944 | { | ||
2945 | return new UUID[0]; | ||
2946 | } | ||
2947 | |||
2943 | public void SaveExtra(UUID regionID, string name, string value) | 2948 | public void SaveExtra(UUID regionID, string name, string value) |
2944 | { | 2949 | { |
2945 | } | 2950 | } |
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 | } |