aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs14
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs40
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs73
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs314
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs40
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs24
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs2
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations3
10 files changed, 366 insertions, 153 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs b/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs
index ed0ab98..17f1374 100644
--- a/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs
+++ b/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 5d8da17..76b1e38 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -154,7 +154,7 @@ namespace OpenSim.Data.MySQL
154 /// </summary> 154 /// </summary>
155 /// <param name="asset">Asset UUID to create</param> 155 /// <param name="asset">Asset UUID to create</param>
156 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> 156 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
157 override public void StoreAsset(AssetBase asset) 157 override public bool StoreAsset(AssetBase asset)
158 { 158 {
159 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 159 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
160 { 160 {
@@ -202,15 +202,15 @@ namespace OpenSim.Data.MySQL
202 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); 202 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
203 cmd.Parameters.AddWithValue("?data", asset.Data); 203 cmd.Parameters.AddWithValue("?data", asset.Data);
204 cmd.ExecuteNonQuery(); 204 cmd.ExecuteNonQuery();
205 return true;
205 } 206 }
206 } 207 }
208
207 catch (Exception e) 209 catch (Exception e)
208 { 210 {
209 m_log.Error( 211 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
210 string.Format( 212 asset.FullID, asset.Name, e.Message);
211 "[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ", 213 return false;
212 asset.FullID, asset.Name)
213 , e);
214 } 214 }
215 } 215 }
216 } 216 }
@@ -364,4 +364,4 @@ namespace OpenSim.Data.MySQL
364 364
365 #endregion 365 #endregion
366 } 366 }
367} \ No newline at end of file 367}
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index 5820a90..34791cf 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -45,27 +45,45 @@ namespace OpenSim.Data.MySQL
45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected string m_connectionString; 47 protected string m_connectionString;
48 protected object m_dbLock = new object();
48 49
49 protected MySqlFramework(string connectionString) 50 protected MySqlFramework(string connectionString)
50 { 51 {
51 m_connectionString = connectionString; 52 m_connectionString = connectionString;
52 } 53 }
53 54
55 //////////////////////////////////////////////////////////////
56 //
57 // All non queries are funneled through one connection
58 // to increase performance a little
59 //
54 protected int ExecuteNonQuery(MySqlCommand cmd) 60 protected int ExecuteNonQuery(MySqlCommand cmd)
55 { 61 {
56 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 62 lock (m_dbLock)
57 { 63 {
58 dbcon.Open(); 64 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
59 cmd.Connection = dbcon;
60
61 try
62 {
63 return cmd.ExecuteNonQuery();
64 }
65 catch (Exception e)
66 { 65 {
67 m_log.Error(e.Message, e); 66 try
68 return 0; 67 {
68 dbcon.Open();
69 cmd.Connection = dbcon;
70
71 try
72 {
73 return cmd.ExecuteNonQuery();
74 }
75 catch (Exception e)
76 {
77 m_log.Error(e.Message, e);
78 m_log.Error(Environment.StackTrace.ToString());
79 return 0;
80 }
81 }
82 catch (Exception e)
83 {
84 m_log.Error(e.Message, e);
85 return 0;
86 }
69 } 87 }
70 } 88 }
71 } 89 }
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 35fa89f..dc657c8 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -175,6 +175,11 @@ namespace OpenSim.Data.MySQL
175 int v = Convert.ToInt32(reader[name]); 175 int v = Convert.ToInt32(reader[name]);
176 m_Fields[name].SetValue(row, v); 176 m_Fields[name].SetValue(row, v);
177 } 177 }
178 else if (m_Fields[name].FieldType == typeof(uint))
179 {
180 uint v = Convert.ToUInt32(reader[name]);
181 m_Fields[name].SetValue(row, v);
182 }
178 else 183 else
179 { 184 {
180 m_Fields[name].SetValue(row, reader[name]); 185 m_Fields[name].SetValue(row, reader[name]);
@@ -362,4 +367,4 @@ namespace OpenSim.Data.MySQL
362 } 367 }
363 368
364 } 369 }
365} \ No newline at end of file 370}
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 2ad7590..3dc049b 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Data.MySQL
82 82
83 public RegionData Get(int posX, int posY, UUID scopeID) 83 public RegionData Get(int posX, int posY, UUID scopeID)
84 { 84 {
85/* fixed size regions
85 string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY"; 86 string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
86 if (scopeID != UUID.Zero) 87 if (scopeID != UUID.Zero)
87 command += " and ScopeID = ?scopeID"; 88 command += " and ScopeID = ?scopeID";
@@ -98,6 +99,45 @@ namespace OpenSim.Data.MySQL
98 99
99 return ret[0]; 100 return ret[0];
100 } 101 }
102*/
103 // extend database search for maximum region size area
104 string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
105 if (scopeID != UUID.Zero)
106 command += " and ScopeID = ?scopeID";
107
108 int startX = posX - (int)Constants.MaximumRegionSize;
109 int startY = posY - (int)Constants.MaximumRegionSize;
110 int endX = posX;
111 int endY = posY;
112
113 List<RegionData> ret;
114 using (MySqlCommand cmd = new MySqlCommand(command))
115 {
116 cmd.Parameters.AddWithValue("?startX", startX.ToString());
117 cmd.Parameters.AddWithValue("?startY", startY.ToString());
118 cmd.Parameters.AddWithValue("?endX", endX.ToString());
119 cmd.Parameters.AddWithValue("?endY", endY.ToString());
120 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
121
122 ret = RunCommand(cmd);
123 }
124
125 if (ret.Count == 0)
126 return null;
127
128 // find the first that contains pos
129 RegionData rg = null;
130 foreach (RegionData r in ret)
131 {
132 if (posX >= r.posX && posX < r.posX + r.sizeX
133 && posY >= r.posY && posY < r.posY + r.sizeY)
134 {
135 rg = r;
136 break;
137 }
138 }
139
140 return rg;
101 } 141 }
102 142
103 public RegionData Get(UUID regionID, UUID scopeID) 143 public RegionData Get(UUID regionID, UUID scopeID)
@@ -121,6 +161,7 @@ namespace OpenSim.Data.MySQL
121 161
122 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) 162 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
123 { 163 {
164/* fix size regions
124 string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY"; 165 string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY";
125 if (scopeID != UUID.Zero) 166 if (scopeID != UUID.Zero)
126 command += " and ScopeID = ?scopeID"; 167 command += " and ScopeID = ?scopeID";
@@ -135,6 +176,38 @@ namespace OpenSim.Data.MySQL
135 176
136 return RunCommand(cmd); 177 return RunCommand(cmd);
137 } 178 }
179 */
180 string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
181 if (scopeID != UUID.Zero)
182 command += " and ScopeID = ?scopeID";
183
184 int qstartX = startX - (int)Constants.MaximumRegionSize;
185 int qstartY = startY - (int)Constants.MaximumRegionSize;
186
187 List<RegionData> dbret;
188 using (MySqlCommand cmd = new MySqlCommand(command))
189 {
190 cmd.Parameters.AddWithValue("?startX", qstartX.ToString());
191 cmd.Parameters.AddWithValue("?startY", qstartY.ToString());
192 cmd.Parameters.AddWithValue("?endX", endX.ToString());
193 cmd.Parameters.AddWithValue("?endY", endY.ToString());
194 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
195
196 dbret = RunCommand(cmd);
197 }
198
199 List<RegionData> ret = new List<RegionData>();
200
201 if (dbret.Count == 0)
202 return ret;
203
204 foreach (RegionData r in dbret)
205 {
206 if (r.posX + r.sizeX > startX && r.posX <= endX
207 && r.posY + r.sizeX > startY && r.posY <= endY)
208 ret.Add(r);
209 }
210 return ret;
138 } 211 }
139 212
140 public List<RegionData> RunCommand(MySqlCommand cmd) 213 public List<RegionData> RunCommand(MySqlCommand cmd)
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index bb0ab75..a62d347 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Data.MySQL
76 Initialise(connectionString); 76 Initialise(connectionString);
77 } 77 }
78 78
79 public void Initialise(string connectionString) 79 public virtual void Initialise(string connectionString)
80 { 80 {
81 m_connectionString = connectionString; 81 m_connectionString = connectionString;
82 82
@@ -123,7 +123,7 @@ namespace OpenSim.Data.MySQL
123 123
124 public void Dispose() {} 124 public void Dispose() {}
125 125
126 public void StoreObject(SceneObjectGroup obj, UUID regionUUID) 126 public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
127 { 127 {
128 uint flags = obj.RootPart.GetEffectiveObjectFlags(); 128 uint flags = obj.RootPart.GetEffectiveObjectFlags();
129 129
@@ -183,10 +183,11 @@ namespace OpenSim.Data.MySQL
183 "ParticleSystem, ClickAction, Material, " + 183 "ParticleSystem, ClickAction, Material, " +
184 "CollisionSound, CollisionSoundVolume, " + 184 "CollisionSound, CollisionSoundVolume, " +
185 "PassTouches, " + 185 "PassTouches, " +
186 "LinkNumber, MediaURL, AttachedPosX, " + 186 "PassCollisions, " +
187 "AttachedPosY, AttachedPosZ, KeyframeMotion, " + 187 "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
188 "AttachedPosY, AttachedPosZ, " +
188 "PhysicsShapeType, Density, GravityModifier, " + 189 "PhysicsShapeType, Density, GravityModifier, " +
189 "Friction, Restitution, DynAttrs " + 190 "Friction, Restitution, Vehicle, DynAttrs " +
190 ") values (" + "?UUID, " + 191 ") values (" + "?UUID, " +
191 "?CreationDate, ?Name, ?Text, " + 192 "?CreationDate, ?Name, ?Text, " +
192 "?Description, ?SitName, ?TouchName, " + 193 "?Description, ?SitName, ?TouchName, " +
@@ -218,11 +219,11 @@ namespace OpenSim.Data.MySQL
218 "?SaleType, ?ColorR, ?ColorG, " + 219 "?SaleType, ?ColorR, ?ColorG, " +
219 "?ColorB, ?ColorA, ?ParticleSystem, " + 220 "?ColorB, ?ColorA, ?ParticleSystem, " +
220 "?ClickAction, ?Material, ?CollisionSound, " + 221 "?ClickAction, ?Material, ?CollisionSound, " +
221 "?CollisionSoundVolume, ?PassTouches, " + 222 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
222 "?LinkNumber, ?MediaURL, ?AttachedPosX, " + 223 "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
223 "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " + 224 "?AttachedPosY, ?AttachedPosZ, " +
224 "?PhysicsShapeType, ?Density, ?GravityModifier, " + 225 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
225 "?Friction, ?Restitution, ?DynAttrs)"; 226 "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)";
226 227
227 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 228 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
228 229
@@ -262,7 +263,7 @@ namespace OpenSim.Data.MySQL
262 } 263 }
263 } 264 }
264 265
265 public void RemoveObject(UUID obj, UUID regionUUID) 266 public virtual void RemoveObject(UUID obj, UUID regionUUID)
266 { 267 {
267// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); 268// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
268 269
@@ -317,7 +318,8 @@ namespace OpenSim.Data.MySQL
317 /// <param name="uuid">the Item UUID</param> 318 /// <param name="uuid">the Item UUID</param>
318 private void RemoveItems(UUID uuid) 319 private void RemoveItems(UUID uuid)
319 { 320 {
320 lock (m_dbLock) 321 // locked by caller
322// lock (m_dbLock)
321 { 323 {
322 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 324 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
323 { 325 {
@@ -411,7 +413,7 @@ namespace OpenSim.Data.MySQL
411 } 413 }
412 } 414 }
413 415
414 public List<SceneObjectGroup> LoadObjects(UUID regionID) 416 public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
415 { 417 {
416 const int ROWS_PER_QUERY = 5000; 418 const int ROWS_PER_QUERY = 5000;
417 419
@@ -590,40 +592,53 @@ namespace OpenSim.Data.MySQL
590 592
591 public void StoreTerrain(TerrainData terrData, UUID regionID) 593 public void StoreTerrain(TerrainData terrData, UUID regionID)
592 { 594 {
593 lock (m_dbLock) 595 Util.FireAndForget(delegate(object x)
594 { 596 {
595 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 597 m_log.Info("[REGION DB]: Storing terrain");
596 {
597 dbcon.Open();
598 598
599 using (MySqlCommand cmd = dbcon.CreateCommand()) 599 lock (m_dbLock)
600 {
601 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
600 { 602 {
601 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; 603 dbcon.Open();
602 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
603 604
604 ExecuteNonQuery(cmd); 605 using (MySqlCommand cmd = dbcon.CreateCommand())
605 606 {
606 int terrainDBRevision; 607 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
607 Array terrainDBblob; 608 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
608 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
609 609
610 m_log.InfoFormat("{0} Storing terrain. X={1}, Y={2}, rev={3}", 610 using (MySqlCommand cmd2 = dbcon.CreateCommand())
611 LogHeader, terrData.SizeX, terrData.SizeY, terrainDBRevision); 611 {
612 try
613 {
614 cmd2.CommandText = "insert into terrain (RegionUUID, " +
615 "Revision, Heightfield) values (?RegionUUID, " +
616 "?Revision, ?Heightfield)";
612 617
613 cmd.CommandText = "insert into terrain (RegionUUID, Revision, Heightfield)" 618 int terrainDBRevision;
614 + "values (?RegionUUID, ?Revision, ?Heightfield)"; 619 Array terrainDBblob;
620 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
615 621
616 cmd.Parameters.AddWithValue("Revision", terrainDBRevision); 622 cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
617 cmd.Parameters.AddWithValue("Heightfield", terrainDBblob); 623 cmd2.Parameters.AddWithValue("Revision", terrainDBRevision);
624 cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob);
618 625
619 ExecuteNonQuery(cmd); 626 ExecuteNonQuery(cmd);
627 ExecuteNonQuery(cmd2);
628 }
629 catch (Exception e)
630 {
631 m_log.ErrorFormat(e.ToString());
632 }
633 }
634 }
620 } 635 }
621 } 636 }
622 } 637 });
623 } 638 }
624 639
625 // Legacy region loading 640 // Legacy region loading
626 public double[,] LoadTerrain(UUID regionID) 641 public virtual double[,] LoadTerrain(UUID regionID)
627 { 642 {
628 double[,] ret = null; 643 double[,] ret = null;
629 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); 644 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
@@ -655,8 +670,11 @@ namespace OpenSim.Data.MySQL
655 while (reader.Read()) 670 while (reader.Read())
656 { 671 {
657 int rev = Convert.ToInt32(reader["Revision"]); 672 int rev = Convert.ToInt32(reader["Revision"]);
658 byte[] blob = (byte[])reader["Heightfield"]; 673 if ((reader["Heightfield"] != DBNull.Value))
659 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); 674 {
675 byte[] blob = (byte[])reader["Heightfield"];
676 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
677 }
660 } 678 }
661 } 679 }
662 } 680 }
@@ -666,7 +684,7 @@ namespace OpenSim.Data.MySQL
666 return terrData; 684 return terrData;
667 } 685 }
668 686
669 public void RemoveLandObject(UUID globalID) 687 public virtual void RemoveLandObject(UUID globalID)
670 { 688 {
671 lock (m_dbLock) 689 lock (m_dbLock)
672 { 690 {
@@ -685,7 +703,7 @@ namespace OpenSim.Data.MySQL
685 } 703 }
686 } 704 }
687 705
688 public void StoreLandObject(ILandObject parcel) 706 public virtual void StoreLandObject(ILandObject parcel)
689 { 707 {
690 lock (m_dbLock) 708 lock (m_dbLock)
691 { 709 {
@@ -705,7 +723,8 @@ namespace OpenSim.Data.MySQL
705 "UserLocationX, UserLocationY, UserLocationZ, " + 723 "UserLocationX, UserLocationY, UserLocationZ, " +
706 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 724 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
707 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + 725 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
708 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + 726 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
727 "SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
709 "?UUID, ?RegionUUID, " + 728 "?UUID, ?RegionUUID, " +
710 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 729 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
711 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + 730 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@@ -716,7 +735,8 @@ namespace OpenSim.Data.MySQL
716 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 735 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
717 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 736 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
718 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ 737 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
719 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; 738 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " +
739 "?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)";
720 740
721 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 741 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
722 742
@@ -742,7 +762,7 @@ namespace OpenSim.Data.MySQL
742 } 762 }
743 } 763 }
744 764
745 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) 765 public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
746 { 766 {
747 RegionLightShareData nWP = new RegionLightShareData(); 767 RegionLightShareData nWP = new RegionLightShareData();
748 nWP.OnSave += StoreRegionWindlightSettings; 768 nWP.OnSave += StoreRegionWindlightSettings;
@@ -840,7 +860,7 @@ namespace OpenSim.Data.MySQL
840 return nWP; 860 return nWP;
841 } 861 }
842 862
843 public RegionSettings LoadRegionSettings(UUID regionUUID) 863 public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
844 { 864 {
845 RegionSettings rs = null; 865 RegionSettings rs = null;
846 866
@@ -880,7 +900,7 @@ namespace OpenSim.Data.MySQL
880 return rs; 900 return rs;
881 } 901 }
882 902
883 public void StoreRegionWindlightSettings(RegionLightShareData wl) 903 public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
884 { 904 {
885 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 905 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
886 { 906 {
@@ -983,7 +1003,7 @@ namespace OpenSim.Data.MySQL
983 } 1003 }
984 } 1004 }
985 1005
986 public void RemoveRegionWindlightSettings(UUID regionID) 1006 public virtual void RemoveRegionWindlightSettings(UUID regionID)
987 { 1007 {
988 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1008 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
989 { 1009 {
@@ -1060,7 +1080,7 @@ namespace OpenSim.Data.MySQL
1060 } 1080 }
1061 #endregion 1081 #endregion
1062 1082
1063 public void StoreRegionSettings(RegionSettings rs) 1083 public virtual void StoreRegionSettings(RegionSettings rs)
1064 { 1084 {
1065 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1085 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1066 { 1086 {
@@ -1069,52 +1089,51 @@ namespace OpenSim.Data.MySQL
1069 using (MySqlCommand cmd = dbcon.CreateCommand()) 1089 using (MySqlCommand cmd = dbcon.CreateCommand())
1070 { 1090 {
1071 cmd.CommandText = "replace into regionsettings (regionUUID, " + 1091 cmd.CommandText = "replace into regionsettings (regionUUID, " +
1072 "block_terraform, block_fly, allow_damage, " + 1092 "block_terraform, block_fly, allow_damage, " +
1073 "restrict_pushing, allow_land_resell, " + 1093 "restrict_pushing, allow_land_resell, " +
1074 "allow_land_join_divide, block_show_in_search, " + 1094 "allow_land_join_divide, block_show_in_search, " +
1075 "agent_limit, object_bonus, maturity, " + 1095 "agent_limit, object_bonus, maturity, " +
1076 "disable_scripts, disable_collisions, " + 1096 "disable_scripts, disable_collisions, " +
1077 "disable_physics, terrain_texture_1, " + 1097 "disable_physics, terrain_texture_1, " +
1078 "terrain_texture_2, terrain_texture_3, " + 1098 "terrain_texture_2, terrain_texture_3, " +
1079 "terrain_texture_4, elevation_1_nw, " + 1099 "terrain_texture_4, elevation_1_nw, " +
1080 "elevation_2_nw, elevation_1_ne, " + 1100 "elevation_2_nw, elevation_1_ne, " +
1081 "elevation_2_ne, elevation_1_se, " + 1101 "elevation_2_ne, elevation_1_se, " +
1082 "elevation_2_se, elevation_1_sw, " + 1102 "elevation_2_se, elevation_1_sw, " +
1083 "elevation_2_sw, water_height, " + 1103 "elevation_2_sw, water_height, " +
1084 "terrain_raise_limit, terrain_lower_limit, " + 1104 "terrain_raise_limit, terrain_lower_limit, " +
1085 "use_estate_sun, fixed_sun, sun_position, " + 1105 "use_estate_sun, fixed_sun, sun_position, " +
1086 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + 1106 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1087 "sunvectorz, loaded_creation_datetime, " + 1107 "sunvectorz, loaded_creation_datetime, " +
1088 "loaded_creation_id, map_tile_ID, " + 1108 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1089 "TelehubObject, parcel_tile_ID) " + 1109 "TelehubObject, parcel_tile_ID) " +
1090 "values (?RegionUUID, ?BlockTerraform, " + 1110 "values (?RegionUUID, ?BlockTerraform, " +
1091 "?BlockFly, ?AllowDamage, ?RestrictPushing, " + 1111 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
1092 "?AllowLandResell, ?AllowLandJoinDivide, " + 1112 "?AllowLandResell, ?AllowLandJoinDivide, " +
1093 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + 1113 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
1094 "?Maturity, ?DisableScripts, ?DisableCollisions, " + 1114 "?Maturity, ?DisableScripts, ?DisableCollisions, " +
1095 "?DisablePhysics, ?TerrainTexture1, " + 1115 "?DisablePhysics, ?TerrainTexture1, " +
1096 "?TerrainTexture2, ?TerrainTexture3, " + 1116 "?TerrainTexture2, ?TerrainTexture3, " +
1097 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + 1117 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
1098 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + 1118 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
1099 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + 1119 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
1100 "?WaterHeight, ?TerrainRaiseLimit, " + 1120 "?WaterHeight, ?TerrainRaiseLimit, " +
1101 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + 1121 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
1102 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + 1122 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1103 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1123 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1104 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1124 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1105 "?TerrainImageID, " + 1125 "?TerrainImageID, ?block_search, ?casino, " +
1106 "?TelehubObject, ?ParcelImageID)"; 1126 "?TelehubObject, ?ParcelImageID)";
1107 1127
1108 FillRegionSettingsCommand(cmd, rs); 1128 FillRegionSettingsCommand(cmd, rs);
1109
1110 ExecuteNonQuery(cmd); 1129 ExecuteNonQuery(cmd);
1111 } 1130 }
1112 }
1113 1131
1114 SaveSpawnPoints(rs); 1132 SaveSpawnPoints(rs);
1133 }
1115 } 1134 }
1116 1135
1117 public List<LandData> LoadLandObjects(UUID regionUUID) 1136 public virtual List<LandData> LoadLandObjects(UUID regionUUID)
1118 { 1137 {
1119 List<LandData> landData = new List<LandData>(); 1138 List<LandData> landData = new List<LandData>();
1120 1139
@@ -1296,6 +1315,7 @@ namespace OpenSim.Data.MySQL
1296 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; 1315 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
1297 1316
1298 prim.PassTouches = ((sbyte)row["PassTouches"] != 0); 1317 prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
1318 prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
1299 prim.LinkNum = (int)row["LinkNumber"]; 1319 prim.LinkNum = (int)row["LinkNumber"];
1300 1320
1301 if (!(row["MediaURL"] is System.DBNull)) 1321 if (!(row["MediaURL"] is System.DBNull))
@@ -1334,6 +1354,15 @@ namespace OpenSim.Data.MySQL
1334 prim.Friction = (float)(double)row["Friction"]; 1354 prim.Friction = (float)(double)row["Friction"];
1335 prim.Restitution = (float)(double)row["Restitution"]; 1355 prim.Restitution = (float)(double)row["Restitution"];
1336 1356
1357 SOPVehicle vehicle = null;
1358
1359 if (row["Vehicle"].ToString() != String.Empty)
1360 {
1361 vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
1362 if (vehicle != null)
1363 prim.VehicleParams = vehicle;
1364 }
1365
1337 return prim; 1366 return prim;
1338 } 1367 }
1339 1368
@@ -1344,32 +1373,40 @@ namespace OpenSim.Data.MySQL
1344 /// <returns></returns> 1373 /// <returns></returns>
1345 private static TaskInventoryItem BuildItem(IDataReader row) 1374 private static TaskInventoryItem BuildItem(IDataReader row)
1346 { 1375 {
1347 TaskInventoryItem taskItem = new TaskInventoryItem(); 1376 try
1348 1377 {
1349 taskItem.ItemID = DBGuid.FromDB(row["itemID"]); 1378 TaskInventoryItem taskItem = new TaskInventoryItem();
1350 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); 1379
1351 taskItem.AssetID = DBGuid.FromDB(row["assetID"]); 1380 taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
1352 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); 1381 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
1353 1382 taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
1354 taskItem.InvType = Convert.ToInt32(row["invType"]); 1383 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
1355 taskItem.Type = Convert.ToInt32(row["assetType"]); 1384
1356 1385 taskItem.InvType = Convert.ToInt32(row["invType"]);
1357 taskItem.Name = (String)row["name"]; 1386 taskItem.Type = Convert.ToInt32(row["assetType"]);
1358 taskItem.Description = (String)row["description"]; 1387
1359 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); 1388 taskItem.Name = (String)row["name"];
1360 taskItem.CreatorIdentification = (String)row["creatorID"]; 1389 taskItem.Description = (String)row["description"];
1361 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); 1390 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
1362 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); 1391 taskItem.CreatorIdentification = (String)row["creatorID"];
1363 taskItem.GroupID = DBGuid.FromDB(row["groupID"]); 1392 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
1364 1393 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
1365 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); 1394 taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
1366 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); 1395
1367 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); 1396 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
1368 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); 1397 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
1369 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); 1398 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
1370 taskItem.Flags = Convert.ToUInt32(row["flags"]); 1399 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
1371 1400 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
1372 return taskItem; 1401 taskItem.Flags = Convert.ToUInt32(row["flags"]);
1402
1403 return taskItem;
1404 }
1405 catch
1406 {
1407 m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString());
1408 throw;
1409 }
1373 } 1410 }
1374 1411
1375 private static RegionSettings BuildRegionSettings(IDataReader row) 1412 private static RegionSettings BuildRegionSettings(IDataReader row)
@@ -1427,6 +1464,9 @@ namespace OpenSim.Data.MySQL
1427 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); 1464 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
1428 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); 1465 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
1429 1466
1467 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
1468 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1469
1430 return newSettings; 1470 return newSettings;
1431 } 1471 }
1432 1472
@@ -1503,6 +1543,13 @@ namespace OpenSim.Data.MySQL
1503 1543
1504 newData.ParcelAccessList = new List<LandAccessEntry>(); 1544 newData.ParcelAccessList = new List<LandAccessEntry>();
1505 1545
1546 if (!(row["SeeAVs"] is System.DBNull))
1547 newData.SeeAVs = Convert.ToInt32(row["SeeAVs"]) != 0 ? true : false;
1548 if (!(row["AnyAVSounds"] is System.DBNull))
1549 newData.AnyAVSounds = Convert.ToInt32(row["AnyAVSounds"]) != 0 ? true : false;
1550 if (!(row["GroupAVSounds"] is System.DBNull))
1551 newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false;
1552
1506 return newData; 1553 return newData;
1507 } 1554 }
1508 1555
@@ -1654,6 +1701,11 @@ namespace OpenSim.Data.MySQL
1654 else 1701 else
1655 cmd.Parameters.AddWithValue("PassTouches", 0); 1702 cmd.Parameters.AddWithValue("PassTouches", 0);
1656 1703
1704 if (prim.PassCollisions)
1705 cmd.Parameters.AddWithValue("PassCollisions", 1);
1706 else
1707 cmd.Parameters.AddWithValue("PassCollisions", 0);
1708
1657 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1709 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1658 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1710 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1659 if (prim.AttachedPos != null) 1711 if (prim.AttachedPos != null)
@@ -1668,6 +1720,11 @@ namespace OpenSim.Data.MySQL
1668 else 1720 else
1669 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); 1721 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1670 1722
1723 if (prim.VehicleParams != null)
1724 cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
1725 else
1726 cmd.Parameters.AddWithValue("Vehicle", String.Empty);
1727
1671 if (prim.DynAttrs.CountNamespaces > 0) 1728 if (prim.DynAttrs.CountNamespaces > 0)
1672 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); 1729 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1673 else 1730 else
@@ -1756,6 +1813,8 @@ namespace OpenSim.Data.MySQL
1756 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1813 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1757 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1814 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1758 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1815 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1816 cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
1817 cmd.Parameters.AddWithValue("casino", settings.Casino);
1759 1818
1760 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1819 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1761 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1820 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
@@ -1813,6 +1872,10 @@ namespace OpenSim.Data.MySQL
1813 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); 1872 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
1814 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); 1873 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
1815 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); 1874 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
1875 cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0);
1876 cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0);
1877 cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0);
1878
1816 } 1879 }
1817 1880
1818 /// <summary> 1881 /// <summary>
@@ -1919,7 +1982,7 @@ namespace OpenSim.Data.MySQL
1919 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); 1982 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
1920 } 1983 }
1921 1984
1922 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1985 public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1923 { 1986 {
1924 lock (m_dbLock) 1987 lock (m_dbLock)
1925 { 1988 {
@@ -1963,6 +2026,37 @@ namespace OpenSim.Data.MySQL
1963 } 2026 }
1964 } 2027 }
1965 2028
2029 public UUID[] GetObjectIDs(UUID regionID)
2030 {
2031 List<UUID> uuids = new List<UUID>();
2032
2033 lock (m_dbLock)
2034 {
2035 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2036 {
2037 dbcon.Open();
2038
2039 using (MySqlCommand cmd = dbcon.CreateCommand())
2040 {
2041 cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID";
2042 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
2043
2044 using (IDataReader reader = ExecuteReader(cmd))
2045 {
2046 while (reader.Read())
2047 {
2048 UUID id = new UUID(reader["UUID"].ToString());
2049
2050 uuids.Add(id);
2051 }
2052 }
2053 }
2054 }
2055 }
2056
2057 return uuids.ToArray();
2058 }
2059
1966 private void LoadSpawnPoints(RegionSettings rs) 2060 private void LoadSpawnPoints(RegionSettings rs)
1967 { 2061 {
1968 rs.ClearSpawnPoints(); 2062 rs.ClearSpawnPoints();
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index e964295..59cfe70 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL
46 { 46 {
47 string[] words = query.Split(new char[] {' '}); 47 string[] words = query.Split(new char[] {' '});
48 48
49 bool valid = false;
50
49 for (int i = 0 ; i < words.Length ; i++) 51 for (int i = 0 ; i < words.Length ; i++)
50 { 52 {
51 if (words[i].Length < 3) 53 if (words[i].Length > 2)
52 { 54 valid = true;
53 if (i != words.Length - 1) 55// if (words[i].Length < 3)
54 Array.Copy(words, i + 1, words, i, words.Length - i - 1); 56// {
55 Array.Resize(ref words, words.Length - 1); 57// if (i != words.Length - 1)
56 } 58// Array.Copy(words, i + 1, words, i, words.Length - i - 1);
59// Array.Resize(ref words, words.Length - 1);
60// }
57 } 61 }
58 62
59 if (words.Length == 0) 63 if ((!valid) || words.Length == 0)
60 return new UserAccountData[0]; 64 return new UserAccountData[0];
61 65
62 if (words.Length > 2) 66 if (words.Length > 2)
@@ -66,13 +70,13 @@ namespace OpenSim.Data.MySQL
66 { 70 {
67 if (words.Length == 1) 71 if (words.Length == 1)
68 { 72 {
69 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm); 73 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm);
70 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); 74 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
71 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 75 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
72 } 76 }
73 else 77 else
74 { 78 {
75 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm); 79 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm);
76 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); 80 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
77 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); 81 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 82 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
@@ -81,5 +85,21 @@ namespace OpenSim.Data.MySQL
81 return DoQuery(cmd); 85 return DoQuery(cmd);
82 } 86 }
83 } 87 }
88
89 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
90 {
91 using (MySqlCommand cmd = new MySqlCommand())
92 {
93 if (scopeID != UUID.Zero)
94 {
95 where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")";
96 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
97 }
98
99 cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm);
100
101 return DoQuery(cmd);
102 }
103 }
84 } 104 }
85} \ No newline at end of file 105}
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index b35595d..295e131 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -631,6 +631,8 @@ namespace OpenSim.Data.MySQL
631 { 631 {
632 if(reader.HasRows) 632 if(reader.HasRows)
633 { 633 {
634 m_log.DebugFormat("[PROFILES_DATA]" +
635 ": Getting data for {0}.", props.UserId);
634 reader.Read(); 636 reader.Read();
635 props.WebUrl = (string)reader["profileURL"]; 637 props.WebUrl = (string)reader["profileURL"];
636 UUID.TryParse((string)reader["profileImage"], out props.ImageId); 638 UUID.TryParse((string)reader["profileImage"], out props.ImageId);
@@ -646,6 +648,9 @@ namespace OpenSim.Data.MySQL
646 } 648 }
647 else 649 else
648 { 650 {
651 m_log.DebugFormat("[PROFILES_DATA]" +
652 ": No data for {0}", props.UserId);
653
649 props.WebUrl = string.Empty; 654 props.WebUrl = string.Empty;
650 props.ImageId = UUID.Zero; 655 props.ImageId = UUID.Zero;
651 props.AboutText = string.Empty; 656 props.AboutText = string.Empty;
@@ -894,13 +899,13 @@ namespace OpenSim.Data.MySQL
894 public bool GetUserPreferences(ref UserPreferences pref, ref string result) 899 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
895 { 900 {
896 string query = string.Empty; 901 string query = string.Empty;
897 902
898 query += "SELECT imviaemail,visible,email FROM "; 903 query += "SELECT imviaemail,visible,email FROM ";
899 query += "usersettings WHERE "; 904 query += "usersettings WHERE ";
900 query += "useruuid = ?Id"; 905 query += "useruuid = ?Id";
901 906
902 OSDArray data = new OSDArray(); 907 OSDArray data = new OSDArray();
903 908
904 try 909 try
905 { 910 {
906 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) 911 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -909,10 +914,9 @@ namespace OpenSim.Data.MySQL
909 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 914 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
910 { 915 {
911 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); 916 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
912
913 using (MySqlDataReader reader = cmd.ExecuteReader()) 917 using (MySqlDataReader reader = cmd.ExecuteReader())
914 { 918 {
915 if(reader.HasRows) 919 if (reader.HasRows)
916 { 920 {
917 reader.Read(); 921 reader.Read();
918 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); 922 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
@@ -923,13 +927,13 @@ namespace OpenSim.Data.MySQL
923 { 927 {
924 dbcon.Close(); 928 dbcon.Close();
925 dbcon.Open(); 929 dbcon.Open();
926 930
927 query = "INSERT INTO usersettings VALUES "; 931 query = "INSERT INTO usersettings VALUES ";
928 query += "(?uuid,'false','false', ?Email)"; 932 query += "(?uuid,'false','false', ?Email)";
929 933
930 using (MySqlCommand put = new MySqlCommand(query, dbcon)) 934 using (MySqlCommand put = new MySqlCommand(query, dbcon))
931 { 935 {
932 936
933 put.Parameters.AddWithValue("?Email", pref.EMail); 937 put.Parameters.AddWithValue("?Email", pref.EMail);
934 put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); 938 put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
935 939
@@ -949,9 +953,9 @@ namespace OpenSim.Data.MySQL
949 } 953 }
950 return true; 954 return true;
951 } 955 }
952 956
953 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) 957 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
954 { 958 {
955 string query = string.Empty; 959 string query = string.Empty;
956 960
957 query += "UPDATE usersettings SET "; 961 query += "UPDATE usersettings SET ";
@@ -959,7 +963,7 @@ namespace OpenSim.Data.MySQL
959 query += "visible=?Visible, "; 963 query += "visible=?Visible, ";
960 query += "email=?EMail "; 964 query += "email=?EMail ";
961 query += "WHERE useruuid=?uuid"; 965 query += "WHERE useruuid=?uuid";
962 966
963 try 967 try
964 { 968 {
965 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) 969 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
index af7e876..68e1a5a 100644
--- a/OpenSim/Data/MySQL/MySQLXAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -500,4 +500,4 @@ namespace OpenSim.Data.MySQL
500 500
501 #endregion 501 #endregion
502 } 502 }
503} \ No newline at end of file 503}
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index ac31380..097271a 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` (
@@ -947,4 +947,3 @@ BEGIN;
947ALTER TABLE land CHANGE COLUMN LandFlags LandFlags int unsigned default null; 947ALTER TABLE land CHANGE COLUMN LandFlags LandFlags int unsigned default null;
948 948
949COMMIT; 949COMMIT;
950