aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserAccountData.cs
diff options
context:
space:
mode:
authorMelanie2012-04-30 19:04:38 +0100
committerMelanie2012-04-30 19:04:38 +0100
commit4b982db2525c67d3ae5dd9ef8c3e00c4c0d8fdf6 (patch)
tree4a1a8386e77f584c900229f1e8ddb08058d07697 /OpenSim/Data/MySQL/MySQLUserAccountData.cs
parentMerge branch 'master' into careminster (diff)
parentCreate TestHelpers.EnableLogging() and DisableLogging() to turn logging on an... (diff)
downloadopensim-SC-4b982db2525c67d3ae5dd9ef8c3e00c4c0d8fdf6.zip
opensim-SC-4b982db2525c67d3ae5dd9ef8c3e00c4c0d8fdf6.tar.gz
opensim-SC-4b982db2525c67d3ae5dd9ef8c3e00c4c0d8fdf6.tar.bz2
opensim-SC-4b982db2525c67d3ae5dd9ef8c3e00c4c0d8fdf6.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Data/MySQL/MySQLAssetData.cs OpenSim/Data/MySQL/MySQLSimulationData.cs OpenSim/Data/MySQL/MySQLUserAccountData.cs
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserAccountData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs48
1 files changed, 25 insertions, 23 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index a18ac66..4ff3175 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -66,38 +66,40 @@ namespace OpenSim.Data.MySQL
66 if (words.Length > 2) 66 if (words.Length > 2)
67 return new UserAccountData[0]; 67 return new UserAccountData[0];
68 68
69 MySqlCommand cmd = new MySqlCommand(); 69 using (MySqlCommand cmd = new MySqlCommand())
70
71 if (words.Length == 1)
72 {
73 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm);
74 cmd.Parameters.AddWithValue("?search", words[0] + "%");
75 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
76 }
77 else
78 { 70 {
79 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm); 71 if (words.Length == 1)
80 cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%"); 72 {
81 cmd.Parameters.AddWithValue("?searchLast", words[1] + "%"); 73 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm);
82 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 74 cmd.Parameters.AddWithValue("?search", words[0] + "%");
83 } 75 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
76 }
77 else
78 {
79 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm);
80 cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%");
81 cmd.Parameters.AddWithValue("?searchLast", words[1] + "%");
82 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
83 }
84 84
85 return DoQuery(cmd); 85 return DoQuery(cmd);
86 }
86 } 87 }
87 88
88 public UserAccountData[] GetUsersWhere(UUID scopeID, string where) 89 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
89 { 90 {
90 MySqlCommand cmd = new MySqlCommand(); 91 using (MySqlCommand cmd = new MySqlCommand())
91
92 if (scopeID != UUID.Zero)
93 { 92 {
94 where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; 93 if (scopeID != UUID.Zero)
95 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 94 {
96 } 95 where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")";
96 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
97 }
97 98
98 cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); 99 cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm);
99 100
100 return DoQuery(cmd); 101 return DoQuery(cmd);
102 }
101 } 103 }
102 } 104 }
103} 105}