From 16d68749a457acf079a6737f4ca9a9adb9e53e2f Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Fri, 3 Oct 2008 23:00:42 +0000 Subject: 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. --- OpenSim/Data/MSSQL/MSSQLGridData.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Data/MSSQL/MSSQLGridData.cs') 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 return null; } + + /// + /// Returns up to maxNum profiles of regions that have a name starting with namePrefix + /// + /// The name to match against + /// Maximum number of profiles to return + /// A list of sim profiles + override public List GetRegionsByName (string namePrefix, uint maxNum) + { + using (AutoClosingSqlCommand command = database.Query("SELECT * FROM regions WHERE regionName LIKE @name")) + { + command.Parameters.Add(database.CreateParameter("name", namePrefix + "%")); + + List rows = new List(); + + using (SqlDataReader reader = command.ExecuteReader()) + { + while (rows.Count < maxNum && reader.Read()) + { + rows.Add(ReadSimRow(reader)); + } + } + + return rows; + } + } + /// /// Returns a sim profile from its location /// -- cgit v1.1