From f91ec192247d64786b3eeab66512fdf319273d68 Mon Sep 17 00:00:00 2001 From: Marck Date: Sat, 31 Jul 2010 20:16:39 +0200 Subject: Implemented console command "show hyperlinks". --- OpenSim/Data/MSSQL/MSSQLRegionData.cs | 55 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'OpenSim/Data/MSSQL/MSSQLRegionData.cs') 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 return true; } return false; - } + } public List GetDefaultRegions(UUID scopeID) - { - string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 1) <> 0"; - if (scopeID != UUID.Zero) - sql += " AND ScopeID = @scopeID"; - - using (SqlConnection conn = new SqlConnection(m_ConnectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); - conn.Open(); - return RunCommand(cmd); - } - + { + return Get((int)RegionFlags.DefaultRegion, scopeID); } public List GetFallbackRegions(UUID scopeID, int x, int y) - { - string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 2) <> 0"; - if (scopeID != UUID.Zero) - sql += " AND ScopeID = @scopeID"; - - using (SqlConnection conn = new SqlConnection(m_ConnectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); - conn.Open(); - // TODO: distance-sort results - return RunCommand(cmd); - } - } + { + // TODO: distance-sort results + return Get((int)RegionFlags.FallbackRegion, scopeID); + } + + public List GetHyperlinks(UUID scopeID) + { + return Get((int)RegionFlags.Hyperlink, scopeID); + } + + private List Get(int regionFlags, UUID scopeID) + { + string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0"; + if (scopeID != UUID.Zero) + sql += " AND ScopeID = @scopeID"; + + using (SqlConnection conn = new SqlConnection(m_ConnectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); + conn.Open(); + return RunCommand(cmd); + } + } } } -- cgit v1.1