aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/AssetDataBase.cs2
-rw-r--r--OpenSim/Data/IAssetData.cs2
-rw-r--r--OpenSim/Data/IUserAccountData.cs1
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs4
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAvatarData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs4
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridUserData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLManager.cs4
-rw-r--r--OpenSim/Data/MSSQL/MSSQLPresenceData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserAccountData.cs5
-rw-r--r--OpenSim/Data/MSSQL/MSSQLXInventoryData.cs4
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs4
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs141
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs43
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs2
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations3
-rw-r--r--OpenSim/Data/Null/NullUserAccountData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserAccountData.cs5
20 files changed, 179 insertions, 67 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 cf963e3..575fd21 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
@@ -180,6 +180,8 @@ namespace OpenSim.Data.MSSQL
180 return parameter; 180 return parameter;
181 } 181 }
182 182
183 private static readonly Dictionary<string, string> emptyDictionary = new Dictionary<string, string>();
184
183 /// <summary> 185 /// <summary>
184 /// Checks if we need to do some migrations to the database 186 /// Checks if we need to do some migrations to the database
185 /// </summary> 187 /// </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/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 a743479..a22dc0a 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 {
@@ -203,12 +203,14 @@ namespace OpenSim.Data.MySQL
203 cmd.Parameters.AddWithValue("?data", asset.Data); 203 cmd.Parameters.AddWithValue("?data", asset.Data);
204 cmd.ExecuteNonQuery(); 204 cmd.ExecuteNonQuery();
205 cmd.Dispose(); 205 cmd.Dispose();
206 return true;
206 } 207 }
207 } 208 }
208 catch (Exception e) 209 catch (Exception e)
209 { 210 {
210 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", 211 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
211 asset.FullID, asset.Name, e.Message); 212 asset.FullID, asset.Name, e.Message);
213 return false;
212 } 214 }
213 } 215 }
214 } 216 }
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 754cf72..786b955 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -173,6 +173,11 @@ namespace OpenSim.Data.MySQL
173 int v = Convert.ToInt32(reader[name]); 173 int v = Convert.ToInt32(reader[name]);
174 m_Fields[name].SetValue(row, v); 174 m_Fields[name].SetValue(row, v);
175 } 175 }
176 else if (m_Fields[name].FieldType == typeof(uint))
177 {
178 uint v = Convert.ToUInt32(reader[name]);
179 m_Fields[name].SetValue(row, v);
180 }
176 else 181 else
177 { 182 {
178 m_Fields[name].SetValue(row, reader[name]); 183 m_Fields[name].SetValue(row, reader[name]);
@@ -294,4 +299,4 @@ namespace OpenSim.Data.MySQL
294 } 299 }
295 } 300 }
296 } 301 }
297} \ No newline at end of file 302}
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 381a514..33c184f 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,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
@@ -170,7 +170,9 @@ namespace OpenSim.Data.MySQL
170 "ParticleSystem, ClickAction, Material, " + 170 "ParticleSystem, ClickAction, Material, " +
171 "CollisionSound, CollisionSoundVolume, " + 171 "CollisionSound, CollisionSoundVolume, " +
172 "PassTouches, " + 172 "PassTouches, " +
173 "LinkNumber, MediaURL) values (" + "?UUID, " + 173 "LinkNumber, MediaURL, KeyframeMotion, " +
174 "PhysicsShapeType, Density, GravityModifier, " +
175 "Friction, Restitution) values (" + "?UUID, " +
174 "?CreationDate, ?Name, ?Text, " + 176 "?CreationDate, ?Name, ?Text, " +
175 "?Description, ?SitName, ?TouchName, " + 177 "?Description, ?SitName, ?TouchName, " +
176 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + 178 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
@@ -201,7 +203,10 @@ namespace OpenSim.Data.MySQL
201 "?SaleType, ?ColorR, ?ColorG, " + 203 "?SaleType, ?ColorR, ?ColorG, " +
202 "?ColorB, ?ColorA, ?ParticleSystem, " + 204 "?ColorB, ?ColorA, ?ParticleSystem, " +
203 "?ClickAction, ?Material, ?CollisionSound, " + 205 "?ClickAction, ?Material, ?CollisionSound, " +
204 "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; 206 "?CollisionSoundVolume, ?PassTouches, " +
207 "?LinkNumber, ?MediaURL, ?KeyframeMotion, " +
208 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
209 "?Friction, ?Restitution)";
205 210
206 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 211 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
207 212
@@ -241,7 +246,7 @@ namespace OpenSim.Data.MySQL
241 } 246 }
242 } 247 }
243 248
244 public void RemoveObject(UUID obj, UUID regionUUID) 249 public virtual void RemoveObject(UUID obj, UUID regionUUID)
245 { 250 {
246// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); 251// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
247 252
@@ -390,7 +395,7 @@ namespace OpenSim.Data.MySQL
390 } 395 }
391 } 396 }
392 397
393 public List<SceneObjectGroup> LoadObjects(UUID regionID) 398 public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
394 { 399 {
395 const int ROWS_PER_QUERY = 5000; 400 const int ROWS_PER_QUERY = 5000;
396 401
@@ -446,7 +451,11 @@ namespace OpenSim.Data.MySQL
446 foreach (SceneObjectPart prim in prims.Values) 451 foreach (SceneObjectPart prim in prims.Values)
447 { 452 {
448 if (prim.ParentUUID == UUID.Zero) 453 if (prim.ParentUUID == UUID.Zero)
454 {
449 objects[prim.UUID] = new SceneObjectGroup(prim); 455 objects[prim.UUID] = new SceneObjectGroup(prim);
456 if (prim.KeyframeMotion != null)
457 prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
458 }
450 } 459 }
451 460
452 // Add all of the children objects to the SOGs 461 // Add all of the children objects to the SOGs
@@ -559,36 +568,51 @@ namespace OpenSim.Data.MySQL
559 } 568 }
560 } 569 }
561 570
562 public void StoreTerrain(double[,] ter, UUID regionID) 571 public virtual void StoreTerrain(double[,] ter, UUID regionID)
563 { 572 {
564 m_log.Info("[REGION DB]: Storing terrain"); 573 Util.FireAndForget(delegate(object x)
565
566 lock (m_dbLock)
567 { 574 {
568 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 575 double[,] oldTerrain = LoadTerrain(regionID);
569 {
570 dbcon.Open();
571 576
572 using (MySqlCommand cmd = dbcon.CreateCommand()) 577 m_log.Info("[REGION DB]: Storing terrain");
578
579 lock (m_dbLock)
580 {
581 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
573 { 582 {
574 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; 583 dbcon.Open();
575 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
576 584
577 ExecuteNonQuery(cmd); 585 using (MySqlCommand cmd = dbcon.CreateCommand())
586 {
587 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
588 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
578 589
579 cmd.CommandText = "insert into terrain (RegionUUID, " + 590 using (MySqlCommand cmd2 = dbcon.CreateCommand())
580 "Revision, Heightfield) values (?RegionUUID, " + 591 {
581 "1, ?Heightfield)"; 592 try
593 {
594 cmd2.CommandText = "insert into terrain (RegionUUID, " +
595 "Revision, Heightfield) values (?RegionUUID, " +
596 "1, ?Heightfield)";
582 597
583 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); 598 cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
599 cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain));
584 600
585 ExecuteNonQuery(cmd); 601 ExecuteNonQuery(cmd);
602 ExecuteNonQuery(cmd2);
603 }
604 catch (Exception e)
605 {
606 m_log.ErrorFormat(e.ToString());
607 }
608 }
609 }
586 } 610 }
587 } 611 }
588 } 612 });
589 } 613 }
590 614
591 public double[,] LoadTerrain(UUID regionID) 615 public virtual double[,] LoadTerrain(UUID regionID)
592 { 616 {
593 double[,] terrain = null; 617 double[,] terrain = null;
594 618
@@ -638,7 +662,7 @@ namespace OpenSim.Data.MySQL
638 return terrain; 662 return terrain;
639 } 663 }
640 664
641 public void RemoveLandObject(UUID globalID) 665 public virtual void RemoveLandObject(UUID globalID)
642 { 666 {
643 lock (m_dbLock) 667 lock (m_dbLock)
644 { 668 {
@@ -657,7 +681,7 @@ namespace OpenSim.Data.MySQL
657 } 681 }
658 } 682 }
659 683
660 public void StoreLandObject(ILandObject parcel) 684 public virtual void StoreLandObject(ILandObject parcel)
661 { 685 {
662 lock (m_dbLock) 686 lock (m_dbLock)
663 { 687 {
@@ -714,7 +738,7 @@ namespace OpenSim.Data.MySQL
714 } 738 }
715 } 739 }
716 740
717 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) 741 public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
718 { 742 {
719 RegionLightShareData nWP = new RegionLightShareData(); 743 RegionLightShareData nWP = new RegionLightShareData();
720 nWP.OnSave += StoreRegionWindlightSettings; 744 nWP.OnSave += StoreRegionWindlightSettings;
@@ -736,7 +760,7 @@ namespace OpenSim.Data.MySQL
736 { 760 {
737 //No result, so store our default windlight profile and return it 761 //No result, so store our default windlight profile and return it
738 nWP.regionID = regionUUID; 762 nWP.regionID = regionUUID;
739 StoreRegionWindlightSettings(nWP); 763 // StoreRegionWindlightSettings(nWP);
740 return nWP; 764 return nWP;
741 } 765 }
742 else 766 else
@@ -811,7 +835,7 @@ namespace OpenSim.Data.MySQL
811 return nWP; 835 return nWP;
812 } 836 }
813 837
814 public RegionSettings LoadRegionSettings(UUID regionUUID) 838 public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
815 { 839 {
816 RegionSettings rs = null; 840 RegionSettings rs = null;
817 841
@@ -851,7 +875,7 @@ namespace OpenSim.Data.MySQL
851 return rs; 875 return rs;
852 } 876 }
853 877
854 public void StoreRegionWindlightSettings(RegionLightShareData wl) 878 public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
855 { 879 {
856 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 880 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
857 { 881 {
@@ -954,7 +978,7 @@ namespace OpenSim.Data.MySQL
954 } 978 }
955 } 979 }
956 980
957 public void RemoveRegionWindlightSettings(UUID regionID) 981 public virtual void RemoveRegionWindlightSettings(UUID regionID)
958 { 982 {
959 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 983 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
960 { 984 {
@@ -969,7 +993,7 @@ namespace OpenSim.Data.MySQL
969 } 993 }
970 } 994 }
971 995
972 public void StoreRegionSettings(RegionSettings rs) 996 public virtual void StoreRegionSettings(RegionSettings rs)
973 { 997 {
974 lock (m_dbLock) 998 lock (m_dbLock)
975 { 999 {
@@ -996,7 +1020,7 @@ namespace OpenSim.Data.MySQL
996 "use_estate_sun, fixed_sun, sun_position, " + 1020 "use_estate_sun, fixed_sun, sun_position, " +
997 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + 1021 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
998 "sunvectorz, loaded_creation_datetime, " + 1022 "sunvectorz, loaded_creation_datetime, " +
999 "loaded_creation_id, map_tile_ID, " + 1023 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1000 "TelehubObject, parcel_tile_ID) " + 1024 "TelehubObject, parcel_tile_ID) " +
1001 "values (?RegionUUID, ?BlockTerraform, " + 1025 "values (?RegionUUID, ?BlockTerraform, " +
1002 "?BlockFly, ?AllowDamage, ?RestrictPushing, " + 1026 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
@@ -1013,7 +1037,8 @@ namespace OpenSim.Data.MySQL
1013 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + 1037 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1014 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1038 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1015 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1039 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1016 "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; 1040 "?TerrainImageID, ?block_search, ?casino, " +
1041 "?TelehubObject, ?ParcelImageID)";
1017 1042
1018 FillRegionSettingsCommand(cmd, rs); 1043 FillRegionSettingsCommand(cmd, rs);
1019 1044
@@ -1024,7 +1049,7 @@ namespace OpenSim.Data.MySQL
1024 SaveSpawnPoints(rs); 1049 SaveSpawnPoints(rs);
1025 } 1050 }
1026 1051
1027 public List<LandData> LoadLandObjects(UUID regionUUID) 1052 public virtual List<LandData> LoadLandObjects(UUID regionUUID)
1028 { 1053 {
1029 List<LandData> landData = new List<LandData>(); 1054 List<LandData> landData = new List<LandData>();
1030 1055
@@ -1211,6 +1236,25 @@ namespace OpenSim.Data.MySQL
1211 if (!(row["MediaURL"] is System.DBNull)) 1236 if (!(row["MediaURL"] is System.DBNull))
1212 prim.MediaUrl = (string)row["MediaURL"]; 1237 prim.MediaUrl = (string)row["MediaURL"];
1213 1238
1239 if (!(row["KeyframeMotion"] is DBNull))
1240 {
1241 Byte[] data = (byte[])row["KeyframeMotion"];
1242 if (data.Length > 0)
1243 prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
1244 else
1245 prim.KeyframeMotion = null;
1246 }
1247 else
1248 {
1249 prim.KeyframeMotion = null;
1250 }
1251
1252 prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
1253 prim.Density = (float)(double)row["Density"];
1254 prim.GravityModifier = (float)(double)row["GravityModifier"];
1255 prim.Friction = (float)(double)row["Friction"];
1256 prim.Bounciness = (float)(double)row["Restitution"];
1257
1214 return prim; 1258 return prim;
1215 } 1259 }
1216 1260
@@ -1304,6 +1348,9 @@ namespace OpenSim.Data.MySQL
1304 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); 1348 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
1305 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); 1349 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
1306 1350
1351 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
1352 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1353
1307 return newSettings; 1354 return newSettings;
1308 } 1355 }
1309 1356
@@ -1401,7 +1448,7 @@ namespace OpenSim.Data.MySQL
1401 /// </summary> 1448 /// </summary>
1402 /// <param name="val"></param> 1449 /// <param name="val"></param>
1403 /// <returns></returns> 1450 /// <returns></returns>
1404 private static Array SerializeTerrain(double[,] val) 1451 private static Array SerializeTerrain(double[,] val, double[,] oldTerrain)
1405 { 1452 {
1406 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); 1453 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
1407 BinaryWriter bw = new BinaryWriter(str); 1454 BinaryWriter bw = new BinaryWriter(str);
@@ -1410,7 +1457,11 @@ namespace OpenSim.Data.MySQL
1410 for (int x = 0; x < (int)Constants.RegionSize; x++) 1457 for (int x = 0; x < (int)Constants.RegionSize; x++)
1411 for (int y = 0; y < (int)Constants.RegionSize; y++) 1458 for (int y = 0; y < (int)Constants.RegionSize; y++)
1412 { 1459 {
1413 double height = val[x, y]; 1460 double height = 20.0;
1461 if (oldTerrain != null)
1462 height = oldTerrain[x, y];
1463 if (!double.IsNaN(val[x, y]))
1464 height = val[x, y];
1414 if (height == 0.0) 1465 if (height == 0.0)
1415 height = double.Epsilon; 1466 height = double.Epsilon;
1416 1467
@@ -1556,6 +1607,17 @@ namespace OpenSim.Data.MySQL
1556 1607
1557 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1608 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1558 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1609 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1610
1611 if (prim.KeyframeMotion != null)
1612 cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
1613 else
1614 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1615
1616 cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
1617 cmd.Parameters.AddWithValue("Density", (double)prim.Density);
1618 cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
1619 cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
1620 cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness);
1559 } 1621 }
1560 1622
1561 /// <summary> 1623 /// <summary>
@@ -1634,6 +1696,9 @@ namespace OpenSim.Data.MySQL
1634 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1696 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1635 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1697 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1636 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1698 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1699 cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
1700 cmd.Parameters.AddWithValue("casino", settings.Casino);
1701
1637 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1702 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1638 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1703 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
1639 } 1704 }
@@ -1794,7 +1859,7 @@ namespace OpenSim.Data.MySQL
1794 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); 1859 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
1795 } 1860 }
1796 1861
1797 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1862 public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1798 { 1863 {
1799 lock (m_dbLock) 1864 lock (m_dbLock)
1800 { 1865 {
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index aa69d68..a18ac66 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,18 +70,33 @@ 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] + "%");
82 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
83 }
84
85 return DoQuery(cmd);
86 }
87
88 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
89 {
90 MySqlCommand cmd = new MySqlCommand();
91
92 if (scopeID != UUID.Zero)
93 {
94 where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")";
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 95 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
79 } 96 }
80 97
98 cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm);
99
81 return DoQuery(cmd); 100 return DoQuery(cmd);
82 } 101 }
83 } 102 }
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 099beaf..ef99ef8 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -717,7 +717,7 @@ ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT
717 717
718COMMIT; 718COMMIT;
719 719
720:VERSION 32 720:VERSION 32 #---------------------
721 721
722BEGIN; 722BEGIN;
723CREATE TABLE `regionwindlight` ( 723CREATE TABLE `regionwindlight` (
@@ -883,4 +883,3 @@ ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL
883 883
884COMMIT; 884COMMIT;
885 885
886
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/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}