diff options
author | Marck | 2010-07-31 20:16:39 +0200 |
---|---|---|
committer | Diva Canto | 2010-07-31 16:38:23 -0700 |
commit | f91ec192247d64786b3eeab66512fdf319273d68 (patch) | |
tree | c3c282e0ddb559ad31be461addca925111104bbc /OpenSim/Data | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-f91ec192247d64786b3eeab66512fdf319273d68.zip opensim-SC_OLD-f91ec192247d64786b3eeab66512fdf319273d68.tar.gz opensim-SC_OLD-f91ec192247d64786b3eeab66512fdf319273d68.tar.bz2 opensim-SC_OLD-f91ec192247d64786b3eeab66512fdf319273d68.tar.xz |
Implemented console command "show hyperlinks".
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/IRegionData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLRegionData.cs | 55 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 49 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullRegionData.cs | 61 |
4 files changed, 87 insertions, 85 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs index 8259f9b..9f08e04 100644 --- a/OpenSim/Data/IRegionData.cs +++ b/OpenSim/Data/IRegionData.cs | |||
@@ -58,10 +58,11 @@ namespace OpenSim.Data | |||
58 | 58 | ||
59 | bool SetDataItem(UUID principalID, string item, string value); | 59 | bool SetDataItem(UUID principalID, string item, string value); |
60 | 60 | ||
61 | bool Delete(UUID regionID); | 61 | bool Delete(UUID regionID); |
62 | 62 | ||
63 | List<RegionData> GetDefaultRegions(UUID scopeID); | 63 | List<RegionData> GetDefaultRegions(UUID scopeID); |
64 | List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y); | 64 | List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y); |
65 | List<RegionData> GetHyperlinks(UUID scopeID); | ||
65 | } | 66 | } |
66 | 67 | ||
67 | [Flags] | 68 | [Flags] |
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 66c3f81..73c67d4 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs | |||
@@ -306,38 +306,37 @@ namespace OpenSim.Data.MSSQL | |||
306 | return true; | 306 | return true; |
307 | } | 307 | } |
308 | return false; | 308 | return false; |
309 | } | 309 | } |
310 | 310 | ||
311 | public List<RegionData> GetDefaultRegions(UUID scopeID) | 311 | public List<RegionData> GetDefaultRegions(UUID scopeID) |
312 | { | 312 | { |
313 | string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 1) <> 0"; | 313 | return Get((int)RegionFlags.DefaultRegion, scopeID); |
314 | if (scopeID != UUID.Zero) | ||
315 | sql += " AND ScopeID = @scopeID"; | ||
316 | |||
317 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
318 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
319 | { | ||
320 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
321 | conn.Open(); | ||
322 | return RunCommand(cmd); | ||
323 | } | ||
324 | |||
325 | } | 314 | } |
326 | 315 | ||
327 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) | 316 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) |
328 | { | 317 | { |
329 | string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 2) <> 0"; | 318 | // TODO: distance-sort results |
330 | if (scopeID != UUID.Zero) | 319 | return Get((int)RegionFlags.FallbackRegion, scopeID); |
331 | sql += " AND ScopeID = @scopeID"; | 320 | } |
332 | 321 | ||
333 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | 322 | public List<RegionData> GetHyperlinks(UUID scopeID) |
334 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | 323 | { |
335 | { | 324 | return Get((int)RegionFlags.Hyperlink, scopeID); |
336 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | 325 | } |
337 | conn.Open(); | 326 | |
338 | // TODO: distance-sort results | 327 | private List<RegionData> Get(int regionFlags, UUID scopeID) |
339 | return RunCommand(cmd); | 328 | { |
340 | } | 329 | string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0"; |
341 | } | 330 | if (scopeID != UUID.Zero) |
331 | sql += " AND ScopeID = @scopeID"; | ||
332 | |||
333 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
334 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
335 | { | ||
336 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
337 | conn.Open(); | ||
338 | return RunCommand(cmd); | ||
339 | } | ||
340 | } | ||
342 | } | 341 | } |
343 | } | 342 | } |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index c7bddac..6dc62c6 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -280,32 +280,35 @@ namespace OpenSim.Data.MySQL | |||
280 | } | 280 | } |
281 | 281 | ||
282 | return false; | 282 | return false; |
283 | } | 283 | } |
284 | |||
284 | public List<RegionData> GetDefaultRegions(UUID scopeID) | 285 | public List<RegionData> GetDefaultRegions(UUID scopeID) |
285 | { | 286 | { |
286 | string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0"; | 287 | return Get((int)RegionFlags.DefaultRegion, scopeID); |
287 | if (scopeID != UUID.Zero) | ||
288 | command += " and ScopeID = ?scopeID"; | ||
289 | |||
290 | MySqlCommand cmd = new MySqlCommand(command); | ||
291 | |||
292 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
293 | |||
294 | return RunCommand(cmd); | ||
295 | } | 288 | } |
296 | 289 | ||
297 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) | 290 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) |
298 | { | 291 | { |
299 | string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0"; | 292 | // TODO: distance-sort results |
300 | if (scopeID != UUID.Zero) | 293 | return Get((int)RegionFlags.FallbackRegion, scopeID); |
301 | command += " and ScopeID = ?scopeID"; | 294 | } |
302 | 295 | ||
303 | MySqlCommand cmd = new MySqlCommand(command); | 296 | public List<RegionData> GetHyperlinks(UUID scopeID) |
304 | 297 | { | |
305 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 298 | return Get((int)RegionFlags.Hyperlink, scopeID); |
306 | 299 | } | |
307 | // TODO: distance-sort results | 300 | |
308 | return RunCommand(cmd); | 301 | private List<RegionData> Get(int regionFlags, UUID scopeID) |
309 | } | 302 | { |
303 | string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0"; | ||
304 | if (scopeID != UUID.Zero) | ||
305 | command += " and ScopeID = ?scopeID"; | ||
306 | |||
307 | MySqlCommand cmd = new MySqlCommand(command); | ||
308 | |||
309 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
310 | |||
311 | return RunCommand(cmd); | ||
312 | } | ||
310 | } | 313 | } |
311 | } | 314 | } |
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index d596698..397b32d 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs | |||
@@ -49,8 +49,8 @@ namespace OpenSim.Data.Null | |||
49 | if (Instance == null) | 49 | if (Instance == null) |
50 | Instance = this; | 50 | Instance = this; |
51 | //Console.WriteLine("[XXX] NullRegionData constructor"); | 51 | //Console.WriteLine("[XXX] NullRegionData constructor"); |
52 | } | 52 | } |
53 | 53 | ||
54 | public List<RegionData> Get(string regionName, UUID scopeID) | 54 | public List<RegionData> Get(string regionName, UUID scopeID) |
55 | { | 55 | { |
56 | if (Instance != this) | 56 | if (Instance != this) |
@@ -160,38 +160,37 @@ namespace OpenSim.Data.Null | |||
160 | m_regionData.Remove(regionID); | 160 | m_regionData.Remove(regionID); |
161 | 161 | ||
162 | return true; | 162 | return true; |
163 | } | 163 | } |
164 | 164 | ||
165 | public List<RegionData> GetDefaultRegions(UUID scopeID) | 165 | public List<RegionData> GetDefaultRegions(UUID scopeID) |
166 | { | 166 | { |
167 | if (Instance != this) | 167 | return Get((int)RegionFlags.DefaultRegion, scopeID); |
168 | return Instance.GetDefaultRegions(scopeID); | ||
169 | |||
170 | List<RegionData> ret = new List<RegionData>(); | ||
171 | |||
172 | foreach (RegionData r in m_regionData.Values) | ||
173 | { | ||
174 | if ((Convert.ToInt32(r.Data["flags"]) & 1) != 0) | ||
175 | ret.Add(r); | ||
176 | } | ||
177 | |||
178 | return ret; | ||
179 | } | 168 | } |
180 | 169 | ||
181 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) | 170 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) |
182 | { | 171 | { |
183 | if (Instance != this) | 172 | return Get((int)RegionFlags.FallbackRegion, scopeID); |
184 | return Instance.GetFallbackRegions(scopeID, x, y); | 173 | } |
185 | 174 | ||
186 | List<RegionData> ret = new List<RegionData>(); | 175 | public List<RegionData> GetHyperlinks(UUID scopeID) |
187 | 176 | { | |
188 | foreach (RegionData r in m_regionData.Values) | 177 | return Get((int)RegionFlags.Hyperlink, scopeID); |
189 | { | 178 | } |
190 | if ((Convert.ToInt32(r.Data["flags"]) & 2) != 0) | 179 | |
191 | ret.Add(r); | 180 | private List<RegionData> Get(int regionFlags, UUID scopeID) |
192 | } | 181 | { |
193 | 182 | if (Instance != this) | |
194 | return ret; | 183 | return Instance.Get(regionFlags, scopeID); |
195 | } | 184 | |
185 | List<RegionData> ret = new List<RegionData>(); | ||
186 | |||
187 | foreach (RegionData r in m_regionData.Values) | ||
188 | { | ||
189 | if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0) | ||
190 | ret.Add(r); | ||
191 | } | ||
192 | |||
193 | return ret; | ||
194 | } | ||
196 | } | 195 | } |
197 | } \ No newline at end of file | 196 | } \ No newline at end of file |