aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index 2b91cf9..38a1d08 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -180,6 +180,49 @@ namespace OpenSim.Framework.Data.MSSQL
180 return row; 180 return row;
181 } 181 }
182 182
183
184 /// <summary>
185 /// Returns a sim profile from it's Region name string
186 /// </summary>
187 /// <param name="uuid">The region name search query</param>
188 /// <returns>The sim profile</returns>
189 public RegionProfileData GetProfileByString(string regionName)
190 {
191 if (regionName.Length > 2)
192 {
193 try
194 {
195 lock (database)
196 {
197 Dictionary<string, string> param = new Dictionary<string, string>();
198 // Add % because this is a like query.
199 param["?regionName"] = regionName + "%";
200 // Order by statement will return shorter matches first. Only returns one record or no record.
201 IDbCommand result = database.Query("SELECT top 1 * FROM " + m_regionsTableName + " WHERE regionName like ?regionName order by regionName", param);
202 IDataReader reader = result.ExecuteReader();
203
204 RegionProfileData row = database.getRegionRow(reader);
205 reader.Close();
206 result.Dispose();
207
208 return row;
209 }
210 }
211 catch (Exception e)
212 {
213 database.Reconnect();
214 m_log.Error(e.ToString());
215 return null;
216 }
217 }
218 else
219 {
220 m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters");
221 return null;
222 }
223 }
224
225
183 /// <summary> 226 /// <summary>
184 /// Adds a new specified region to the database 227 /// Adds a new specified region to the database
185 /// </summary> 228 /// </summary>