aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorHomer Horwitz2008-10-03 23:00:42 +0000
committerHomer Horwitz2008-10-03 23:00:42 +0000
commit16d68749a457acf079a6737f4ca9a9adb9e53e2f (patch)
tree901b2c31e53eeb97f30ac46f2b7f406a01e1755a /OpenSim/Data
parentFix: Mantis#2326: Fix: privilege escalation through attach from ground (diff)
downloadopensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.zip
opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.gz
opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.bz2
opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.xz
Add the missing bits for the new region-search:
- Added lookup in the data-layer - MySQL works - SQLite doesn't have a grid-db, so it won't work there - I added MSSQL-code to the best of my knowledge; but I don't know MSSQL :-) - Added the plumbing up to OGS1GridServices. This speaks with the grid-server via XMLRPC. - Modified MapSearchModule to use the new data. It's backward compatible; if used with an old grid-server, it just returns one found region instead of a list. - Refactored a bit. Note: This updates data, grid-server and region code. No new files.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/GridDataBase.cs3
-rw-r--r--OpenSim/Data/IGridData.cs9
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridData.cs27
-rw-r--r--OpenSim/Data/MySQL/MySQLGridData.cs46
-rw-r--r--OpenSim/Data/SQLite/SQLiteGridData.cs12
5 files changed, 97 insertions, 0 deletions
diff --git a/OpenSim/Data/GridDataBase.cs b/OpenSim/Data/GridDataBase.cs
index e8dbc11..1e2b6fa 100644
--- a/OpenSim/Data/GridDataBase.cs
+++ b/OpenSim/Data/GridDataBase.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic;
28using OpenMetaverse; 29using OpenMetaverse;
29 30
30namespace OpenSim.Data 31namespace OpenSim.Data
@@ -35,6 +36,7 @@ namespace OpenSim.Data
35 public abstract RegionProfileData GetProfileByUUID(UUID UUID); 36 public abstract RegionProfileData GetProfileByUUID(UUID UUID);
36 public abstract RegionProfileData GetProfileByString(string regionName); 37 public abstract RegionProfileData GetProfileByString(string regionName);
37 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); 38 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
39 public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
38 public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); 40 public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
39 public abstract DataResponse AddProfile(RegionProfileData profile); 41 public abstract DataResponse AddProfile(RegionProfileData profile);
40 public abstract ReservationData GetReservationAtPoint(uint x, uint y); 42 public abstract ReservationData GetReservationAtPoint(uint x, uint y);
@@ -44,6 +46,7 @@ namespace OpenSim.Data
44 public abstract void Initialise(); 46 public abstract void Initialise();
45 public abstract void Initialise(string connect); 47 public abstract void Initialise(string connect);
46 public abstract void Dispose(); 48 public abstract void Dispose();
49
47 public abstract string Name { get; } 50 public abstract string Name { get; }
48 public abstract string Version { get; } 51 public abstract string Version { get; }
49 } 52 }
diff --git a/OpenSim/Data/IGridData.cs b/OpenSim/Data/IGridData.cs
index 132361f..a42a7d8 100644
--- a/OpenSim/Data/IGridData.cs
+++ b/OpenSim/Data/IGridData.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenSim.Framework; 30using OpenSim.Framework;
30 31
@@ -80,6 +81,14 @@ namespace OpenSim.Data
80 RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); 81 RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
81 82
82 /// <summary> 83 /// <summary>
84 /// Returns up to maxNum profiles of regions that have a name starting with namePrefix
85 /// </summary>
86 /// <param name="name">The name to match against</param>
87 /// <param name="maxNum">Maximum number of profiles to return</param>
88 /// <returns>A list of sim profiles</returns>
89 List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
90
91 /// <summary>
83 /// Authenticates a sim by use of its recv key. 92 /// Authenticates a sim by use of its recv key.
84 /// WARNING: Insecure 93 /// WARNING: Insecure
85 /// </summary> 94 /// </summary>
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs
index 443116a..6f94980 100644
--- a/OpenSim/Data/MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs
@@ -216,6 +216,33 @@ namespace OpenSim.Data.MSSQL
216 return null; 216 return null;
217 } 217 }
218 218
219
220 /// <summary>
221 /// Returns up to maxNum profiles of regions that have a name starting with namePrefix
222 /// </summary>
223 /// <param name="name">The name to match against</param>
224 /// <param name="maxNum">Maximum number of profiles to return</param>
225 /// <returns>A list of sim profiles</returns>
226 override public List<RegionProfileData> GetRegionsByName (string namePrefix, uint maxNum)
227 {
228 using (AutoClosingSqlCommand command = database.Query("SELECT * FROM regions WHERE regionName LIKE @name"))
229 {
230 command.Parameters.Add(database.CreateParameter("name", namePrefix + "%"));
231
232 List<RegionProfileData> rows = new List<RegionProfileData>();
233
234 using (SqlDataReader reader = command.ExecuteReader())
235 {
236 while (rows.Count < maxNum && reader.Read())
237 {
238 rows.Add(ReadSimRow(reader));
239 }
240 }
241
242 return rows;
243 }
244 }
245
219 /// <summary> 246 /// <summary>
220 /// Returns a sim profile from its location 247 /// Returns a sim profile from its location
221 /// </summary> 248 /// </summary>
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs
index 1155ae3..26a8591 100644
--- a/OpenSim/Data/MySQL/MySQLGridData.cs
+++ b/OpenSim/Data/MySQL/MySQLGridData.cs
@@ -283,6 +283,52 @@ namespace OpenSim.Data.MySQL
283 } 283 }
284 284
285 /// <summary> 285 /// <summary>
286 /// Returns up to maxNum profiles of regions that have a name starting with namePrefix
287 /// </summary>
288 /// <param name="name">The name to match against</param>
289 /// <param name="maxNum">Maximum number of profiles to return</param>
290 /// <returns>A list of sim profiles</returns>
291 override public List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum)
292 {
293 MySQLSuperManager dbm = GetLockedConnection();
294
295 try
296 {
297 Dictionary<string, string> param = new Dictionary<string, string>();
298 param["?name"] = namePrefix + "%";
299
300 IDbCommand result =
301 dbm.Manager.Query(
302 "SELECT * FROM regions WHERE regionName LIKE ?name",
303 param);
304 IDataReader reader = result.ExecuteReader();
305
306 RegionProfileData row;
307
308 List<RegionProfileData> rows = new List<RegionProfileData>();
309
310 while (rows.Count < maxNum && (row = dbm.Manager.readSimRow(reader)) != null)
311 {
312 rows.Add(row);
313 }
314 reader.Close();
315 result.Dispose();
316
317 return rows;
318 }
319 catch (Exception e)
320 {
321 dbm.Manager.Reconnect();
322 m_log.Error(e.ToString());
323 return null;
324 }
325 finally
326 {
327 dbm.Release();
328 }
329 }
330
331 /// <summary>
286 /// Returns a sim profile from it's location 332 /// Returns a sim profile from it's location
287 /// </summary> 333 /// </summary>
288 /// <param name="handle">Region location handle</param> 334 /// <param name="handle">Region location handle</param>
diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs
index 3e1c67a..5b0455d 100644
--- a/OpenSim/Data/SQLite/SQLiteGridData.cs
+++ b/OpenSim/Data/SQLite/SQLiteGridData.cs
@@ -108,6 +108,18 @@ namespace OpenSim.Data.SQLite
108 return null; 108 return null;
109 } 109 }
110 110
111
112 /// <summary>
113 /// Returns up to maxNum profiles of regions that have a name starting with namePrefix
114 /// </summary>
115 /// <param name="name">The name to match against</param>
116 /// <param name="maxNum">Maximum number of profiles to return</param>
117 /// <returns>A list of sim profiles</returns>
118 override public List<RegionProfileData> GetRegionsByName (string namePrefix, uint maxNum)
119 {
120 return null;
121 }
122
111 /// <summary> 123 /// <summary>
112 /// Returns a sim profile from it's handle 124 /// Returns a sim profile from it's handle
113 /// </summary> 125 /// </summary>