aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/PGSQL/PGSQLGroupsData.cs')
-rwxr-xr-x[-rw-r--r--]OpenSim/Data/PGSQL/PGSQLGroupsData.cs26
1 files changed, 13 insertions, 13 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
index 669e3c8..e257e7c 100644..100755
--- a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
@@ -31,12 +31,13 @@ using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using log4net;
34using Npgsql; 35using Npgsql;
35 36
36namespace OpenSim.Data.PGSQL 37namespace OpenSim.Data.PGSQL
37{ 38{
38 public class PGSQLGroupsData : IGroupsData 39 public class PGSQLGroupsData : IGroupsData
39 { 40 {
40 private PGSqlGroupsGroupsHandler m_Groups; 41 private PGSqlGroupsGroupsHandler m_Groups;
41 private PGSqlGroupsMembershipHandler m_Membership; 42 private PGSqlGroupsMembershipHandler m_Membership;
42 private PGSqlGroupsRolesHandler m_Roles; 43 private PGSqlGroupsRolesHandler m_Roles;
@@ -82,14 +83,17 @@ namespace OpenSim.Data.PGSQL
82 83
83 public GroupData[] RetrieveGroups(string pattern) 84 public GroupData[] RetrieveGroups(string pattern)
84 { 85 {
86
85 if (string.IsNullOrEmpty(pattern)) // True for where clause 87 if (string.IsNullOrEmpty(pattern)) // True for where clause
86 { 88 {
87 pattern = " true ORDER BY lower(\"Name\") LIMIT 100"; 89 pattern = " 1 ORDER BY lower(\"Name\") LIMIT 100";
90
88 return m_Groups.Get(pattern); 91 return m_Groups.Get(pattern);
89 } 92 }
90 else 93 else
91 { 94 {
92 pattern = " lower(\"Name\") LIKE lower('%:pattern%') ORDER BY lower(\"Name\") LIMIT 100"; 95 pattern = " \"ShowInList\" = 1 AND lower(\"Name\") LIKE lower('%" + pattern + "%') ORDER BY lower(\"Name\") LIMIT 100";
96
93 return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern)); 97 return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern));
94 } 98 }
95 } 99 }
@@ -428,13 +432,11 @@ namespace OpenSim.Data.PGSQL
428 432
429 public void DeleteOld() 433 public void DeleteOld()
430 { 434 {
431 uint now = (uint)Util.UnixTimeSinceEpoch();
432 435
433 using (NpgsqlCommand cmd = new NpgsqlCommand()) 436 using (NpgsqlCommand cmd = new NpgsqlCommand())
434 { 437 {
435 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < :tstamp", m_Realm); 438 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
436 cmd.Parameters.AddWithValue("tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old 439
437
438 ExecuteNonQuery(cmd); 440 ExecuteNonQuery(cmd);
439 } 441 }
440 442
@@ -456,13 +458,11 @@ namespace OpenSim.Data.PGSQL
456 458
457 public void DeleteOld() 459 public void DeleteOld()
458 { 460 {
459 uint now = (uint)Util.UnixTimeSinceEpoch();
460 461
461 using (NpgsqlCommand cmd = new NpgsqlCommand()) 462 using (NpgsqlCommand cmd = new NpgsqlCommand())
462 { 463 {
463 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < :tstamp", m_Realm); 464 cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
464 cmd.Parameters.AddWithValue("tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old 465
465
466 ExecuteNonQuery(cmd); 466 ExecuteNonQuery(cmd);
467 } 467 }
468 468